| 6 |
| // Copyright © 2020 Mikhail Filimonov. All rights reserved. |
| 7 | // |
| 8 | #ifndef TGCALLS_DESKTOP_CAPTURE_SOURCE_HELPER_H__ |
| 9 | #define TGCALLS_DESKTOP_CAPTURE_SOURCE_HELPER_H__ |
| 10 |
| 11 | #include "tgcalls/desktop_capturer/DesktopCaptureSource.h" |
| 12 |
| 13 | #include <memory> |
| 14 | #include <functional> |
| 15 |
| 16 | namespace webrtc { |
| 17 | class VideoFrame; |
| 18 | } // namespace webrtc |
| 19 |
| 20 | namespace rtc { |
| 21 | template <typename T> |
| 22 | class VideoSinkInterface; |
| 23 | } // namespace rtc |
| 24 |
| 25 | namespace tgcalls { |
| 26 |
| 27 | DesktopCaptureSource DesktopCaptureSourceForKey( |
| 28 | const std::string &uniqueKey); |
| 29 | bool ShouldBeDesktopCapture(const std::string &uniqueKey); |
| 30 |
| 31 | class DesktopCaptureSourceHelper { |
| 32 | public: |
| 33 | DesktopCaptureSourceHelper( |
| 34 | DesktopCaptureSource source, |
| 35 | DesktopCaptureSourceData data); |
| 36 | ~DesktopCaptureSourceHelper(); |
| 37 |
| 38 | void setOutput( |
| 39 | std::shared_ptr< |
| 40 | rtc::VideoSinkInterface<webrtc::VideoFrame>> sink) const; |
| 41 | void setSecondaryOutput( |
| 42 | std::shared_ptr< |
| 43 | rtc::VideoSinkInterface<webrtc::VideoFrame>> sink) const; |
| 44 | void start() const; |
| 45 | void stop() const; |
| 46 | void setOnFatalError(std::function<void ()>) const; |
| 47 | void setOnPause(std::function<void (bool)>) const; |
| 48 | private: |
| 49 | struct Renderer; |
| 50 | std::shared_ptr<Renderer> _renderer; |
| 51 |
| 52 | }; |
| 53 |
| 54 | } // namespace tgcalls |
| 55 |
| 56 | #endif // TGCALLS_DESKTOP_CAPTURE_SOURCE_HELPER_H__ |
| 57 |