mirror of
https://github.com/mpv-player/mpv
synced 2025-02-17 04:58:06 +00:00
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.
This commit is contained in:
parent
9248f75853
commit
23fd114299
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user