| #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 |
| 9 | namespace tgcalls { |
| 10 |
| 11 | enum class VideoState; |
| 12 |
| 13 | class VideoCapturerInterface; |
| 14 | class PlatformContext; |
| 15 |
| 16 | class PlatformInterface { |
| 17 | public: |
| 18 | static PlatformInterface *SharedInstance(); |
| 19 | virtual ~PlatformInterface() = default; |
| 20 |
| 21 | virtual void configurePlatformAudio() { |
| 22 | } |
| 23 | virtual float getDisplayAspectRatio() { |
| 24 | return 0.0f; |
| 25 | } |
| 26 | virtual std::unique_ptr<webrtc::VideoEncoderFactory> makeVideoEncoderFactory(std::shared_ptr<PlatformContext> platformContext) = 0; |
| 27 | virtual std::unique_ptr<webrtc::VideoDecoderFactory> makeVideoDecoderFactory(std::shared_ptr<PlatformContext> platformContext) = 0; |
| 28 | virtual bool supportsEncoding(const std::string &codecName, std::shared_ptr<PlatformContext> platformContext) = 0; |
| 29 | virtual rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> makeVideoSource(rtc::Thread *signalingThread, rtc::Thread *workerThread) = 0; |
| 30 | virtual void adaptVideoSource(rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> videoSource, int width, int height, int fps) = 0; |
| 31 | virtual std::unique_ptr<VideoCapturerInterface> makeVideoCapturer(rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> source, bool useFrontCamera, std::function<void(VideoState)> stateUpdated, std::shared_ptr<PlatformContext> platformContext, std::pair<int, int> &outResolution) = 0; |
| 32 |
| 33 | }; |
| 34 |
| 35 | std::unique_ptr<PlatformInterface> CreatePlatformInterface(); |
| 36 |
| 37 | inline PlatformInterface *PlatformInterface::SharedInstance() { |
| 38 | static const auto result = CreatePlatformInterface(); |
| 39 | return result.get(); |
| 40 | } |
| 41 |
| 42 | } // namespace tgcalls |
| 43 |
| 44 | #endif |
| 45 |