#ifndef __FF_DECODER_H__ #define __FF_DECODER_H__ #include "../interface/interface_headers.h" extern "C" { #include "libavutil/avstring.h" #include "libavformat/avformat.h" #include "libswscale/swscale.h" } struct FrameData { AVFrame* frame {nullptr}; unsigned long pts {0}; bool bKeyframe {false}; FrameData() { frame = av_frame_alloc(); } ~FrameData() { if (frame) { av_frame_free(&frame); frame = nullptr; } } }; class FFDecoder { public: FFDecoder(/* args */); ~FFDecoder(); FrameData* Decode(int videoType, char* data, int len, int isKey, uint64_t pts); private: FrameData* ff_decode(int videoType, AVPacket* pkt); private: string m_dec_name; AVDictionary *gpu_options {nullptr}; AVCodecContext* m_pAVCodecCtx {nullptr}; const AVCodec* m_pAVCodec {nullptr}; int m_devid {-1}; int frameW {-1}; int frameH {-1}; float m_fps {0.0}; }; #endif // __FF_DECODER_H__