vo_opengl_cb: add a function to report vsync time

And also let vo.c know of it.

Currently, this does not help much, but will facilitate future
improvements.
This commit is contained in:
wm4
2015-04-09 19:30:26 +02:00
parent 4e8ee522f4
commit 8dc7156bc0
8 changed files with 48 additions and 1 deletions

View File

@@ -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) {

View File

@@ -37,6 +37,7 @@ public:
public slots:
void command(const QVariant& params);
void sync();
void swapped();
void cleanup();
signals:
void onUpdate();