summaryrefslogtreecommitdiffstats
path: root/DOCS/client_api_examples/qml_direct/main.cpp
diff options
context:
space:
mode:
authorDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-04-13 19:55:48 +0900
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-04-13 19:55:48 +0900
commit3287825bd2ee762a918961383604697358765397 (patch)
treed3513ec0b91a5c3832221c5b74225deb85fb2163 /DOCS/client_api_examples/qml_direct/main.cpp
parent9e65b5db0bf79b31c7816d1fdba77ea18fe82690 (diff)
parentf43017bfe97c07aa73206d8d1388294cdbee628f (diff)
downloadmpv-3287825bd2ee762a918961383604697358765397.tar.bz2
mpv-3287825bd2ee762a918961383604697358765397.tar.xz
Merge branch 'master' into release/0.9
* master: (39 commits) Update license headers af_lavrresample: minor simplification af_lavrresample: allow resetting output sample format audio/filter: fully renegotiate audio formats on every reconfig DOCS/waf: Edit --enable-feature sentences vo_opengl: slightly simplify check_gl_features() vo_opengl: unify blend-subtitles-res and blend-subtitles vo_opengl: fix blend-subtitles-res=video & anamorphic video manpage: mention how pseudo-gui mode is enabled on win32 main-fn-win: fix handle validity check for XP win32: use pseudo-gui profile when started without stdio win32: only attach to the console from mpv.com win32: use a platform-specific unicode entry-point vo_opengl: add blend-subtitles-res manpage: document pseudo-gui stuff mp_image: remove redundant flags field mp_image: remove redundant chroma_x/y_shift fields mp_image: remove redundant plane_w/h fields player: use config parser for setting up pseudo-gui profile player: change pseudo-gui settings ...
Diffstat (limited to 'DOCS/client_api_examples/qml_direct/main.cpp')
-rw-r--r--DOCS/client_api_examples/qml_direct/main.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/DOCS/client_api_examples/qml_direct/main.cpp b/DOCS/client_api_examples/qml_direct/main.cpp
index 5f1f1468cf..37c6119707 100644
--- a/DOCS/client_api_examples/qml_direct/main.cpp
+++ b/DOCS/client_api_examples/qml_direct/main.cpp
@@ -39,15 +39,13 @@ void MpvRenderer::paint()
{
window->resetOpenGLState();
- // Render to the whole window.
- int vp[4] = {0, 0, size.width(), -size.height()};
-
// This uses 0 as framebuffer, which indicates that mpv will render directly
// to the frontbuffer. Note that mpv will always switch framebuffers
// explicitly. Some QWindow setups (such as using QQuickWidget) actually
// want you to render into a FBO in the beforeRendering() signal, and this
// code won't work there.
- mpv_opengl_cb_render(mpv_gl, 0, vp);
+ // The negation is used for rendering with OpenGL's flipped coordinates.
+ mpv_opengl_cb_draw(mpv_gl, 0, size.width(), -size.height());
window->resetOpenGLState();
}
@@ -96,6 +94,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 +110,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) {