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. --- player/playloop.c | 41 +++++++++-------------------------------- 1 file changed, 9 insertions(+), 32 deletions(-) (limited to 'player/playloop.c') diff --git a/player/playloop.c b/player/playloop.c index c06c40bd73..96326da57c 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -132,26 +132,6 @@ end: mp_notify(mpctx, mpctx->opts->pause ? MPV_EVENT_PAUSE : MPV_EVENT_UNPAUSE, 0); } -static void draw_osd(struct MPContext *mpctx) -{ - struct vo *vo = mpctx->video_out; - - osd_set_vo_pts(mpctx->osd, mpctx->video_pts); - vo_draw_osd(vo, mpctx->osd); -} - -static bool redraw_osd(struct MPContext *mpctx) -{ - struct vo *vo = mpctx->video_out; - if (vo_redraw_frame(vo) < 0) - return false; - - draw_osd(mpctx); - - vo_flip_page(vo, 0, -1); - return true; -} - void add_step_frame(struct MPContext *mpctx, int dir) { if (!mpctx->d_video) @@ -630,13 +610,11 @@ static bool handle_osd_redraw(struct MPContext *mpctx) if (!mpctx->video_out || !mpctx->video_out->config_ok) return false; bool want_redraw = vo_get_want_redraw(mpctx->video_out) | - (osd_query_and_reset_want_redraw(mpctx->osd) && - mpctx->video_out->driver->draw_osd); - if (want_redraw) { - if (redraw_osd(mpctx)) - return true; - } - return false; + osd_query_and_reset_want_redraw(mpctx->osd); + if (!want_redraw) + return false; + vo_redraw(mpctx->video_out); + return true; } static void handle_metadata_update(struct MPContext *mpctx) @@ -890,7 +868,7 @@ void handle_force_window(struct MPContext *mpctx, bool reconfig) .d_w = w, .d_h = h, }; vo_reconfig(vo, &p, 0); - redraw_osd(mpctx); + vo_redraw(vo); mp_notify(mpctx, MPV_EVENT_VIDEO_RECONFIG, NULL); } } @@ -1103,9 +1081,7 @@ void run_playloop(struct MPContext *mpctx) //=================== FLIP PAGE (VIDEO BLT): ====================== - MP_STATS(mpctx, "vo draw frame"); - vo_new_frame_imminent(vo); mpctx->video_pts = mpctx->video_next_pts; mpctx->last_vo_pts = mpctx->video_pts; mpctx->playback_pts = mpctx->video_pts; @@ -1113,8 +1089,9 @@ void run_playloop(struct MPContext *mpctx) update_subtitles(mpctx); update_osd_msg(mpctx); - MP_STATS(mpctx, "draw OSD"); - draw_osd(mpctx); + MP_STATS(mpctx, "vo draw frame"); + + vo_new_frame_imminent(vo); MP_STATS(mpctx, "vo sleep"); -- cgit v1.2.3