subs: libass: use a single persistent renderer for subtitles
commitfb3e6f56b356131accee98e3d32ddceddf96b6fb
authorUoti Urpala <uau@mplayer2.org>
Sat, 25 Aug 2012 14:47:50 +0000 (25 17:47 +0300)
committerUoti Urpala <uau@mplayer2.org>
Fri, 31 Aug 2012 17:30:42 +0000 (31 20:30 +0300)
treef1ab439d911917d6e7f55f4e8923448f39be11a9
parent1c56030e806a7e022f3b7d850ea00fd86c01299e
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.
command.c
libmpcodecs/vf_ass.c
libmpcodecs/vf_vo.c
libvo/video_out.h
mplayer.c
sub/ass_mp.c
sub/ass_mp.h
sub/dec_sub.h
sub/sd_ass.c
sub/sub.h