#include #include #include "dvpp_headers.h" #include "depend_headers.h" #include "user_mem.h" #include "CircularQueue.hpp" #include "VpcPicConverter.h" #include using namespace std; #define TEST_DECODER class DvppDecoder{ public: DvppDecoder(); ~DvppDecoder(); bool init(FFDecConfig& cfg); void close(); bool start(); void pause(); void resume(); void setDecKeyframe(bool bKeyframe); bool isRunning(); bool isFinished(); bool isPausing(); bool getResolution( int &width, int &height ); bool isSurport(FFDecConfig& cfg); int getCachedQueueLength(); float fps(); DECODER_TYPE getDecoderType(){ return DECODER_TYPE_DVPP; } void setName(string nm){ m_dec_name = nm; } string getName(){ return m_dec_name; } FFImgInfo* snapshot(); void setPostDecArg(const void* postDecArg); void setFinishedDecArg(const void* finishedDecArg); public: void doProcessReport(); void doVdppVdecCallBack(acldvppStreamDesc *input, acldvppPicDesc *output, DvppDecoder *self); private: void decode_thread(); void post_decode_thread(); void releaseFFmpeg(); void releaseResource(); bool init_FFmpeg(const char* uri, bool force_tcp); bool init_vdpp(int _deviceId); bool sendVdecEos(aclvdecChannelDesc *vdecChannelDesc); private: AVStream* stream; int stream_index; AVFormatContext *fmt_ctx; AVPixelFormat pix_fmt; uint32_t m_vdec_out_size{0}; int frame_width{0}; int frame_height{0}; int m_dvpp_deviceId {-1}; int m_dvpp_channel {-1}; pthread_t m_decode_thread; pthread_t m_post_decode_thread; bool m_bRunning; bool m_bFinished; bool m_bPause; bool m_bReal; // 是否实时流 float m_fps; FFDecConfig m_cfg; string m_dec_name; bool m_dec_keyframe; AVBSFContext * h264bsfc{nullptr}; aclrtContext m_context; acldvppStreamFormat enType; vector m_vec_vdec; CircularQueue m_vdecQueue; const void * m_postDecArg; POST_DECODE_CALLBACK post_decoded_cbk; const void * m_finishedDecArg; DECODE_FINISHED_CALLBACK decode_finished_cbk; VpcPicConverter picConverter; };