| 6 | #ifdef TGCALLS_UWP_DESKTOP |
| 7 | #include "platform/uwp/UwpContext.h" |
| 8 | #include "platform/uwp/UwpScreenCapturer.h" |
| 9 | #endif // TGCALLS_UWP_DESKTOP |
| 10 |
| 11 | #include "api/media_stream_interface.h" |
| 12 |
| 13 | namespace tgcalls { |
| 14 |
| 15 | class DesktopCaptureSourceHelper; |
| 16 | class VideoCameraCapturer; |
| 17 | class PlatformContext; |
| 18 |
| 19 | class VideoCapturerInterfaceImpl final : public VideoCapturerInterface { |
| 20 | public: |
| 21 | VideoCapturerInterfaceImpl( |
| 22 | rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> source, |
| 23 | std::string deviceId, |
| 24 | std::function<void(VideoState)> stateUpdated, |
| 25 | std::shared_ptr<PlatformContext> platformContext, |
| 26 | std::pair<int, int> &outResolution); |
| 27 | ~VideoCapturerInterfaceImpl() override; |
| 28 |
| 29 | void setState(VideoState state) override; |
| 30 | void setPreferredCaptureAspectRatio(float aspectRatio) override; |
| 31 | void setUncroppedOutput(std::shared_ptr<rtc::VideoSinkInterface<webrtc::VideoFrame>> sink) override; |
| 32 | int getRotation() override { |
| 33 | return 0; |
| 34 | } |
| 35 | void setOnFatalError(std::function<void()> error) override; |
| 36 | void setOnPause(std::function<void(bool)> pause) override; |
| 37 |
| 38 | private: |
| 39 | rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> _source; |
| 40 | std::shared_ptr<rtc::VideoSinkInterface<webrtc::VideoFrame>> _sink; |
| 41 | #ifdef TGCALLS_UWP_DESKTOP |
| 42 | std::unique_ptr<UwpScreenCapturer> _screenCapturer; |
| 43 | #else // TGCALLS_UWP_DESKTOP |
| 44 | std::unique_ptr<DesktopCaptureSourceHelper> _desktopCapturer; |
| 45 | #endif // TGCALLS_UWP_DESKTOP |
| 46 | std::unique_ptr<VideoCameraCapturer> _cameraCapturer; |
| 47 | std::shared_ptr<rtc::VideoSinkInterface<webrtc::VideoFrame>> _uncroppedSink; |
| 48 | std::function<void(VideoState)> _stateUpdated; |
| 49 | std::function<void()> _onFatalError; |
| 50 |
| 51 | }; |
| 52 |
| 53 | } // namespace tgcalls |
| 54 |
| 55 | #endif |
| 56 |