-
Notifications
You must be signed in to change notification settings - Fork 1
/
rtspvideostreamdecoder.h
61 lines (38 loc) · 1.44 KB
/
rtspvideostreamdecoder.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
#ifndef RTSPVIDEOSTREAMDECODER_H
#define RTSPVIDEOSTREAMDECODER_H
#include <QString>
#include <QThread>
struct AVFormatContext;
struct AVCodecContext;
struct AVStream;
struct AVFrame;
struct AVPacket;
class RtspVideoStreamDecoder: public QThread
{
Q_OBJECT
void run() override;
const QString rtspUrl;
public:
RtspVideoStreamDecoder(const QString & rtspUrl);
static AVFrame * convertFrame (AVFrame * fromFrame, AVPixelFormat toFormat, int linesizeAlignment, QString & err);
static AVFrame * convertFrame (AVFrame * frame, QString & err);
static void freeFrame(AVFrame ** frame);
static QImage toQImage(const AVFrame * const fr, QString & err);
public slots:
void start();
void stop();
signals:
void newFrame(AVFrame *);
void infoChanged(QString info);
private:
volatile bool interrupt = false;
static int interruptCallback (void * p);
AVCodecContext * openStream (AVStream * stream, QString & err);
AVStream * getVideoStream(AVFormatContext * fc, QString & err);
AVFormatContext * openRtsp (const QString & rtsp_url, QString & err);
bool startReceiveFrames (AVFormatContext * fc, AVStream * videoStream, AVCodecContext * avCtx, QString & err);
bool frameFromDecoder(AVCodecContext * avCtx, AVFrame * frame);
bool sendPacketToDecoder(AVCodecContext * avCtx, AVPacket * pck, QString & err);
bool openAndStartRtsp(QString & err);
};
#endif // RTSPVIDEOSTREAMDECODER_H