You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PayloadAPP/cffmpeg_decode.h

70 lines
1.3 KiB
C++

#ifndef CFFMPEG_DECODE_H
#define CFFMPEG_DECODE_H
#include <QImage>
#include <QWidget>
#include <QPaintEvent>
#include <QThread>
#include <QPainter>
#include <QDebug>
extern "C"{
#include "libavcodec/avcodec.h"
#include <libavutil/channel_layout.h>
#include <libavutil/common.h>
#include <libavutil/frame.h>
#include <libavutil/samplefmt.h>
#include <libavutil/opt.h>
#include <libavutil/imgutils.h>
#include <libavutil/parseutils.h>
#include <libavutil/mem.h>
#include <libswscale/swscale.h>
#include <libavformat/avformat.h>
}
//class Cffmpeg_decode: public QThread
class Cffmpeg_decode: public QObject
{
public:
explicit Cffmpeg_decode();
~Cffmpeg_decode();
Q_OBJECT
public:
void setUrl(QString url);
bool open_input_file();
bool IsstopPlay= false;
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