1#ifndef SKYWAY_MEDIA_V4L2_CAPTURER_VIDEO_SOURCE_HPP_
2#define SKYWAY_MEDIA_V4L2_CAPTURER_VIDEO_SOURCE_HPP_
4#include <api/video/video_sink_interface.h>
5#include <modules/video_capture/video_capture.h>
7#include "skyway/media/interface/capturer_video_source.hpp"
14class V4l2CapturerVideoSource :
public interface::InternalCapturerVideoSource {
16 class VideoSinkCallback :
public rtc::VideoSinkInterface<webrtc::VideoFrame> {
18 VideoSinkCallback(V4l2CapturerVideoSource* source) : source_(source){};
20 void OnFrame(
const webrtc::VideoFrame& frame) { source_->OnFrame(frame); }
23 V4l2CapturerVideoSource* source_ =
nullptr;
25 ~V4l2CapturerVideoSource();
27 static rtc::scoped_refptr<V4l2CapturerVideoSource> Create(
28 const std::string& device_unique_id, webrtc::VideoCaptureCapability device_capability);
31 bool is_screencast()
const override;
32 absl::optional<bool> needs_denoising()
const override;
33 webrtc::MediaSourceInterface::SourceState state()
const override;
34 bool remote()
const override;
37 V4l2CapturerVideoSource();
40 bool Init(
const std::string& device_unique_id,
41 webrtc::VideoCaptureCapability device_capability);
43 rtc::scoped_refptr<webrtc::VideoCaptureModule> vcm_ =
nullptr;
44 std::unique_ptr<VideoSinkCallback> video_sink_callback_ =
nullptr;