vo_opengl_cb: simplify API uninitialization

Until now, calling mpv_opengl_cb_uninit_gl() at a "bad moment" could
make the whole thing to explode. The API user was asked to avoid such
situations by calling it only in "good moments". But this was probably a
bit too subtle and could easily be overlooked.

Integrate the approach the qml example uses directly into the
implementation. If the OpenGL context is to be unitialized, forcefully
disable video, and block until this is done.
This commit is contained in:
wm4
2014-12-31 20:31:19 +01:00
parent 65f2c6c716
commit a850bf786e
5 changed files with 59 additions and 21 deletions

View File

@@ -32,15 +32,9 @@ public:
virtual ~MpvRenderer()
{
// Before we can really destroy the OpenGL state, we must make sure
// that the video output is destroyed. This is important for some
// forms of hardware decoding, where the decoder shares some state
// with the video output and the OpenGL context.
// Deselecting the video track is the easiest way to achieve this in
// a synchronous way. If no file is playing, setting the property
// will fail and do nothing.
mpv::qt::set_property_variant(mpv, "vid", "no");
// Until this call is done, we need to make sure the player remains
// alive. This is done implicitly with the mpv::qt::Handle instance
// in this class.
mpv_opengl_cb_uninit_gl(mpv_gl);
}