video_capture_options.cc (1756B)
1 /* 2 * Copyright (c) 2022 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 "modules/video_capture/video_capture_options.h" 12 13 #include "api/make_ref_counted.h" 14 #include "api/scoped_refptr.h" 15 16 #if defined(WEBRTC_USE_PIPEWIRE) 17 #include "modules/video_capture/linux/pipewire_session.h" 18 #endif 19 20 namespace webrtc { 21 22 VideoCaptureOptions::VideoCaptureOptions() {} 23 VideoCaptureOptions::VideoCaptureOptions(const VideoCaptureOptions& options) = 24 default; 25 VideoCaptureOptions::VideoCaptureOptions(VideoCaptureOptions&& options) = 26 default; 27 VideoCaptureOptions::~VideoCaptureOptions() {} 28 29 VideoCaptureOptions& VideoCaptureOptions::operator=( 30 const VideoCaptureOptions& options) = default; 31 VideoCaptureOptions& VideoCaptureOptions::operator=( 32 VideoCaptureOptions&& options) = default; 33 34 void VideoCaptureOptions::Init(Callback* callback) { 35 #if defined(WEBRTC_USE_PIPEWIRE) 36 if (allow_pipewire_) { 37 pipewire_session_ = make_ref_counted<videocapturemodule::PipeWireSession>(); 38 pipewire_session_->Init(callback, pipewire_fd_); 39 return; 40 } 41 #endif 42 #if defined(WEBRTC_LINUX) 43 if (!allow_v4l2_) 44 callback->OnInitialized(Status::UNAVAILABLE); 45 else 46 #endif 47 callback->OnInitialized(Status::SUCCESS); 48 } 49 50 #if defined(WEBRTC_USE_PIPEWIRE) 51 webrtc::scoped_refptr<videocapturemodule::PipeWireSession> 52 VideoCaptureOptions::pipewire_session() { 53 return pipewire_session_; 54 } 55 #endif 56 57 } // namespace webrtc