]> git.sur5r.net Git - minitube/blob - lib/media/src/mpv/mpvwidget.h
New upstream version 3.4.1
[minitube] / lib / media / src / mpv / mpvwidget.h
1 #ifndef PLAYERWINDOW_H
2 #define PLAYERWINDOW_H
3
4 #include <QtWidgets>
5 #include <mpv/client.h>
6 #include <mpv/render_gl.h>
7
8 class MpvWidget Q_DECL_FINAL : public QOpenGLWidget {
9     Q_OBJECT
10
11 public:
12     MpvWidget(mpv_handle *mpv, QWidget *parent = nullptr, Qt::WindowFlags f = nullptr);
13     ~MpvWidget() Q_DECL_OVERRIDE;
14
15     QSize sizeHint() const Q_DECL_OVERRIDE { return QSize(480, 270); }
16
17 protected:
18     void initializeGL() Q_DECL_OVERRIDE;
19     void resizeGL(int w, int h) Q_DECL_OVERRIDE;
20     void paintGL() Q_DECL_OVERRIDE;
21
22 private slots:
23     void maybeUpdate();
24     void onFrameSwapped();
25
26 private:
27     static void onUpdate(void *ctx);
28
29     mpv_handle *mpv;
30     mpv_render_context *mpvContext;
31     int glWidth;
32     int glHeight;
33 };
34
35 #endif // PLAYERWINDOW_H