// // Created by Grishka on 10.08.2018. // #ifndef LIBTGVOIP_VIDEOSOURCE_H #define LIBTGVOIP_VIDEOSOURCE_H #include "../Buffers.h" #include #include #include #include #include namespace tgvoip { namespace video { class VideoSource { public: using CallbackType = std::function; virtual ~VideoSource() = default; static std::shared_ptr Create(); static std::vector GetAvailableEncoders(); void SetCallback(CallbackType callback); void SetStreamStateCallback(std::function callback); virtual void Start() = 0; virtual void Stop() = 0; virtual void Reset(std::uint32_t codec, int maxResolution) = 0; virtual void RequestKeyFrame() = 0; virtual void SetBitrate(std::uint32_t bitrate) = 0; [[nodiscard]] bool Failed() const; [[nodiscard]] std::string GetErrorDescription() const; std::vector& GetCodecSpecificData(); [[nodiscard]] unsigned int GetFrameWidth() const; [[nodiscard]] unsigned int GetFrameHeight() const; void SetRotation(unsigned int rotation); protected: std::vector m_csd; std::string m_error; CallbackType m_callback; std::function m_streamStateCallback; unsigned int m_width = 0; unsigned int m_height = 0; unsigned int m_rotation = 0; bool m_failed = false; }; } // namespace video } // namespace tgvoip #endif // LIBTGVOIP_VIDEOSOURCE_H