-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlayerWidget.h
81 lines (67 loc) · 1.71 KB
/
PlayerWidget.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
71
72
73
74
75
76
77
78
79
80
81
#ifndef PLAYERWIDGET_H
#define PLAYERWIDGET_H
#include <QVideoDecoder.h>
#include <ImagesBuffer.h>
#include <QLabel>
#include <QTimer>
#include <QPushButton>
/*!
* @brief Class used to display the video frame
*
* Class used to display the video frame.
* The frame is displayed within a Label for simplicity and beacuse the playback
* function is not a core requirement of the application.
* All standard functions of video playbacking are present (play, pause, stop)
* along with frame functions (seek, prev, next).
*/
class PlayerWidget : public QWidget
{
Q_OBJECT
private:
QTimer *playbackTimer;
ImagesBuffer *_bmng;
Frame _actualFrame;
// Help variables
bool playState; //!< playing or paused
int frameMs; //!< ms of a single frame
qint64 numFrames;
qint64 videoLength; //!< ms of the entire video
void displayFrame();
public:
explicit PlayerWidget(
QWidget *parent = 0,
QWidget *mainwin = 0,
ImagesBuffer *buff = 0
);
~PlayerWidget();
// Frame actions
void reloadFrame();
bool nextSingleFrame();
bool nextFrame();
bool prevFrame();
void seekToFrame(const qint64 num);
void seekToTime(const qint64 ms);
void seekToTimePercentage(const double perc);
// Video actions
void loadVideo(const QString fileName);
void playPause();
bool playVideo();
bool pauseVideo();
bool stopVideo(const bool reset);
// Getters
bool isVideoLoaded();
bool isVideoPlaying();
qint64 currentFrameNumber();
qint64 currentFrameTime();
qint64 getNumFrames();
double currentTimePercentage();
private slots:
void updateFrame();
signals:
void frameChanged();
void endOfStream();
void newFrame(QPixmap img);
void timeChanged(qint64 ms);
void playPauseToggle(bool playState);
};
#endif // PLAYERWIDGET_H