summaryrefslogtreecommitdiffstats
path: root/command.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2012-08-25 17:47:50 +0300
committerwm4 <wm4@nowhere>2012-09-18 21:04:46 +0200
commit9bb03b7db40408b9dc4a0e1405a5bac754893e2b (patch)
tree87f36a068956b2783d48dac7f96dfa0bbd74d745 /command.c
parent44d8ec9272ad265aae02b064a0c5f4a80db5a107 (diff)
downloadmpv-9bb03b7db40408b9dc4a0e1405a5bac754893e2b.tar.bz2
mpv-9bb03b7db40408b9dc4a0e1405a5bac754893e2b.tar.xz
subs: libass: use a single persistent renderer for subtitles
To draw libass subtitles, the code used ASS_Renderer objects created in vf_vo (VO rendering) or vf_ass. They were destroyed and recreated together with the video filter chain. Change the code to use a single persistent renderer instance stored in the main osd_state struct. Because libass seems to misbehave if fonts are changed while a renderer exists (even if ass_set_fonts() is called on the renderer afterwards), the renderer is recreated after adding embedded fonts. The known benefits are simpler code and avoiding delays when switching between timeline parts from different files (libass fontconfig initialization, needed when creating a new renderer, can take a long time in some cases; switching between files rebuilds the video filter chain, and this required recreating the renderers). On the other hand, I'm not sure whether this could cause inefficient bitmap caching in libass; explicitly resetting the renderer in some cases could be beneficial. The new code does not keep the distinction of separate renderers for vsfilter munged aspect vs normal; this means that changing subtitle tracks can lose cache for the previous track. The new code always sets some libass parameters on each rendering call, which were previously only set if they had potentially changed. This should be harmless as libass itself has checks to see if the values differ from previous ones. Conflicts: command.c libmpcodecs/vf_ass.c libmpcodecs/vf_vo.c mplayer.c sub/ass_mp.c
Diffstat (limited to 'command.c')
-rw-r--r--command.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/command.c b/command.c
index f0b17719db..f733bbc0f0 100644
--- a/command.c
+++ b/command.c
@@ -1519,7 +1519,7 @@ static int mp_property_ass_use_margins(m_option_t *prop, int action,
return M_PROPERTY_ERROR;
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
- mpctx->osd->ass_force_reload = true;
+ vo_osd_changed(OSDTYPE_SUBTITLE);
default:
return m_property_flag(prop, action, arg, &opts->ass_use_margins);
}
@@ -1537,8 +1537,7 @@ static int mp_property_ass_vsfilter_aspect_compat(m_option_t *prop, int action,
return M_PROPERTY_ERROR;
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
- //has to re-render subs with new aspect ratio
- mpctx->osd->ass_force_reload = 1;
+ vo_osd_changed(OSDTYPE_SUBTITLE);
default:
return m_property_flag(prop, action, arg,
&mpctx->opts.ass_vsfilter_aspect_compat);
@@ -1581,10 +1580,8 @@ static int mp_property_sub_scale(m_option_t *prop, int action, void *arg,
return M_PROPERTY_ERROR;
M_PROPERTY_CLAMP(prop, *(float *) arg);
#ifdef CONFIG_ASS
- if (opts->ass_enabled) {
+ if (opts->ass_enabled)
opts->ass_font_scale = *(float *) arg;
- mpctx->osd->ass_force_reload = true;
- }
#endif
text_font_scale_factor = *(float *) arg;
vo_osd_resized();
@@ -1596,7 +1593,6 @@ static int mp_property_sub_scale(m_option_t *prop, int action, void *arg,
opts->ass_font_scale += (arg ? *(float *) arg : 0.1) *
(action == M_PROPERTY_STEP_UP ? 1.0 : -1.0);
M_PROPERTY_CLAMP(prop, opts->ass_font_scale);
- mpctx->osd->ass_force_reload = true;
}
#endif
text_font_scale_factor += (arg ? *(float *) arg : 0.1) *