summaryrefslogtreecommitdiffstats
path: root/video/out/vo_sdl.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_sdl.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_sdl.c')
-rw-r--r--video/out/vo_sdl.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/video/out/vo_sdl.c b/video/out/vo_sdl.c
index e31dfdc8f2..57302b0a41 100644
--- a/video/out/vo_sdl.c
+++ b/video/out/vo_sdl.c
@@ -190,6 +190,7 @@ struct priv {
int num_targets;
int targets_size;
} osd_surfaces[MAX_OSD_PARTS];
+ double osd_pts;
int mouse_hidden;
int brightness, contrast;
@@ -741,7 +742,7 @@ static void draw_osd_cb(void *ctx, struct sub_bitmaps *imgs)
draw_osd_part(vo, imgs->render_index);
}
-static void draw_osd(struct vo *vo, struct osd_state *osd)
+static void draw_osd(struct vo *vo)
{
struct priv *vc = vo->priv;
@@ -749,7 +750,7 @@ static void draw_osd(struct vo *vo, struct osd_state *osd)
[SUBBITMAP_RGBA] = true,
};
- osd_draw(osd, vc->osd_res, osd_get_vo_pts(osd), 0, osdformats, draw_osd_cb, vo);
+ osd_draw(vo->osd, vc->osd_res, vc->osd_pts, 0, osdformats, draw_osd_cb, vo);
}
static int preinit(struct vo *vo)
@@ -849,6 +850,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
SDL_SetTextureBlendMode(vc->tex, SDL_BLENDMODE_NONE);
if (mpi) {
+ vc->osd_pts = mpi->pts;
if (SDL_LockTexture(vc->tex, NULL, &pixels, &pitch)) {
MP_ERR(vo, "SDL_LockTexture failed\n");
return;
@@ -900,6 +902,8 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
SDL_SetTextureColorMod(vc->tex, color_mod, color_mod, color_mod);
SDL_RenderCopy(vc->renderer, vc->tex, &src, &dst);
}
+
+ draw_osd(vo);
}
static struct mp_image *get_screenshot(struct vo *vo)
@@ -1020,6 +1024,5 @@ const struct vo_driver video_out_sdl = {
.control = control,
.draw_image = draw_image,
.uninit = uninit,
- .draw_osd = draw_osd,
.flip_page = flip_page,
};