#ifndef CFFMPEG_DECODE_H #define CFFMPEG_DECODE_H #include #include #include #include #include #include extern "C" { #include "libavcodec/avcodec.h" #include #include #include #include #include #include #include #include #include #include } // class Cffmpeg_decode: public QThread class Cffmpeg_decode : public QObject { Q_OBJECT public: // explicit Cffmpeg_decode(); Cffmpeg_decode(QObject *parent = nullptr); ~Cffmpeg_decode(); public: void setUrl(QString url); bool open_input_file(); bool IsstopPlay = false; void stop(); public slots: void run(); signals: void sendQImage(QImage); void sendConnectFail(int); private: AVFormatContext *inputFormatCtx = NULL; // AVFormatContext *outputFormatCtx = NULL; // AVCodecContext *decoderCtx = NULL; // AVCodecContext *encoderCtx = NULL;// const AVCodec *decoder = NULL; // 解码器 const AVCodec *encoder = NULL; // AVPacket *inputPacket = NULL; // AVPacket *outputPacket = NULL; // AVFrame *yuvFrame = NULL; AVFrame *rgbFrame = NULL; struct SwsContext *swsCtx = NULL; AVCodecParameters *videoCodecPara = nullptr; AVCodecParameters *videoCodecPara2 = nullptr; AVStream *outStream; unsigned char *out_buffer = nullptr; int videoStreamIndex = -1; int videoStreamIndexOut = -1; int numBytes = -1; QString _url; }; #endif // CFFMPEG_DECODE_H