#pragma once #include #include "ConstBuffer.h" extern "C" { #include "libavcodec/avcodec.h" #include "libswscale/swscale.h" #include "libavformat/avformat.h" #include "libavutil/imgutils.h" #include "libavutil/opt.h" #include "libavutil/mathematics.h" #include "libavutil/samplefmt.h" #include "libavutil/pixfmt.h" } class FfmpegDecodeOld : public QThread { Q_OBJECT public: FfmpegDecodeOld(QObject* parent = Q_NULLPTR); ~FfmpegDecodeOld(); void init(); static IBuffer* getConstBuffer() { return m_pConstBuffer; } private: bool m_bNeedWork; static ConstBuffer* m_pConstBuffer; size_t m_sBufferSize; uint8_t* m_pBuffer; AVIOContext* m_pAVIOContext; AVInputFormat* m_pAVInputFormat; AVFormatContext* m_pAVFormatContext; int m_iId; AVPacket* m_pAVPacket; // 压缩数据包 const AVCodec* m_pAVCodec; // 解码器 AVCodecContext* m_pAVCodecContext; AVCodecParameters* m_pAVCodecParameters; AVFrame* m_pAVFrameSrc; AVFrame* m_pAVFrameDes; SwsContext* m_pSwsContext; private: void run() override; static int read_data(void* opaque, uint8_t* buf, int buf_size); };