SkyWay Linux SDK
読み取り中…
検索中…
一致する文字列を見つけられません
v4l2_capturer_video_source.hpp
1#ifndef SKYWAY_MEDIA_V4L2_CAPTURER_VIDEO_SOURCE_HPP_
2#define SKYWAY_MEDIA_V4L2_CAPTURER_VIDEO_SOURCE_HPP_
3
4#include <api/video/video_sink_interface.h>
5#include <modules/video_capture/video_capture.h>
6
7#include "skyway/media/interface/capturer_video_source.hpp"
8
9namespace skyway {
10namespace media {
11
13
14class V4l2CapturerVideoSource : public interface::InternalCapturerVideoSource {
15public:
16 class VideoSinkCallback : public rtc::VideoSinkInterface<webrtc::VideoFrame> {
17 public:
18 VideoSinkCallback(V4l2CapturerVideoSource* source) : source_(source){};
19 // rtc::VideoSinkInterface
20 void OnFrame(const webrtc::VideoFrame& frame) { source_->OnFrame(frame); }
21
22 private:
23 V4l2CapturerVideoSource* source_ = nullptr;
24 };
25 ~V4l2CapturerVideoSource();
26
27 static rtc::scoped_refptr<V4l2CapturerVideoSource> Create(
28 const std::string& device_unique_id, webrtc::VideoCaptureCapability device_capability);
29
30 // rtc::VideoSourceInterface
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;
35
36protected:
37 V4l2CapturerVideoSource();
38
39private:
40 bool Init(const std::string& device_unique_id,
41 webrtc::VideoCaptureCapability device_capability);
42 void Destroy();
43 rtc::scoped_refptr<webrtc::VideoCaptureModule> vcm_ = nullptr;
44 std::unique_ptr<VideoSinkCallback> video_sink_callback_ = nullptr;
45};
47
48} // namespace media
49} // namespace skyway
50
51#endif /* SKYWAY_MEDIA_CAPTURER_VIDEO_SOURCE_ */