| #include "api/video_codecs/video_encoder_factory.h" |
| 6 | #include "api/video_codecs/video_decoder_factory.h" |
| 7 | #include "api/media_stream_interface.h" |
| 8 | #include <string> |
| 9 |
| 10 | namespace tgcalls { |
| 11 |
| 12 | enum class VideoState; |
| 13 |
| 14 | class VideoCapturerInterface; |
| 15 | class PlatformContext; |
| 16 |
| 17 | struct PlatformCaptureInfo { |
| 18 | bool shouldBeAdaptedToReceiverAspectRate = false; |
| 19 | }; |
| 20 |
| 21 | class PlatformInterface { |
| 22 | public: |
| 23 | static PlatformInterface *SharedInstance(); |
| 24 | virtual ~PlatformInterface() = default; |
| 25 |
| 26 | virtual void configurePlatformAudio() { |
| 27 | } |
| 28 |
| 29 | virtual std::unique_ptr<webrtc::VideoEncoderFactory> makeVideoEncoderFactory(std::shared_ptr<PlatformContext> platformContext) = 0; |
| 30 | virtual std::unique_ptr<webrtc::VideoDecoderFactory> makeVideoDecoderFactory(std::shared_ptr<PlatformContext> platformContext) = 0; |
| 31 | virtual bool supportsEncoding(const std::string &codecName, std::shared_ptr<PlatformContext> platformContext) = 0; |
| 32 | virtual rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> makeVideoSource(rtc::Thread *signalingThread, rtc::Thread *workerThread) = 0; |
| 33 | virtual void adaptVideoSource(rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> videoSource, int width, int height, int fps) = 0; |
| 34 | virtual std::unique_ptr<VideoCapturerInterface> makeVideoCapturer(rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> source, std::string deviceId, std::function<void(VideoState)> stateUpdated, std::function<void(PlatformCaptureInfo)> captureInfoUpdated, std::shared_ptr<PlatformContext> platformContext, std::pair<int, int> &outResolution) = 0; |
| 35 |
| 36 | }; |
| 37 |
| 38 | std::unique_ptr<PlatformInterface> CreatePlatformInterface(); |
| 39 |
| 40 | inline PlatformInterface *PlatformInterface::SharedInstance() { |
| 41 | static const auto result = CreatePlatformInterface(); |
| 42 | return result.get(); |
| 43 | } |
| 44 |
| 45 | } // namespace tgcalls |
| 46 |
| 47 | #endif |
| 48 |