| 6 |
| #define LIBTGVOIP_VIDEOSOURCE_H |
| 7 |
| 8 | #include <vector> |
| 9 | #include <functional> |
| 10 | #include <memory> |
| 11 | #include <string> |
| 12 | #include "../Buffers.h" |
| 13 |
| 14 | namespace tgvoip{ |
| 15 | namespace video { |
| 16 | class VideoSource{ |
| 17 | public: |
| 18 | virtual ~VideoSource(){}; |
| 19 | static std::shared_ptr<VideoSource> Create(); |
| 20 | static std::vector<uint32_t> GetAvailableEncoders(); |
| 21 | void SetCallback(std::function<void(const Buffer& buffer, uint32_t flags, uint32_t rotation)> callback); |
| 22 | virtual void Start()=0; |
| 23 | virtual void Stop()=0; |
| 24 | virtual void Reset(uint32_t codec, int maxResolution)=0; |
| 25 | virtual void RequestKeyFrame()=0; |
| 26 | virtual void SetBitrate(uint32_t bitrate)=0; |
| 27 | bool Failed(); |
| 28 | std::string GetErrorDescription(); |
| 29 | std::vector<Buffer>& GetCodecSpecificData(){ |
| 30 | return csd; |
| 31 | } |
| 32 | unsigned int GetFrameWidth(){ |
| 33 | return width; |
| 34 | } |
| 35 | unsigned int GetFrameHeight(){ |
| 36 | return height; |
| 37 | } |
| 38 | void SetRotation(unsigned int rotation){ |
| 39 | this->rotation=rotation; |
| 40 | } |
| 41 |
| 42 | protected: |
| 43 | std::function<void(const Buffer &, uint32_t, uint32_t)> callback; |
| 44 | bool failed; |
| 45 | std::string error; |
| 46 | unsigned int width=0; |
| 47 | unsigned int height=0; |
| 48 | unsigned int rotation=0; |
| 49 | std::vector<Buffer> csd; |
| 50 | }; |
| 51 | } |
| 52 | } |
| 53 |
| 54 | #endif //LIBTGVOIP_VIDEOSOURCE_H |
| 55 |