summaryrefslogtreecommitdiffstats
path: root/video/out/vo_vaapi.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-06-15 20:46:57 +0200
committerwm4 <wm4@nowhere>2014-06-15 20:53:15 +0200
commit716285782d5e4b264e18e253e9d58980183c76c6 (patch)
treeb03e6e0ead71828f9d68bdebe777a808bee5d26f /video/out/vo_vaapi.c
parentd88aca6fb2474617136b09c2f281860d6a0a1a38 (diff)
downloadmpv-716285782d5e4b264e18e253e9d58980183c76c6.tar.bz2
mpv-716285782d5e4b264e18e253e9d58980183c76c6.tar.xz
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.
Diffstat (limited to 'video/out/vo_vaapi.c')
-rw-r--r--video/out/vo_vaapi.c13
1 files changed, 10 insertions, 3 deletions
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),