summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-24 23:28:38 +0100
committerwm4 <wm4@nowhere>2015-01-24 23:28:38 +0100
commit8657b8e1f3c247dcba441a4c61e3beef2acc2cd4 (patch)
tree2ff77ed69d755a27c647edd6a46afe4b024b60e8
parent28582322207bb962553505f0c25268f4b786287d (diff)
downloadmpv-8657b8e1f3c247dcba441a4c61e3beef2acc2cd4.tar.bz2
mpv-8657b8e1f3c247dcba441a4c61e3beef2acc2cd4.tar.xz
vo: generic redraw support
Usually, a VO must react to VOCTRL_REDRAW_FRAME in order to redraw the current screen correctly if video is paused (this is done to update OSD). But if it's not supported, we can just draw the current image again in the generic vo.c code. Unfortunately, this turned out pretty useless, because the VOs which would benefit from this need to redraw even if there is no image, in order to draw a black screen in --idle --force-window mode. The way redrawing is handled in the X11 common code and in vo_x11 and vo_xv is in the way, and I'm not sure what exactly vo_wayland requires. Other VOs have a non-trivial implementation of VOCTRL_REDRAW_FRAME, which (probably) makes redrawing slightly more efficient, e.g. by skipping texture upload. So for now, no VO uses this new functionality, but since it's trivial, commit it anyway. The vo_driver->untimed case is for forcibly disabling redraw for vo_lavc and vo_image always.
-rw-r--r--video/out/vo.c8
-rw-r--r--video/out/vo.h4
2 files changed, 5 insertions, 7 deletions
diff --git a/video/out/vo.c b/video/out/vo.c
index 11690afb67..aee2dd8c75 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -687,9 +687,9 @@ static void do_redraw(struct vo *vo)
pthread_mutex_lock(&in->lock);
in->request_redraw = false;
in->want_redraw = false;
- bool force_full_redraw = in->dropped_frame;
+ bool full_redraw = in->dropped_frame;
struct mp_image *img = NULL;
- if (vo->config_ok)
+ if (vo->config_ok && !(vo->driver->untimed))
img = mp_image_new_ref(in->current_frame);
if (img)
in->dropped_frame = false;
@@ -698,12 +698,10 @@ static void do_redraw(struct vo *vo)
if (!img)
return;
- if (force_full_redraw) {
+ if (full_redraw || vo->driver->control(vo, VOCTRL_REDRAW_FRAME, NULL) < 1) {
vo->driver->draw_image(vo, img);
} else {
talloc_free(img);
- if (vo->driver->control(vo, VOCTRL_REDRAW_FRAME, NULL) < 1)
- return;
}
if (vo->driver->flip_page_timed)
diff --git a/video/out/vo.h b/video/out/vo.h
index e5eccd3f86..2d298088b0 100644
--- a/video/out/vo.h
+++ b/video/out/vo.h
@@ -63,7 +63,7 @@ enum mp_voctrl {
// Redraw the image previously passed to draw_image() (basically, repeat
// the previous draw_image call). If this is handled, the OSD should also
- // be updated and redrawn.
+ // be updated and redrawn. Optional; emulated if not available.
VOCTRL_REDRAW_FRAME,
VOCTRL_FULLSCREEN,
@@ -165,7 +165,7 @@ struct vo_driver {
// VO_CAP_* bits
int caps;
- // Disable video timing, push frames as quickly as possible.
+ // Disable video timing, push frames as quickly as possible, never redraw.
bool untimed;
const char *name;