#ifndef __DVPP_STREAM_DECODER_H__ #define __DVPP_STREAM_DECODER_H__ #include "depend_headers.h" #include "dvpp_headers.h" #include "VpcUtils.h" #include "FFRecoderTaskManager.h" using namespace std; class DvppStreamDecoder { public: DvppStreamDecoder(/* args */); ~DvppStreamDecoder(); bool Init(FFDecConfig cfg); int SendData(int videoType, char* data, int len, int isKey, uint64_t pts); void Close(); DvppDataMemory* GetFrame(); void doRecode(RecoderInfo& recoderInfo); void set_mq_callback(mq_callback_t cb); public: void doProcessReport(); void doVdppVdecCallBack(acldvppStreamDesc *input, acldvppPicDesc *output, void *pUserData); private: bool sendVdecEos(aclvdecChannelDesc *vdecChannelDesc); int sendPkt(aclvdecChannelDesc *vdecChannelDesc, AVPacket* pkt, unsigned long long frame_nb, int vdec_out_size); int parse_stream_info(int videoType, AVPacket* pkt); void release_dvpp(); void release_channeldesc(); int getVdecType(int videoType); private: string m_dec_name {""}; int m_deviceId {-1}; int m_dvpp_channel {-1}; aclrtContext m_context{nullptr}; aclvdecChannelDesc *vdecChannelDesc {nullptr}; pthread_t report_thread; bool m_bExitReportThd{false}; int m_vdec_out_size {-1}; int m_fps {-1}; int frameW {-1}; int frameH {-1}; int out_frame_width{0}; int out_frame_height{0}; VpcUtils m_vpcUtils; unsigned long m_frame_nb {0}; std::atomic m_DvppCacheCounter{0}; queue m_decoded_data_queue; mutex m_decoded_data_queue_mtx; bool m_bExit {false}; const void * m_finishedDecArg {nullptr}; DECODE_FINISHED_CALLBACK decode_finished_cbk {nullptr}; AVBSFContext * h264bsfc{nullptr}; uint64_t m_in_count {0}; uint64_t m_out_count {0}; bool m_bResize {false}; FFRecoderTaskManager m_recoderManager; }; #endif // __DVPP_STREAM_DECODER_H__