123456789101112131415161718192021222324252627282930313233343536373839 |
- #pragma once
- #include <pc/video_track_source.h>
- #include <media/base/video_broadcaster.h>
- #include "../include/cap_interface.h"
- class COverlayVideo:public IOverlayVideo,public rtc::VideoSourceInterface<webrtc::VideoFrame>
- {
- public:
- COverlayVideo();
- virtual void OnVideoData(const webrtc::VideoFrame& frame) override;
- virtual void AddOrUpdateSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink,
- const rtc::VideoSinkWants& wants) override;
- virtual void RemoveSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) override;
- private:
- rtc::VideoBroadcaster _broadcaster;
- };
- class COverlayTrackSource :public webrtc::VideoTrackSource
- {
- public:
- static rtc::scoped_refptr<COverlayTrackSource> Create(std::unique_ptr<COverlayVideo> capturer) {
- return new rtc::RefCountedObject<COverlayTrackSource>(std::move(capturer));
- }
- protected:
- explicit COverlayTrackSource(std::unique_ptr<COverlayVideo> capturer)
- : VideoTrackSource(false),
- capturer_(std::move(capturer)) {}
- ~COverlayTrackSource()
- {
- //capturer_->Stop();
- }
- private:
- rtc::VideoSourceInterface<webrtc::VideoFrame>* source() override {
- return capturer_.get();
- }
- std::unique_ptr<COverlayVideo> capturer_;
- };
- rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> OpenOverlayVideoTrack(IOverlayVideo*);
- IOverlayVideo* CreateOverlayVideo();
|