summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-04 23:37:38 +0100
committerwm4 <wm4@nowhere>2015-02-04 23:37:38 +0100
commit23fd114299591b7a5d358627e0540a9c44bd5991 (patch)
tree212ffaf25f5b62fdcd17c6fd3d619a3ab7ca3da4 /video
parent9248f75853f8b316d0aca1cb3960e53df12b1331 (diff)
downloadmpv-23fd114299591b7a5d358627e0540a9c44bd5991.tar.bz2
mpv-23fd114299591b7a5d358627e0540a9c44bd5991.tar.xz
vo_opengl: redraw when pausing while showing an interpolated frame
If smoothmotion is enabled, and the screen shows an interpolated frame the moment you pause, redraw a non-interpolated frame.
Diffstat (limited to 'video')
-rw-r--r--video/out/gl_video.c12
-rw-r--r--video/out/gl_video.h1
-rw-r--r--video/out/vo_opengl.c6
3 files changed, 18 insertions, 1 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c
index cfc85593b1..9d69c822d8 100644
--- a/video/out/gl_video.c
+++ b/video/out/gl_video.c
@@ -182,6 +182,8 @@ struct gl_video {
// reinit_rendering must be called
bool need_reinit_rendering;
+ bool is_interpolated;
+
struct mp_csp_equalizer video_eq;
// Source and destination color spaces for the CMS matrix
@@ -1728,8 +1730,9 @@ static void gl_video_interpolate_frame(struct gl_video *p,
GL *gl = p->gl;
double inter_coeff = 0.0;
int64_t prev_pts = p->surfaces[fbosurface_next(p)].pts;
+ p->is_interpolated = prev_pts < t->pts;
- if (prev_pts < t->pts) {
+ if (p->is_interpolated) {
MP_STATS(p, "new-pts");
// fbosurface 0 is already bound from the caller
p->surfaces[p->surface_idx].pts = t->pts;
@@ -1780,6 +1783,8 @@ void gl_video_render_frame(struct gl_video *p, int fbo, struct frame_timing *t)
MPSWAP(int, src_rect_rot.x1, src_rect_rot.y1);
}
+ p->is_interpolated = false;
+
gl->BindFramebuffer(GL_FRAMEBUFFER, fbo);
gl->Viewport(p->vp_x, p->vp_y, p->vp_w, p->vp_h);
@@ -2224,6 +2229,11 @@ void gl_video_reset(struct gl_video *p)
p->surface_idx = 0;
}
+bool gl_video_showing_interpolated_frame(struct gl_video *p)
+{
+ return p->is_interpolated;
+}
+
// dest = src.<w> (always using 4 components)
static void packed_fmt_swizzle(char w[5], const struct fmt_entry *texfmt,
const struct packed_fmt_entry *fmt)
diff --git a/video/out/gl_video.h b/video/out/gl_video.h
index 195ab40902..490b49bb7e 100644
--- a/video/out/gl_video.h
+++ b/video/out/gl_video.h
@@ -86,6 +86,7 @@ void gl_video_resize_redraw(struct gl_video *p, int w, int h);
void gl_video_set_gl_state(struct gl_video *p);
void gl_video_unset_gl_state(struct gl_video *p);
void gl_video_reset(struct gl_video *p);
+bool gl_video_showing_interpolated_frame(struct gl_video *p);
struct gl_hwdec;
void gl_video_set_hwdec(struct gl_video *p, struct gl_hwdec *hwdec);
diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c
index 99c25182b9..a9435eeac2 100644
--- a/video/out/vo_opengl.c
+++ b/video/out/vo_opengl.c
@@ -375,6 +375,12 @@ static int control(struct vo *vo, uint32_t request, void *data)
gl_video_reset(p->renderer);
mpgl_unlock(p->glctx);
return true;
+ case VOCTRL_PAUSE:
+ mpgl_lock(p->glctx);
+ if (gl_video_showing_interpolated_frame(p->renderer))
+ vo->want_redraw = true;
+ mpgl_unlock(p->glctx);
+ return true;
}
mpgl_lock(p->glctx);