summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-10-04 17:16:32 +0200
committerwm4 <wm4@nowhere>2012-10-16 07:26:31 +0200
commit17f5019b468d5269408b7dae53a24e17426de7d5 (patch)
tree65e34c482428e563e79356f19b4a9240d8f9ded2 /mplayer.c
parent34b3a9c5e97dfae87afab64915dec624439eafa6 (diff)
downloadmpv-17f5019b468d5269408b7dae53a24e17426de7d5.tar.bz2
mpv-17f5019b468d5269408b7dae53a24e17426de7d5.tar.xz
sub: always go through sub.c for OSD rendering
Before this commit, vf_vo.c and vf_ass.c were manually calling the subtitle decoder to retrieve images to render. In particular, this circumvented the sub-bitmap conversion & caching layer in sub.c. Change this so that subtitle decoding isn't special anymore, and draws all subtitles with the normal OSD drawing API. This is also a step towards removing the need for vf_ass auto-insertion. In fact, if auto-insertion would be disabled now, VOs with "old" OSD rendering could still render ASS subtitles in monochrome, because there is still ASS -> old-OSD bitmap conversion in the sub.c mechanism. The code is written with the assumption that the subtitle rendering filter (vf_ass) can render all subtitle formats. Since vf_ass knows the ASS format only, rendering image subs (i.e. RGBA subs) with it simply fails. This means that with vo_xv (vf_ass auto-inserted), image subs wouldn't be rendered. Use a dumb hack to disable rendering subs with a filter, if we detect that the subs are not in ASS format. (Trying to render the subs first would probably result in purging the conversion cache on every frame.)
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/mplayer.c b/mplayer.c
index a885fac8ca..ebf911cb54 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -2397,9 +2397,9 @@ int reinit_video_chain(struct MPContext *mpctx)
sh_video->vfilter = append_filters(sh_video->vfilter, opts->vf_settings);
- if (opts->ass_enabled)
- sh_video->vfilter->control(sh_video->vfilter, VFCTRL_INIT_EOSD,
- mpctx->ass_library);
+ struct vf_instance *vf = sh_video->vfilter;
+ mpctx->osd->render_subs_in_filter
+ = vf->control(vf, VFCTRL_INIT_OSD, NULL) == VO_TRUE;
init_best_video_codec(sh_video, video_codec_list, video_fm_list);
@@ -2644,12 +2644,10 @@ static int redraw_osd(struct MPContext *mpctx)
struct vf_instance *vf = sh_video->vfilter;
if (vo_redraw_frame(mpctx->video_out) < 0)
return -1;
- mpctx->osd->sub_pts = mpctx->video_pts;
- if (mpctx->osd->sub_pts != MP_NOPTS_VALUE)
- mpctx->osd->sub_pts += sub_delay - mpctx->osd->sub_offset;
+ mpctx->osd->vo_sub_pts = mpctx->video_pts;
- if (!(sh_video->output_flags & VFCAP_EOSD_FILTER))
- vf->control(vf, VFCTRL_DRAW_EOSD, mpctx->osd);
+ // NOTE: probably should use VO ctrl directly, and/or check if a filter does
+ // OSD rendering (a filter can't redraw anything here)
vf->control(vf, VFCTRL_DRAW_OSD, mpctx->osd);
vo_osd_reset_changed();
vo_flip_page(mpctx->video_out, 0, -1);
@@ -3257,10 +3255,7 @@ static void run_playloop(struct MPContext *mpctx)
update_subtitles(mpctx, sh_video->pts);
update_osd_msg(mpctx);
struct vf_instance *vf = sh_video->vfilter;
- mpctx->osd->sub_pts = mpctx->video_pts;
- if (mpctx->osd->sub_pts != MP_NOPTS_VALUE)
- mpctx->osd->sub_pts += sub_delay - mpctx->osd->sub_offset;
- vf->control(vf, VFCTRL_DRAW_EOSD, mpctx->osd);
+ mpctx->osd->vo_sub_pts = mpctx->video_pts;
vf->control(vf, VFCTRL_DRAW_OSD, mpctx->osd);
vo_osd_reset_changed();