mpv-player / mpv-examples

📚
224 stars 77 forks source link

FPS problem in qt-opengl example #13

Closed THMonster closed 6 years ago

THMonster commented 6 years ago

In the example codes, the QOpenGLWidget updates at the same frequency as video's FPS.
When I use a QTImer to update it at fixed 60 FPS, the QOpenGLWidget also updates at the same frequency as the video's FPS. But after I paused the video, it works at 60 FPS. I'm really puzzled by this phenomenon. How can I update the QOpenGLWidget at a fixed 60FPS?

THMonster commented 6 years ago

I have solved this issue, just use:

        mpv::qt::set_option_variant(mpv, "display-fps", "60");
        mpv::qt::set_option_variant(mpv, "video-sync", "display-resample");
ghost commented 6 years ago

It's not really clear what you want. The normal way to update the screen is by responding to the opengl-cb update callback. Without display-sync it will update whenever a new video frame needs to be shown, with display-sync it will request a redraw immediately (unless the video is paused).

THMonster commented 6 years ago

@wm4 Because I want to draw some animation over every frames. If it doesn't update at 60 fps, animation won't be enough smooth.