-
Notifications
You must be signed in to change notification settings - Fork 0
/
videowidget.h
55 lines (42 loc) · 1.18 KB
/
videowidget.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
#ifndef VIDEOWIDGET_H
#define VIDEOWIDGET_H
#include <QOpenGLWidget>
#include <mpv/client.h>
#include <mpv/render_gl.h>
class QMouseEvent;
class VideoWidget : public QOpenGLWidget
{
Q_OBJECT
public:
explicit VideoWidget(QWidget *parent = nullptr);
~VideoWidget();
void setSilentMode(bool silent);
void setEarlyStopMode(bool earlyStop);
signals:
void durationChanged(double time);
void positionChanged(double time);
void eofReached();
public slots:
void play(QString url);
void stop();
void pauseResume();
protected:
void initializeGL() Q_DECL_OVERRIDE;
void paintGL() Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
private slots:
void handleMpvEvents();
void handleMpvEvent(mpv_event *event);
void maybeUpdate();
private:
void mpvCommand(const QStringList ¶ms);
void mpvSetProperty(const QString &name, const QString &value);
static void onMpvGLUpdate(void *ctx);
mpv_handle *mpv = nullptr;
mpv_render_context *mpvGL = nullptr;
QString pendingFileOpen;
bool earlyStopMode = false;
bool glInitialized = false;
bool mpvPaused = false;
};
#endif // VIDEOWIDGET_H