#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 *fmtCtx = NULL; const AVCodec *videoCodec = NULL; AVCodecContext *videoCodecCtx = NULL; AVPacket *pkt = NULL; AVFrame *yuvFrame = NULL; AVFrame *rgbFrame = NULL; struct SwsContext *img_ctx = NULL; unsigned char *out_buffer = nullptr; int videoStreamIndex = -1; int numBytes = -1; QString _url; }; #endif // CFFMPEG_DECODE_H