-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathQFFmpegVideoDecoder.h
70 lines (58 loc) · 1.54 KB
/
QFFmpegVideoDecoder.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef QFFMPEGVIDEODECODER_H
#define QFFMPEGVIDEODECODER_H
#include <QThread>
#include <QQueue>
#include <QMutex>
#include <QSemaphore>
#include "QFFmpegGLWidget.h"
#include "QFFmpegClock.h"
#include "QFFmpegVideoRender.h"
extern "C"{
#include "libavutil/avstring.h"
#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
#include "libavutil/dict.h"
#include "libavutil/parseutils.h"
#include "libavutil/samplefmt.h"
#include "libavutil/avassert.h"
#include "libavutil/time.h"
#include "libavformat/avformat.h"
#include "libavdevice/avdevice.h"
#include "libswscale/swscale.h"
#include "libavutil/opt.h"
#include "libavcodec/avfft.h"
#include "libswresample/swresample.h"
}
class QFFmpegVideoDecoder : public QThread
{
Q_OBJECT
public:
explicit QFFmpegVideoDecoder(QObject *parent = 0);
~QFFmpegVideoDecoder();
void setCodecCtx(AVCodecContext *mVideoCtx);
void addPacket(AVPacket pkt);
int getQueueLength();
void setFormatCtx(AVFormatContext *mFormatCtx);
void setStream(AVStream *mStream);
void setGLWidget(QFFmpegGLWidget *gl);
void setClock(QFFmpegClock *clock);
signals:
public slots:
private:
QQueue<AVPacket> queue;
QMutex *mutex;
QSemaphore *sema;
AVCodecContext *mVideoCtx;
AVFormatContext *mFormatCtx;
AVStream *mStream;
QFFmpegGLWidget *mGLWidget;
SwsContext *convert_ctx;
AVPicture picture;
bool picInit;
QFFmpegClock *mClock;
QFFmpegVideoRender *mVideoRender;
protected:
void run();
};
#endif // QFFMPEGVIDEODECODER_H