| 1 | // |
| 2 | // libtgvoip is free and unencumbered public domain software. |
| 3 | // For more information, see http://unlicense.org or the UNLICENSE file |
| 4 | // you should have received with this source code distribution. |
| 5 | // |
| 6 | |
| 7 | #ifndef TGVOIP_SAMPLEBUFFERDISPLAYLAYERRENDERER |
| 8 | #define TGVOIP_SAMPLEBUFFERDISPLAYLAYERRENDERER |
| 9 | |
| 10 | #include "../../video/VideoRenderer.h" |
| 11 | #include <vector> |
| 12 | #include <objc/objc.h> |
| 13 | #include <VideoToolbox/VideoToolbox.h> |
| 14 | |
| 15 | #ifdef __OBJC__ |
| 16 | @class TGVVideoRenderer; |
| 17 | #else |
| 18 | typedef struct objc_object TGVVideoRenderer; |
| 19 | #endif |
| 20 | |
| 21 | namespace tgvoip{ |
| 22 | namespace video{ |
| 23 | class SampleBufferDisplayLayerRenderer : public VideoRenderer{ |
| 24 | public: |
| 25 | SampleBufferDisplayLayerRenderer(TGVVideoRenderer* renderer); |
| 26 | virtual ~SampleBufferDisplayLayerRenderer(); |
| 27 | virtual void Reset(uint32_t codec, unsigned int width, unsigned int height, std::vector<Buffer>& csd) override; |
| 28 | virtual void DecodeAndDisplay(Buffer frame, uint32_t pts) override; |
| 29 | virtual void SetStreamEnabled(bool enabled) override; |
| 30 | static int GetMaximumResolution(); |
| 31 | static std::vector<uint32_t> GetAvailableDecoders(); |
| 32 | private: |
| 33 | TGVVideoRenderer* renderer; |
| 34 | CMFormatDescriptionRef formatDesc=NULL; |
| 35 | bool needReset=false; |
| 36 | }; |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | #endif /* TGVOIP_SAMPLEBUFFERDISPLAYLAYERRENDERER */ |
| 41 | |