summaryrefslogtreecommitdiffstats
path: root/DOCS/client_api_examples/qt_opengl/mpvwidget.h
diff options
context:
space:
mode:
Diffstat (limited to 'DOCS/client_api_examples/qt_opengl/mpvwidget.h')
-rw-r--r--DOCS/client_api_examples/qt_opengl/mpvwidget.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/DOCS/client_api_examples/qt_opengl/mpvwidget.h b/DOCS/client_api_examples/qt_opengl/mpvwidget.h
new file mode 100644
index 0000000000..a219681393
--- /dev/null
+++ b/DOCS/client_api_examples/qt_opengl/mpvwidget.h
@@ -0,0 +1,38 @@
+#ifndef PLAYERWINDOW_H
+#define PLAYERWINDOW_H
+
+#include <QtWidgets/QOpenGLWidget>
+#include <mpv/client.h>
+#include <mpv/opengl_cb.h>
+#include <mpv/qthelper.hpp>
+
+class MpvWidget Q_DECL_FINAL: public QOpenGLWidget
+{
+ Q_OBJECT
+public:
+ MpvWidget(QWidget *parent = 0, Qt::WindowFlags f = 0);
+ ~MpvWidget();
+ void command(const QVariant& params);
+ void setProperty(const QString& name, const QVariant& value);
+ QVariant getProperty(const QString& name) const;
+ QSize sizeHint() const { return QSize(480, 270);}
+Q_SIGNALS:
+ void durationChanged(int value);
+ void positionChanged(int value);
+protected:
+ void initializeGL() Q_DECL_OVERRIDE;
+ void paintGL() Q_DECL_OVERRIDE;
+private Q_SLOTS:
+ void swapped();
+ void on_mpv_events();
+private:
+ void handle_mpv_event(mpv_event *event);
+ static void on_update(void *ctx);
+
+ mpv::qt::Handle mpv;
+ mpv_opengl_cb_context *mpv_gl;
+};
+
+
+
+#endif // PLAYERWINDOW_H