From ad0348cf0a7459c0581deaf3ed7d8b73a12cc73f Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Mon, 5 Dec 2011 05:24:18 +0200 Subject: core, vo: modify OSD redraw architecture, support EOSD Previously the core sent VFCTRL_REDRAW_OSD to change OSD contents over the current frame. Change this to VFCTRL_REDRAW_FRAME followed by normal EOSD and OSD drawing calls, then vo_flip_page(). The new version supports changing EOSD contents for libass-rendered subtitles and simplifies the redraw support code needed per VO. vo_xv doesn't support EOSD changes because it relies on vf_ass to render EOSD contents earlier in the filter chain. vo_xv logic is additionally simplified because the previous commit removed the need to track the status of current and next images separately (now each frame is guaranteed to become "visible" soon after we receive it as "next", with no VO code running in the interval between). --- mplayer.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 041d0d5298..79407e85a3 100644 --- a/mplayer.c +++ b/mplayer.c @@ -3035,6 +3035,22 @@ void unpause_player(struct MPContext *mpctx) (void)get_relative_time(mpctx); // ignore time that passed during pause } +static int redraw_osd(struct MPContext *mpctx) +{ + struct sh_video *sh_video = mpctx->sh_video; + struct vf_instance *vf = sh_video->vfilter; + if (sh_video->output_flags & VFCAP_OSD_FILTER) + return -1; + if (vo_redraw_frame(mpctx->video_out) < 0) + return -1; + mpctx->osd->pts = mpctx->video_pts; + if (!(sh_video->output_flags & VFCAP_EOSD_FILTER)) + vf->control(vf, VFCTRL_DRAW_EOSD, mpctx->osd); + vf->control(vf, VFCTRL_DRAW_OSD, mpctx->osd); + vo_flip_page(mpctx->video_out, 0, -1); + return 0; +} + void add_step_frame(struct MPContext *mpctx) { mpctx->step_frames++; @@ -3679,6 +3695,7 @@ static void run_playloop(struct MPContext *mpctx) update_teletext(sh_video, mpctx->demuxer, 0); update_osd_msg(mpctx); struct vf_instance *vf = sh_video->vfilter; + mpctx->osd->pts = mpctx->video_pts; vf->control(vf, VFCTRL_DRAW_EOSD, mpctx->osd); vf->control(vf, VFCTRL_DRAW_OSD, mpctx->osd); vo_osd_changed(0); @@ -3820,7 +3837,7 @@ static void run_playloop(struct MPContext *mpctx) int hack = vo_osd_changed(0); vo_osd_changed(hack); if (hack) { - if (redraw_osd(mpctx->sh_video, mpctx->osd) < 0) { + if (redraw_osd(mpctx) < 0) { add_step_frame(mpctx); break; } else -- cgit v1.2.3