device_info_linux.cc (1339B)
1 /* 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #include <cstdlib> 12 13 #include "modules/video_capture/linux/device_info_v4l2.h" 14 #include "modules/video_capture/video_capture.h" 15 #include "modules/video_capture/video_capture_impl.h" 16 #include "modules/video_capture/video_capture_options.h" 17 18 #if defined(WEBRTC_USE_PIPEWIRE) 19 #include "modules/video_capture/linux/device_info_pipewire.h" 20 #endif 21 22 namespace webrtc { 23 namespace videocapturemodule { 24 VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo() { 25 return new videocapturemodule::DeviceInfoV4l2(); 26 } 27 28 VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo( 29 VideoCaptureOptions* options) { 30 #if defined(WEBRTC_USE_PIPEWIRE) 31 if (options->allow_pipewire()) { 32 return new videocapturemodule::DeviceInfoPipeWire(options); 33 } 34 #endif 35 if (options->allow_v4l2()) 36 return new videocapturemodule::DeviceInfoV4l2(); 37 38 return nullptr; 39 } 40 } // namespace videocapturemodule 41 } // namespace webrtc