summaryrefslogtreecommitdiffstats
path: root/player/client.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-12-31 20:31:19 +0100
committerwm4 <wm4@nowhere>2014-12-31 20:31:19 +0100
commita850bf786e3bea2ce9969d6794835a0724f29b0d (patch)
tree9e58453886384f98824d3885bf8a5281d07ccfc7 /player/client.c
parent65f2c6c71676e4359d313ecf27744e525b662134 (diff)
downloadmpv-a850bf786e3bea2ce9969d6794835a0724f29b0d.tar.bz2
mpv-a850bf786e3bea2ce9969d6794835a0724f29b0d.tar.xz
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.
Diffstat (limited to 'player/client.c')
-rw-r--r--player/client.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/player/client.c b/player/client.c
index e83f3568f8..7d75b22256 100644
--- a/player/client.c
+++ b/player/client.c
@@ -1613,6 +1613,15 @@ int64_t mpv_get_time_us(mpv_handle *ctx)
return mp_time_us();
}
+// Used by vo_opengl_cb to synchronously uninitialize video.
+void kill_video(struct mp_client_api *client_api)
+{
+ struct MPContext *mpctx = client_api->mpctx;
+ mp_dispatch_lock(mpctx->dispatch);
+ mp_switch_track(mpctx, STREAM_VIDEO, NULL);
+ mp_dispatch_unlock(mpctx->dispatch);
+}
+
#include "libmpv/opengl_cb.h"
#if HAVE_GL
@@ -1620,7 +1629,7 @@ static mpv_opengl_cb_context *opengl_cb_get_context(mpv_handle *ctx)
{
mpv_opengl_cb_context *cb = ctx->mpctx->gl_cb_ctx;
if (!cb) {
- cb = mp_opengl_create(ctx->mpctx->global, ctx->mpctx->osd);
+ cb = mp_opengl_create(ctx->mpctx->global, ctx->mpctx->osd, ctx->clients);
ctx->mpctx->gl_cb_ctx = cb;
}
return cb;