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