Telegram-Android/TMessagesProj/jni/voip/tgcalls/VideoCaptureInterface.h

67 lines
1.8 KiB
C
Raw Normal View History

2020-08-14 18:58:22 +02:00
#ifndef TGCALLS_VIDEO_CAPTURE_INTERFACE_H
#define TGCALLS_VIDEO_CAPTURE_INTERFACE_H
2020-10-01 03:59:32 +02:00
#include <string>
2020-08-14 18:58:22 +02:00
#include <memory>
2021-06-25 02:43:10 +02:00
#include <functional>
2020-08-14 18:58:22 +02:00
namespace rtc {
template <typename VideoFrameT>
class VideoSinkInterface;
} // namespace rtc
namespace webrtc {
class VideoFrame;
} // namespace webrtc
namespace tgcalls {
class PlatformContext;
2021-03-19 11:25:58 +01:00
class Threads;
2020-08-14 18:58:22 +02:00
enum class VideoState {
Inactive,
Paused,
Active,
};
2021-06-25 02:43:10 +02:00
2020-08-14 18:58:22 +02:00
class VideoCaptureInterface {
protected:
VideoCaptureInterface() = default;
public:
2020-10-01 03:59:32 +02:00
static std::unique_ptr<VideoCaptureInterface> Create(
2021-03-19 11:25:58 +01:00
std::shared_ptr<Threads> threads,
std::string deviceId = std::string(),
2021-07-30 16:49:55 +02:00
bool isScreenCapture = false,
2020-10-01 03:59:32 +02:00
std::shared_ptr<PlatformContext> platformContext = nullptr);
2020-08-14 18:58:22 +02:00
virtual ~VideoCaptureInterface();
2021-08-31 21:06:39 +02:00
virtual void switchToDevice(std::string deviceId, bool isScreenCapture) = 0;
2020-08-14 18:58:22 +02:00
virtual void setState(VideoState state) = 0;
virtual void setPreferredAspectRatio(float aspectRatio) = 0;
virtual void setOutput(std::shared_ptr<rtc::VideoSinkInterface<webrtc::VideoFrame>> sink) = 0;
2021-06-25 02:43:10 +02:00
virtual void setOnFatalError(std::function<void()> error) {
// TODO: make this function pure virtual when everybody implements it.
}
virtual void setOnPause(std::function<void(bool)> pause) {
// TODO: make this function pure virtual when everybody implements it.
}
virtual void setOnIsActiveUpdated(std::function<void(bool)> onIsActiveUpdated) {
// TODO: make this function pure virtual when everybody implements it.
}
virtual void withNativeImplementation(std::function<void(void *)> completion) {
completion(nullptr);
}
2020-08-22 01:59:49 +02:00
virtual std::shared_ptr<PlatformContext> getPlatformContext() {
return nullptr;
}
2020-08-14 18:58:22 +02:00
};
} // namespace tgcalls
#endif