summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libvo/video_out.c1
-rw-r--r--libvo/video_out.h1
-rw-r--r--libvo/vo_gl.c25
-rw-r--r--libvo/vo_vdpau.c36
-rw-r--r--libvo/vo_xv.c31
-rw-r--r--mplayer.c15
6 files changed, 35 insertions, 74 deletions
diff --git a/libvo/video_out.c b/libvo/video_out.c
index 0b1f7d1fab..2e507e48ea 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -354,6 +354,7 @@ void vo_flip_page(struct vo *vo, unsigned int pts_us, int duration)
vo->frame_loaded = false;
vo->next_pts = MP_NOPTS_VALUE;
}
+ vo->want_redraw = false;
vo->redrawing = false;
if (vo->driver->flip_page_timed)
vo->driver->flip_page_timed(vo, pts_us, duration);
diff --git a/libvo/video_out.h b/libvo/video_out.h
index 032a32b1cc..0a56fd23a9 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -263,6 +263,7 @@ struct vo {
struct mp_image *waiting_mpi;
double next_pts; // pts value of the next frame if any
double next_pts2; // optional pts of frame after that
+ bool want_redraw; // visible frame wrong (window resize), needs refresh
bool redrawing; // between redrawing frame and flipping it
double flip_queue_offset; // queue flip events at most this much in advance
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index ec6e6573e6..08868246e5 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -127,8 +127,6 @@ struct gl_priv {
int mipmap_gen;
int stereo_mode;
- int int_pause;
-
struct mp_csp_equalizer video_eq;
int texture_width;
@@ -140,8 +138,6 @@ struct gl_priv {
unsigned int slice_height;
};
-static void redraw(struct vo *vo);
-
static void resize(struct vo *vo, int x, int y)
{
struct gl_priv *p = vo->priv;
@@ -185,7 +181,7 @@ static void resize(struct vo *vo, int x, int y)
vo_osd_changed(OSDTYPE_OSD);
}
gl->Clear(GL_COLOR_BUFFER_BIT);
- redraw(vo);
+ vo->want_redraw = true;
}
static void texSize(struct vo *vo, int w, int h, int *texw, int *texh)
@@ -699,8 +695,8 @@ static void check_events(struct vo *vo)
}
if (e & VO_EVENT_RESIZE)
resize(vo, vo->dwidth, vo->dheight);
- if (e & VO_EVENT_EXPOSE && p->int_pause)
- redraw(vo);
+ if (e & VO_EVENT_EXPOSE)
+ vo->want_redraw = true;
}
/**
@@ -900,15 +896,6 @@ static void flip_page(struct vo *vo)
}
}
-static void redraw(struct vo *vo)
-{
- if (vo_doublebuffering) {
- do_render(vo);
- do_render_osd(vo, RENDER_OSD | RENDER_EOSD);
- }
- flip_page(vo);
-}
-
static int draw_slice(struct vo *vo, uint8_t *src[], int stride[], int w, int h,
int x, int y)
{
@@ -1423,10 +1410,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
struct gl_priv *p = vo->priv;
switch (request) {
- case VOCTRL_PAUSE:
- case VOCTRL_RESUME:
- p->int_pause = (request == VOCTRL_PAUSE);
- return VO_TRUE;
case VOCTRL_QUERY_FORMAT:
return query_format(vo, *(uint32_t *)data);
case VOCTRL_GET_IMAGE:
@@ -1487,6 +1470,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
if (mp_csp_equalizer_set(&p->video_eq, args->name, args->value) < 0)
return VO_NOTIMPL;
update_yuvconv(vo);
+ vo->want_redraw = true;
return VO_TRUE;
}
break;
@@ -1495,6 +1479,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
if (vo->config_count && supports_csp) {
p->colorspace = *(struct mp_csp_details *)data;
update_yuvconv(vo);
+ vo->want_redraw = true;
}
return VO_TRUE;
}
diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c
index bb82b7613d..05d32cc6f8 100644
--- a/libvo/vo_vdpau.c
+++ b/libvo/vo_vdpau.c
@@ -195,9 +195,6 @@ struct vdpctx {
// Video equalizer
struct mp_csp_equalizer video_eq;
- int num_shown_frames;
- bool paused;
-
// These tell what's been initialized and uninit() should free/uninitialize
bool mode_switched;
};
@@ -417,7 +414,6 @@ static void resize(struct vo *vo)
int min_output_width = FFMAX(vo->dwidth, vc->vid_width);
int min_output_height = FFMAX(vo->dheight, vc->vid_height);
- bool had_frames = vc->num_shown_frames;
if (vc->output_surface_width < min_output_width
|| vc->output_surface_height < min_output_height) {
if (vc->output_surface_width < min_output_width) {
@@ -446,11 +442,8 @@ static void resize(struct vo *vo)
mp_msg(MSGT_VO, MSGL_DBG2, "vdpau out create: %u\n",
vc->output_surfaces[i]);
}
- vc->num_shown_frames = 0;
}
- if (vc->paused && had_frames)
- if (video_to_output_surface(vo) >= 0)
- flip_page_timed(vo, 0, -1);
+ vo->want_redraw = true;
}
static void preemption_callback(VdpDevice device, void *context)
@@ -832,7 +825,6 @@ static void mark_vdpau_objects_uninitialized(struct vo *vo)
};
vc->output_surface_width = vc->output_surface_height = -1;
vc->eosd_render_count = 0;
- vc->num_shown_frames = 0;
}
static int handle_preemption(struct vo *vo)
@@ -944,9 +936,6 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
static void check_events(struct vo *vo)
{
- struct vdpctx *vc = vo->priv;
- struct vdp_functions *vdp = vc->vdp;
-
if (handle_preemption(vo) < 0)
return;
@@ -954,19 +943,8 @@ static void check_events(struct vo *vo)
if (e & VO_EVENT_RESIZE)
resize(vo);
- else if (e & VO_EVENT_EXPOSE && vc->paused) {
- /* did we already draw a buffer */
- if (vc->num_shown_frames) {
- /* redraw the last visible buffer */
- VdpStatus vdp_st;
- int last_surface = WRAP_ADD(vc->surface_num, -1,
- vc->num_output_surfaces);
- vdp_st = vdp->presentation_queue_display(vc->flip_queue,
- vc->output_surfaces[last_surface],
- vo->dwidth, vo->dheight, 0);
- CHECK_ST_WARNING("Error when calling "
- "vdp_presentation_queue_display");
- }
+ else if (e & VO_EVENT_EXPOSE) {
+ vo->want_redraw = true;
}
}
@@ -1407,7 +1385,6 @@ static void flip_page_timed(struct vo *vo, unsigned int pts_us, int duration)
vc->last_ideal_time = ideal_pts;
vc->dropped_frame = false;
vc->surface_num = WRAP_ADD(vc->surface_num, 1, vc->num_output_surfaces);
- vc->num_shown_frames = FFMIN(vc->num_shown_frames + 1, 1000);
}
static int draw_slice(struct vo *vo, uint8_t *image[], int stride[], int w,
@@ -1803,13 +1780,12 @@ static int control(struct vo *vo, uint32_t request, void *data)
feature_enables);
CHECK_ST_WARNING("Error changing deinterlacing settings");
}
+ vo->want_redraw = true;
return VO_TRUE;
case VOCTRL_PAUSE:
if (vc->dropped_frame)
flip_page_timed(vo, 0, -1);
- return (vc->paused = true);
- case VOCTRL_RESUME:
- return (vc->paused = false);
+ return true;
case VOCTRL_QUERY_FORMAT:
return query_format(*(uint32_t *)data);
case VOCTRL_GET_IMAGE:
@@ -1830,6 +1806,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
checked_resize(vo);
return VO_TRUE;
case VOCTRL_SET_EQUALIZER: {
+ vo->want_redraw = true;
struct voctrl_set_equalizer_args *args = data;
return set_equalizer(vo, args->name, args->value);
}
@@ -1841,6 +1818,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
vc->colorspace = *(struct mp_csp_details *)data;
if (status_ok(vo))
update_csc_matrix(vo);
+ vo->want_redraw = true;
return true;
case VOCTRL_GET_YUV_COLORSPACE:
*(struct mp_csp_details *)data = vc->colorspace;
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index 4d1a354937..d43244e85d 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -418,18 +418,11 @@ static void copy_backup_image(struct vo *vo, int dest, int src)
static void check_events(struct vo *vo)
{
- struct xvctx *ctx = vo->priv;
int e = vo_x11_check_events(vo);
- if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE)
+ if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) {
resize(vo);
-
- if ((e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) && ctx->is_paused) {
- /* did we already draw a buffer */
- if (ctx->visible_buf != -1) {
- /* redraw the last visible buffer */
- put_xvimage(vo, ctx->xvimage[ctx->visible_buf]);
- }
+ vo->want_redraw = true;
}
}
@@ -833,20 +826,20 @@ static int control(struct vo *vo, uint32_t request, void *data)
case VOCTRL_SET_PANSCAN:
resize(vo);
return VO_TRUE;
- case VOCTRL_SET_EQUALIZER:
- {
- struct voctrl_set_equalizer_args *args = data;
- return vo_xv_set_eq(vo, x11->xv_port, args->name, args->value);
- }
- case VOCTRL_GET_EQUALIZER:
- {
- struct voctrl_get_equalizer_args *args = data;
- return vo_xv_get_eq(vo, x11->xv_port, args->name, args->valueptr);
- }
+ case VOCTRL_SET_EQUALIZER: {
+ vo->want_redraw = true;
+ struct voctrl_set_equalizer_args *args = data;
+ return vo_xv_set_eq(vo, x11->xv_port, args->name, args->value);
+ }
+ case VOCTRL_GET_EQUALIZER: {
+ struct voctrl_get_equalizer_args *args = data;
+ return vo_xv_get_eq(vo, x11->xv_port, args->name, args->valueptr);
+ }
case VOCTRL_SET_YUV_COLORSPACE:;
struct mp_csp_details* given_cspc = data;
int is_709 = given_cspc->format == MP_CSP_BT_709;
vo_xv_set_eq(vo, x11->xv_port, "bt_709", is_709 * 200 - 100);
+ vo->want_redraw = true;
return true;
case VOCTRL_GET_YUV_COLORSPACE:;
struct mp_csp_details* cspc = data;
diff --git a/mplayer.c b/mplayer.c
index 79407e85a3..f93fb38460 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -3087,11 +3087,10 @@ static void pause_loop(struct MPContext *mpctx)
}
if (mpctx->sh_video && mpctx->video_out)
vo_check_events(mpctx->video_out);
- usec_sleep(20000);
update_osd_msg(mpctx);
int hack = vo_osd_changed(0);
vo_osd_changed(hack);
- if (hack)
+ if (hack || mpctx->sh_video && mpctx->video_out->want_redraw)
break;
#ifdef CONFIG_STREAM_CACHE
if (!opts->quiet && stream_cache_size > 0) {
@@ -3829,21 +3828,25 @@ static void run_playloop(struct MPContext *mpctx)
if (mpctx->stop_play)
break;
}
- if (!mpctx->paused || mpctx->stop_play || mpctx->seek.type
- || mpctx->restart_playback)
+ bool slow_video = mpctx->sh_video && mpctx->video_out->frame_loaded;
+ if (!(mpctx->paused || slow_video) || mpctx->stop_play
+ || mpctx->seek.type || mpctx->restart_playback)
break;
if (mpctx->sh_video) {
update_osd_msg(mpctx);
int hack = vo_osd_changed(0);
vo_osd_changed(hack);
- if (hack) {
+ if (hack || mpctx->video_out->want_redraw) {
if (redraw_osd(mpctx) < 0) {
- add_step_frame(mpctx);
+ if (mpctx->paused)
+ add_step_frame(mpctx);
break;
} else
vo_osd_changed(0);
}
}
+ if (!mpctx->paused)
+ break;
pause_loop(mpctx);
}