5#ifndef SKYWAY_MEDIA_V4L2_CAPTURER_VIDEO_SOURCE_HPP_
6#define SKYWAY_MEDIA_V4L2_CAPTURER_VIDEO_SOURCE_HPP_
8#include <api/video/video_sink_interface.h>
9#include <modules/video_capture/video_capture.h>
11#include "skyway/media/interface/capturer_video_source.hpp"
18class V4l2CapturerVideoSource :
public interface::InternalCapturerVideoSource {
20 class VideoSinkCallback :
public rtc::VideoSinkInterface<webrtc::VideoFrame> {
22 VideoSinkCallback(V4l2CapturerVideoSource* source) : source_(source){};
24 void OnFrame(
const webrtc::VideoFrame& frame) { source_->OnFrame(frame); }
27 V4l2CapturerVideoSource* source_ =
nullptr;
29 ~V4l2CapturerVideoSource();
31 static rtc::scoped_refptr<V4l2CapturerVideoSource> Create(
32 const std::string& device_unique_id, webrtc::VideoCaptureCapability device_capability);
35 bool is_screencast()
const override;
36 absl::optional<bool> needs_denoising()
const override;
37 webrtc::MediaSourceInterface::SourceState state()
const override;
38 bool remote()
const override;
41 V4l2CapturerVideoSource();
44 bool Init(
const std::string& device_unique_id,
45 webrtc::VideoCaptureCapability device_capability);
47 rtc::scoped_refptr<webrtc::VideoCaptureModule> vcm_ =
nullptr;
48 std::unique_ptr<VideoSinkCallback> video_sink_callback_ =
nullptr;