summaryrefslogtreecommitdiffstats
path: root/libvo/video_out.c
diff options
context:
space:
mode:
Diffstat (limited to 'libvo/video_out.c')
-rw-r--r--libvo/video_out.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/libvo/video_out.c b/libvo/video_out.c
index 2333afcb80..205d618878 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -275,11 +275,27 @@ int vo_draw_image(struct vo *vo, struct mp_image *mpi, double pts)
}
vo->frame_loaded = true;
vo->next_pts = pts;
+ // Guaranteed to support at least DRAW_IMAGE later
+ if (vo->driver->is_new) {
+ vo->waiting_mpi = mpi;
+ return 0;
+ }
if (vo_control(vo, VOCTRL_DRAW_IMAGE, mpi) == VO_NOTIMPL)
return -1;
return 0;
}
+int vo_redraw_frame(struct vo *vo)
+{
+ if (!vo->config_ok)
+ return -1;
+ if (vo_control(vo, VOCTRL_REDRAW_FRAME, NULL) == true) {
+ vo->redrawing = true;
+ return 0;
+ }
+ return -1;
+}
+
int vo_get_buffered_frame(struct vo *vo, bool eof)
{
if (!vo->config_ok)
@@ -294,6 +310,7 @@ int vo_get_buffered_frame(struct vo *vo, bool eof)
void vo_skip_frame(struct vo *vo)
{
+ vo_control(vo, VOCTRL_SKIPFRAME, NULL);
vo->frame_loaded = false;
}
@@ -310,6 +327,18 @@ int vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[], int w, int h, int
return vo->driver->draw_slice(vo, src, stride, w, h, x, y);
}
+void vo_new_frame_imminent(struct vo *vo)
+{
+ if (!vo->driver->is_new)
+ return;
+ if (vo->driver->buffer_frames)
+ vo_control(vo, VOCTRL_NEWFRAME, NULL);
+ else {
+ vo_control(vo, VOCTRL_DRAW_IMAGE, vo->waiting_mpi);
+ vo->waiting_mpi = NULL;
+ }
+}
+
void vo_draw_osd(struct vo *vo, struct osd_state *osd)
{
if (!vo->config_ok)
@@ -321,8 +350,12 @@ void vo_flip_page(struct vo *vo, unsigned int pts_us, int duration)
{
if (!vo->config_ok)
return;
- vo->frame_loaded = false;
- vo->next_pts = MP_NOPTS_VALUE;
+ if (!vo->redrawing) {
+ 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);
else
@@ -466,6 +499,9 @@ int vo_config(struct vo *vo, uint32_t width, uint32_t height,
NULL, vo);
vo->registered_fd = vo->event_fd;
}
+ vo->frame_loaded = false;
+ vo->waiting_mpi = NULL;
+ vo->redrawing = false;
return ret;
}