diff options
author | wm4 <wm4@nowhere> | 2015-10-14 20:38:30 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-10-14 20:38:30 +0200 |
commit | 3a7a2385df1244a242591633497510f4a3c32836 (patch) | |
tree | 63e22f098d11639296d2d650ce35efa4474ef310 /video/out/vo_opengl_cb.c | |
parent | 3274fabeb34b39c230cbf5d20006de87a97d97f3 (diff) | |
download | mpv-3a7a2385df1244a242591633497510f4a3c32836.tar.bz2 mpv-3a7a2385df1244a242591633497510f4a3c32836.tar.xz |
vo_opengl_cb: fix pausing and seeking if interpolation is enabled
When seeking, the current frame will have the wrong timestamp, until the
seek is done and a new frame from the seek target is shown. We still use
the "old" frame for redrawing during seeks. This frame has to be
explicitly marked with still=true in order not to confuse the
interpolation queue. If this is not done, it will ignore frames until a
frame with approximately the same timestamp as the "old" frame is
reached. (Does this mean interpolation handles timestamp resets
incorrectly? I have no idea.)
Of course we also have to clear possibly queued frames on seeks.
Also, in pausing, explicitly let the frame redraw.
Diffstat (limited to 'video/out/vo_opengl_cb.c')
-rw-r--r-- | video/out/vo_opengl_cb.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/video/out/vo_opengl_cb.c b/video/out/vo_opengl_cb.c index 6d27f63e3f..ecf02ff8c3 100644 --- a/video/out/vo_opengl_cb.c +++ b/video/out/vo_opengl_cb.c @@ -69,7 +69,7 @@ struct mpv_opengl_cb_context { int queued_frames; struct vo_frame *cur_frame; struct mp_image_params img_params; - bool reconfigured; + bool reconfigured, reset; int vp_w, vp_h; bool flip; bool force_update; @@ -339,6 +339,13 @@ int mpv_opengl_cb_draw(mpv_opengl_cb_context *ctx, int fbo, int vp_w, int vp_h) ctx->reconfigured = false; ctx->update_new_opts = false; + if (ctx->reset) { + gl_video_reset(ctx->renderer); + ctx->reset = false; + if (ctx->cur_frame) + ctx->cur_frame->still = true; + } + struct mp_csp_equalizer *eq = gl_video_eq_ptr(ctx->renderer); if (ctx->eq_changed) { memcpy(eq->values, ctx->eq.values, sizeof(eq->values)); @@ -353,6 +360,8 @@ int mpv_opengl_cb_draw(mpv_opengl_cb_context *ctx, int fbo, int vp_w, int vp_h) ctx->cur_frame = vo_frame_ref(frame); } else { frame = vo_frame_ref(ctx->cur_frame); + if (frame) + frame->redraw = true; } struct vo_frame dummy = {0}; if (!frame) @@ -510,6 +519,16 @@ static int control(struct vo *vo, uint32_t request, void *data) struct vo_priv *p = vo->priv; switch (request) { + case VOCTRL_RESET: + pthread_mutex_lock(&p->ctx->lock); + forget_frames(p->ctx, false); + p->ctx->reset = true; + pthread_mutex_unlock(&p->ctx->lock); + return VO_TRUE; + case VOCTRL_PAUSE: + vo->want_redraw = true; + vo_wakeup(vo); + return VO_TRUE; case VOCTRL_GET_PANSCAN: return VO_TRUE; case VOCTRL_GET_EQUALIZER: { |