overlay_video.cpp 1010 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "overlay_video.h"
  2. COverlayVideo::COverlayVideo()
  3. {
  4. }
  5. void COverlayVideo::OnVideoData(const webrtc::VideoFrame& frame)
  6. {
  7. _broadcaster.OnFrame(frame);
  8. }
  9. void COverlayVideo::AddOrUpdateSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink,
  10. const rtc::VideoSinkWants& wants)
  11. {
  12. _broadcaster.AddOrUpdateSink(sink, wants);
  13. }
  14. void COverlayVideo::RemoveSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink)
  15. {
  16. _broadcaster.RemoveSink(sink);
  17. }
  18. rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> OpenOverlayVideoTrack(IOverlayVideo* cap)
  19. {
  20. // ANativeWindow* window=(ANativeWindow *)data;
  21. auto capturer = dynamic_cast<COverlayVideo*>(cap);
  22. if (capturer == nullptr)
  23. {
  24. return { };
  25. }
  26. std::unique_ptr<COverlayVideo> video_capture(capturer);
  27. rtc::scoped_refptr<COverlayTrackSource> video_source = COverlayTrackSource::Create(std::move(video_capture));
  28. return video_source;
  29. }
  30. IOverlayVideo* CreateOverlayVideo()
  31. {
  32. return new COverlayVideo();
  33. }