2020-08-15 21:06:36 +00:00
|
|
|
#include "DesktopInterface.h"
|
2020-08-14 16:58:22 +00:00
|
|
|
|
|
|
|
#include "platform/tdesktop/VideoCapturerInterfaceImpl.h"
|
|
|
|
#include "platform/tdesktop/VideoCapturerTrackSource.h"
|
|
|
|
|
|
|
|
#include "api/video_codecs/builtin_video_encoder_factory.h"
|
|
|
|
#include "api/video_codecs/builtin_video_decoder_factory.h"
|
|
|
|
#include "api/video_track_source_proxy.h"
|
|
|
|
|
|
|
|
namespace tgcalls {
|
|
|
|
|
2020-08-15 21:06:36 +00:00
|
|
|
std::unique_ptr<webrtc::VideoEncoderFactory> DesktopInterface::makeVideoEncoderFactory() {
|
2020-08-14 16:58:22 +00:00
|
|
|
return webrtc::CreateBuiltinVideoEncoderFactory();
|
|
|
|
}
|
|
|
|
|
2020-08-15 21:06:36 +00:00
|
|
|
std::unique_ptr<webrtc::VideoDecoderFactory> DesktopInterface::makeVideoDecoderFactory() {
|
2020-08-14 16:58:22 +00:00
|
|
|
return webrtc::CreateBuiltinVideoDecoderFactory();
|
|
|
|
}
|
|
|
|
|
2020-08-15 21:06:36 +00:00
|
|
|
rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> DesktopInterface::makeVideoSource(rtc::Thread *signalingThread, rtc::Thread *workerThread) {
|
2020-08-14 16:58:22 +00:00
|
|
|
const auto videoTrackSource = VideoCapturerTrackSource::Create();
|
2020-08-15 21:06:36 +00:00
|
|
|
return videoTrackSource
|
|
|
|
? webrtc::VideoTrackSourceProxy::Create(signalingThread, workerThread, videoTrackSource)
|
|
|
|
: nullptr;
|
2020-08-14 16:58:22 +00:00
|
|
|
}
|
|
|
|
|
2020-08-15 21:06:36 +00:00
|
|
|
bool DesktopInterface::supportsEncoding(const std::string &codecName) {
|
2020-08-14 16:58:22 +00:00
|
|
|
return (codecName == cricket::kH264CodecName)
|
|
|
|
|| (codecName == cricket::kVp8CodecName);
|
|
|
|
}
|
|
|
|
|
2020-08-15 21:06:36 +00:00
|
|
|
std::unique_ptr<VideoCapturerInterface> DesktopInterface::makeVideoCapturer(rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> source, bool useFrontCamera, std::function<void(VideoState)> stateUpdated, std::shared_ptr<PlatformContext> platformContext) {
|
2020-08-14 16:58:22 +00:00
|
|
|
return std::make_unique<VideoCapturerInterfaceImpl>(source, useFrontCamera, stateUpdated);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<PlatformInterface> CreatePlatformInterface() {
|
2020-08-15 21:06:36 +00:00
|
|
|
return std::make_unique<DesktopInterface>();
|
2020-08-14 16:58:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace tgcalls
|