From 716285782d5e4b264e18e253e9d58980183c76c6 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 15 Jun 2014 20:46:57 +0200 Subject: video/out: change aspects of OSD handling Let the VOs draw the OSD on their own, instead of making OSD drawing a separate VO driver call. Further, let it be the VOs responsibility to request subtitles with the correct PTS. We also basically allow the VO to request OSD/subtitles at any time. OSX changes untested. --- video/out/vo_vaapi.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'video/out/vo_vaapi.c') diff --git a/video/out/vo_vaapi.c b/video/out/vo_vaapi.c index 35caf4d9c6..df96121137 100644 --- a/video/out/vo_vaapi.c +++ b/video/out/vo_vaapi.c @@ -111,6 +111,8 @@ static const bool osd_formats[SUBBITMAP_COUNT] = { [SUBBITMAP_RGBA] = true, }; +static void draw_osd(struct vo *vo); + static void flush_output_surfaces(struct priv *p) { for (int n = 0; n < MAX_OUTPUT_SURFACES; n++) @@ -283,6 +285,8 @@ static void draw_image(struct vo *vo, struct mp_image *mpi) } mp_image_setrefp(&p->output_surfaces[p->output_surface], mpi); + + draw_osd(vo); } static struct mp_image *get_screenshot(struct priv *p) @@ -407,10 +411,13 @@ error: ; } -static void draw_osd(struct vo *vo, struct osd_state *osd) +static void draw_osd(struct vo *vo) { struct priv *p = vo->priv; + struct mp_image *cur = p->output_surfaces[p->output_surface]; + double pts = cur ? cur->pts : 0; + if (!p->osd_format.fourcc) return; @@ -425,7 +432,7 @@ static void draw_osd(struct vo *vo, struct osd_state *osd) for (int n = 0; n < MAX_OSD_PARTS; n++) p->osd_parts[n].active = false; - osd_draw(osd, *res, osd_get_vo_pts(osd), 0, osd_formats, draw_osd_cb, p); + osd_draw(vo->osd, *res, pts, 0, osd_formats, draw_osd_cb, p); } static int get_displayattribtype(const char *name) @@ -524,6 +531,7 @@ static int control(struct vo *vo, uint32_t request, void *data) } case VOCTRL_REDRAW_FRAME: p->output_surface = p->visible_surface; + draw_osd(vo); return true; case VOCTRL_SCREENSHOT: { struct voctrl_screenshot_args *args = data; @@ -654,7 +662,6 @@ const struct vo_driver video_out_vaapi = { .reconfig = reconfig, .control = control, .draw_image = draw_image, - .draw_osd = draw_osd, .flip_page = flip_page, .uninit = uninit, .priv_size = sizeof(struct priv), -- cgit v1.2.3