forked from huimingli/QTFFmpegSDLPlayer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Video.h
53 lines (49 loc) · 1.3 KB
/
Video.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
#pragma once
#include "PacketQueue.h"
#include "FrameQueue.h"
#include <QThread>
extern "C" {
#include <libavformat/avformat.h>
#include<libswscale/swscale.h>
#include <libswresample/swresample.h>
}
class Video:public QThread
{
public:
Video();
~Video();
void run();
double synchronizeVideo(AVFrame *&srcFrame, double &pts);
int getStreamIndex();
AVCodecContext * getAVCodecCotext();
void enqueuePacket(const AVPacket &pkt);
AVFrame * dequeueFrame();
void setStreamIndex(const int &streamIndex);
int getVideoQueueSize();
void setVideoStream(AVStream *& stream);
AVStream * getVideoStream();
void setAVCodecCotext(AVCodecContext *avCodecContext);
void setFrameTimer(const double &frameTimer);
double getFrameTimer();
void setFrameLastPts(const double &frameLastPts);
double getFrameLastPts();
void setFrameLastDelay(const double &frameLastDelay);
double getFrameLastDelay();
void setVideoClock(const double &videoClock);
double getVideoClock();
int getVideoFrameSiez();
SwsContext *swsContext = NULL;
void clearFrames();
void clearPackets();
private:
double frameTimer; // Sync fields
double frameLastPts;
double frameLastDelay;
double videoClock;
PacketQueue *videoPackets;
FrameQueue frameQueue;
AVStream *stream;
int streamIndex = -1;
QMutex mutex;
AVCodecContext *videoContext;
};