#ifndef _GB28181_DECODER_H_ #define _GB28181_DECODER_H_ #include "RTPReceiver.h" #include "../AbstractDecoder.h" #include struct AVFormatContext; struct AVCodecContext; struct AVCodec; struct AVFrame; struct AVPacket; struct SwsContext; class FFGB28181Decoder: public AbstractDecoder { public: FFGB28181Decoder(); ~FFGB28181Decoder(); 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_GB28181; } public: void stream_callback(int videoType, char* data, int len, int isKey, uint64_t pts, uint64_t localPts); void stream_end_callback(); private: AVCodecContext* m_pAVCodecCtx {}; const AVCodec* m_pAVCodec {}; AVFrame* m_pAVFrame {}; int m_gpuid {-1}; RTPReceiver m_rtp; int m_port; uint64_t m_frameCount {}; AVFrame* pFrameRGB {}; uint64_t m_startPts {}; uint64_t m_lastPts {}; //上一次pts的值 uint64_t m_curPts {}; //当前的pts值 uint64_t m_diffPts {}; uint32_t frameW {}, frameH {}; float m_fps {}; int m_frameSkip {}; int log_count {}; std::atomic_int m_status {}; }; #endif // _GB28181_DECODER_H_