blob: e7116fa4c67ec7c3efcb1d7d57b6d9dbd557c48f (
plain)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
#ifndef DECODERTHREAD_H
#define DECODERTHREAD_H
#ifdef __cplusplus
#define __STDC_CONSTANT_MACROS
#ifdef _STDINT_H
#undef _STDINT_H
#endif
#include <stdint.h>
#endif
#include <QThread>
#include <QDebug>
#include <QString>
#include <QRect>
#include <QMutex>
#include <QTimer>
#include <QQueue>
#include <xrdpapi.h>
#include <xrdpvr.h>
#include <mediapacket.h>
#include <playvideo.h>
#include <playaudio.h>
/* ffmpeg related stuff */
extern "C"
{
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
}
class DecoderThread : public QObject
{
Q_OBJECT
public:
/* public methods */
DecoderThread();
void setFilename(QString filename);
void stopPlayer();
void pausePlayer();
void resumePlayer();
void oneTimeDeinit();
void close();
void run();
void startMediaPlay();
public slots:
void on_mediaSeek(int value);
private:
/* private variables */
QQueue<MediaPacket *> audioQueue;
QQueue<MediaPacket *> videoQueue;
QTimer *videoTimer;
QTimer *audioTimer;
QTimer *pktTimer;
QString filename;
void *channel;
int stream_id;
QRect geometry;
int64_t elapsedTime; /* elapsed time in usecs since play started */
QMutex mutex;
int64_t la_seekPos; /* locked access; must hold mutex */
PlayVideo *playVideo;
QThread *playVideoThread;
PlayAudio *playAudio;
QThread *playAudioThread;
/* private functions */
int sendMetadataFile();
int sendAudioFormat();
int sendVideoFormat();
int sendGeometry();
void updateSlider();
private slots:
/* private slots */
void audioTimerCallback();
void videoTimerCallback();
void pktTimerCallback();
signals:
/* private signals */
void on_progressUpdate(int percent);
void on_decoderErrorMsg(QString title, QString msg);
void on_mediaDurationInSeconds(int duration);
void on_elapsedtime(int val); /* in hundredth of a sec */
};
#endif // DECODERTHREAD_H
|