9#ifndef SKYWAY_MEDIA_V4L2_CAPTURER_VIDEO_SOURCE_HPP_
10#define SKYWAY_MEDIA_V4L2_CAPTURER_VIDEO_SOURCE_HPP_
12#include <api/video/video_sink_interface.h>
13#include <modules/video_capture/video_capture.h>
15#include "skyway/media/interface/capturer_video_source.hpp"
22class V4l2CapturerVideoSource :
public interface::InternalCapturerVideoSource {
24 class VideoSinkCallback :
public rtc::VideoSinkInterface<webrtc::VideoFrame> {
26 VideoSinkCallback(V4l2CapturerVideoSource* source) : source_(source){};
28 void OnFrame(
const webrtc::VideoFrame& frame) { source_->OnFrame(frame); }
31 V4l2CapturerVideoSource* source_ =
nullptr;
33 ~V4l2CapturerVideoSource();
35 static rtc::scoped_refptr<V4l2CapturerVideoSource> Create(
36 const std::string& device_unique_id, webrtc::VideoCaptureCapability device_capability);
39 bool is_screencast()
const override;
40 absl::optional<bool> needs_denoising()
const override;
41 webrtc::MediaSourceInterface::SourceState state()
const override;
42 bool remote()
const override;
45 V4l2CapturerVideoSource();
48 bool Init(
const std::string& device_unique_id,
49 webrtc::VideoCaptureCapability device_capability);
51 rtc::scoped_refptr<webrtc::VideoCaptureModule> vcm_ =
nullptr;
52 std::unique_ptr<VideoSinkCallback> video_sink_callback_ =
nullptr;