sd_ass: fix top alignment of secondary subtitles

Secondary subtitle streams (to be shown on the top of the screen along
main subtitle stream) were shown with normal alignment. This is because
we tell libass to override the alignment style (a relatively recent
change, see commit 2f1eb49e). This would behave differently with old
libass versions too.

To escape the mess, just set the alignment explicitly with an override
tag instead of modifying the style.
This commit is contained in:
wm4 2016-09-25 01:03:59 +02:00
parent cad6fb038b
commit 077dd27df2
1 changed files with 4 additions and 3 deletions

View File

@ -598,6 +598,10 @@ static void fill_plaintext(struct sd *sd, double pts)
return;
bstr dst = {0};
if (ctx->on_top)
bstr_xappend(NULL, &dst, bstr0("{\\a6}"));
while (*text) {
if (*text == '{')
bstr_xappend(NULL, &dst, bstr0("\\"));
@ -618,9 +622,6 @@ static void fill_plaintext(struct sd *sd, double pts)
event->Style = track->default_style;
event->Text = strdup(dst.start);
if (track->default_style < track->n_styles)
track->styles[track->default_style].Alignment = ctx->on_top ? 6 : 2;
talloc_free(dst.start);
}