#include #include #include "dvpp_headers.h" #include "depend_headers.h" #include "user_mem.h" #include "CircularQueue.hpp" #include "VpcPicConverter.h" #include "FFReceiver.h" #include using namespace std; #define TEST_DECODER struct DvppDecConfig{ string dec_name; POST_DECODE_CALLBACK post_decoded_cbk; // 解码数据回调接口 string dev_id; // gpu id bool force_tcp{true}; // 是否指定使用tcp连接 int skip_frame{1}; // 跳帧数 int codec_id; // 0 : h264 1:h265 int profile; CircularQueue *pktQueueptr; int width; int height; }; class DvppDec { public: DvppDec(); ~DvppDec(); bool init_vdpp(DvppDecConfig cfg); void setPostDecArg(const void* postDecArg); bool start(); void close(); void pause(); void resume(); public: void doProcessReport(); void doVdppVdecCallBack(acldvppStreamDesc *input, acldvppPicDesc *output); private: void decode_thread(); void releaseResource(); bool sendVdecEos(aclvdecChannelDesc *vdecChannelDesc); int sentFrame(aclvdecChannelDesc *vdecChannelDesc, uint64_t frame_count); private: bool m_bRunning{false}; bool m_bPause{false}; bool m_bExitReportThd{false}; int m_dvpp_deviceId {-1}; int m_dvpp_channel {-1}; aclrtContext m_context; acldvppStreamFormat enType; pthread_t m_decode_thread; DvppDecConfig m_cfg; string m_dec_name; vector m_vec_vdec; CircularQueue m_vdecQueue; CircularQueue *m_pktQueueptr; const void * m_postDecArg; POST_DECODE_CALLBACK post_decoded_cbk; VpcPicConverter picConverter; int m_vdec_out_size {-1}; #ifdef TEST_DECODER void *vdecHostAddr = nullptr; int count_frame = 0; #endif };