13 #include <api/video/i420_buffer.h>
14 #include <libyuv/convert.h>
15 #include <libyuv/video_common.h>
16 #include <media/base/video_broadcaster.h>
17 #include <media/base/video_common.h>
26 namespace visualization {
27 namespace webrtc_server {
29 class ImageCapturer :
public rtc::VideoSourceInterface<webrtc::VideoFrame> {
32 const std::map<std::string, std::string>& opts);
36 const std::string& url,
37 const std::map<std::string, std::string>& opts);
39 ImageCapturer(
const std::map<std::string, std::string>& opts);
42 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink,
43 const rtc::VideoSinkWants& wants)
override;
46 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink)
override;
58 static rtc::scoped_refptr<BitmapTrackSourceInterface>
Create(
59 const std::string& window_uid,
60 const std::map<std::string, std::string>& opts) {
61 std::unique_ptr<ImageCapturer> capturer =
66 rtc::scoped_refptr<BitmapTrackSourceInterface> video_source =
67 new rtc::RefCountedObject<ImageTrackSource>(
72 void OnFrame(
const std::shared_ptr<core::Tensor>&
frame)
final override {
73 capturer_->OnCaptureResult(
frame);
81 rtc::VideoSourceInterface<webrtc::VideoFrame>* source()
override {
82 return capturer_.get();
84 std::unique_ptr<ImageCapturer> capturer_;
Rect frame
Definition: BitmapWindowSystem.cpp:30
Definition: BitmapTrackSource.h:61
Definition: ImageCapturer.h:29
int width_
Definition: ImageCapturer.h:51
int height_
Definition: ImageCapturer.h:52
virtual void RemoveSink(rtc::VideoSinkInterface< webrtc::VideoFrame > *sink) override
Definition: ImageCapturer.cpp:103
virtual void AddOrUpdateSink(rtc::VideoSinkInterface< webrtc::VideoFrame > *sink, const rtc::VideoSinkWants &wants) override
Definition: ImageCapturer.cpp:97
virtual ~ImageCapturer()
Definition: ImageCapturer.cpp:29
static ImageCapturer * Create(const std::string &url, const std::map< std::string, std::string > &opts)
Definition: ImageCapturer.cpp:31
void OnCaptureResult(const std::shared_ptr< core::Tensor > &frame)
Definition: ImageCapturer.cpp:48
ImageCapturer(const std::string &url_, const std::map< std::string, std::string > &opts)
Definition: ImageCapturer.cpp:25
rtc::VideoBroadcaster broadcaster_
Definition: ImageCapturer.h:53
Definition: ImageCapturer.h:56
void OnFrame(const std::shared_ptr< core::Tensor > &frame) final override
Definition: ImageCapturer.h:72
ImageTrackSource(std::unique_ptr< ImageCapturer > capturer)
Definition: ImageCapturer.h:77
static rtc::scoped_refptr< BitmapTrackSourceInterface > Create(const std::string &window_uid, const std::map< std::string, std::string > &opts)
Definition: ImageCapturer.h:58
Definition: PinholeCameraIntrinsic.cpp:16