diff options
Diffstat (limited to 'DOCS/client_api_examples')
-rw-r--r-- | DOCS/client_api_examples/qml_direct/main.cpp | 7 | ||||
-rw-r--r-- | DOCS/client_api_examples/qml_direct/main.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/DOCS/client_api_examples/qml_direct/main.cpp b/DOCS/client_api_examples/qml_direct/main.cpp index 5f1f1468cf..93a843dfd0 100644 --- a/DOCS/client_api_examples/qml_direct/main.cpp +++ b/DOCS/client_api_examples/qml_direct/main.cpp @@ -96,6 +96,8 @@ void MpvObject::handleWindowChanged(QQuickWindow *win) this, &MpvObject::sync, Qt::DirectConnection); connect(win, &QQuickWindow::sceneGraphInvalidated, this, &MpvObject::cleanup, Qt::DirectConnection); + connect(win, &QQuickWindow::frameSwapped, + this, &MpvObject::swapped, Qt::DirectConnection); win->setClearBeforeRendering(false); } @@ -110,6 +112,11 @@ void MpvObject::sync() renderer->size = window()->size() * window()->devicePixelRatio(); } +void MpvObject::swapped() +{ + mpv_opengl_cb_report_flip(mpv_gl, 0); +} + void MpvObject::cleanup() { if (renderer) { diff --git a/DOCS/client_api_examples/qml_direct/main.h b/DOCS/client_api_examples/qml_direct/main.h index 66fe8c94a5..b0310ff0be 100644 --- a/DOCS/client_api_examples/qml_direct/main.h +++ b/DOCS/client_api_examples/qml_direct/main.h @@ -37,6 +37,7 @@ public: public slots: void command(const QVariant& params); void sync(); + void swapped(); void cleanup(); signals: void onUpdate(); |