Nagram/TMessagesProj/jni/voip/tgcalls/VideoCaptureInterface.h

67 lines
1.8 KiB
C
Raw Normal View History

2020-08-14 16:58:22 +00:00
#ifndef TGCALLS_VIDEO_CAPTURE_INTERFACE_H
#define TGCALLS_VIDEO_CAPTURE_INTERFACE_H
2020-10-01 01:59:32 +00:00
#include <string>
2020-08-14 16:58:22 +00:00
#include <memory>
2021-06-25 00:43:10 +00:00
#include <functional>
2020-08-14 16:58:22 +00:00
namespace rtc {
template <typename VideoFrameT>
class VideoSinkInterface;
} // namespace rtc
namespace webrtc {
class VideoFrame;
} // namespace webrtc
namespace tgcalls {
class PlatformContext;
2021-03-19 10:25:58 +00:00
class Threads;
2020-08-14 16:58:22 +00:00
enum class VideoState {
Inactive,
Paused,
Active,
};
2021-06-25 00:43:10 +00:00
2020-08-14 16:58:22 +00:00
class VideoCaptureInterface {
protected:
VideoCaptureInterface() = default;
public:
2020-10-01 01:59:32 +00:00
static std::unique_ptr<VideoCaptureInterface> Create(
2021-03-19 10:25:58 +00:00
std::shared_ptr<Threads> threads,
std::string deviceId = std::string(),
2021-07-30 14:49:55 +00:00
bool isScreenCapture = false,
2020-10-01 01:59:32 +00:00
std::shared_ptr<PlatformContext> platformContext = nullptr);
2020-08-14 16:58:22 +00:00
virtual ~VideoCaptureInterface();
2021-08-31 19:06:39 +00:00
virtual void switchToDevice(std::string deviceId, bool isScreenCapture) = 0;
2020-08-14 16:58:22 +00: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 00:43:10 +00: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-21 23:59:49 +00:00
virtual std::shared_ptr<PlatformContext> getPlatformContext() {
return nullptr;
}
2020-08-14 16:58:22 +00:00
};
} // namespace tgcalls
#endif