| 5 |
| 6 | #include "api/video_codecs/builtin_video_encoder_factory.h" |
| 7 | #include "api/video_codecs/builtin_video_decoder_factory.h" |
| 8 | #include "api/video_track_source_proxy.h" |
| 9 |
| 10 | namespace tgcalls { |
| 11 |
| 12 | std::unique_ptr<webrtc::VideoEncoderFactory> DesktopInterface::makeVideoEncoderFactory() { |
| 13 | return webrtc::CreateBuiltinVideoEncoderFactory(); |
| 14 | } |
| 15 |
| 16 | std::unique_ptr<webrtc::VideoDecoderFactory> DesktopInterface::makeVideoDecoderFactory() { |
| 17 | return webrtc::CreateBuiltinVideoDecoderFactory(); |
| 18 | } |
| 19 |
| 20 | rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> DesktopInterface::makeVideoSource(rtc::Thread *signalingThread, rtc::Thread *workerThread) { |
| 21 | const auto videoTrackSource = VideoCapturerTrackSource::Create(); |
| 22 | return videoTrackSource |
| 23 | ? webrtc::VideoTrackSourceProxy::Create(signalingThread, workerThread, videoTrackSource) |
| 24 | : nullptr; |
| 25 | } |
| 26 |
| 27 | bool DesktopInterface::supportsEncoding(const std::string &codecName) { |
| 28 | return (codecName == cricket::kH264CodecName) |
| 29 | || (codecName == cricket::kVp8CodecName); |
| 30 | } |
| 31 |
| 32 | std::unique_ptr<VideoCapturerInterface> DesktopInterface::makeVideoCapturer(rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> source, bool useFrontCamera, std::function<void(VideoState)> stateUpdated, std::shared_ptr<PlatformContext> platformContext) { |
| 33 | return std::make_unique<VideoCapturerInterfaceImpl>(source, useFrontCamera, stateUpdated); |
| 34 | } |
| 35 |
| 36 | std::unique_ptr<PlatformInterface> CreatePlatformInterface() { |
| 37 | return std::make_unique<DesktopInterface>(); |
| 38 | } |
| 39 |
| 40 | } // namespace tgcalls |
| 41 |