#ifndef VIDEODEC_H
#define VIDEODEC_H
extern "C"{
    #include "libavcodec/avcodec.h"
    #include "libavformat/avformat.h"
    #include "libavutil/avutil.h"
    #include "libavutil/mem.h"
    #include "libavutil/fifo.h"
    #include "libswscale/swscale.h"
    #include <libavutil/imgutils.h>
    #include "libavutil/pixfmt.h"
}


#include <QObject>
#include <QImage>
#include <QThread>
#include <QDebug>
#include <QList>


class VideoDec : public QObject
{
    Q_OBJECT
public:
    explicit VideoDec(QObject *parent = 0);
    struct ImgPacket{
        QImage PImage;
        struct ImgPacket *next;
    };
    int videoindex;
    int BUFFSIZE;
    AVFormatContext *pFormatCtx;
    AVCodecContext *pCodecCtx;
    AVCodec *pCodec;
    AVPacket packet;
    AVFrame *pFrame,*pFrameRGB;
    char *FileName = "f:/taxiAd.mp4";
    QList<QImage> VideoImg;
    int iSopflag=0;

signals:
    void SendImage(QImage img);

public slots:
    void init();
    void play();
    void stop();

};

#endif // VIDEODEC_H
