# HG changeset patch # User reimar # Date 1326549989 0 # Node ID fd5512f5bfe93180afe3cbfb434464387f57d0a1 # Parent 45e9c10b2f5b7acfcb866bef1ade5f9d568e7880 Fix -ass-styles with SRT subs and more. The most visible problems are fixed by switching SRT event "Style" value from first style to default_style. To fix issues with overriding "Default" style, this adds a dummy style first, to stop libass from adding a style with the name "Default" (this is a problem since some of the libass code picks the first, some the last style - encoded in default_track - with the name "Default"). If after loading the ass-styles file there still is no default style, MPlayer adds and sets its own. diff -r 45e9c10b2f5b -r fd5512f5bfe9 sub/ass_mp.c --- a/sub/ass_mp.c Sat Jan 14 13:55:38 2012 +0000 +++ b/sub/ass_mp.c Sat Jan 14 14:06:29 2012 +0000 @@ -97,12 +97,21 @@ track->PlayResY = 288; track->WrapStyle = 0; + if (track->n_styles == 0) { + // stupid hack to stop libass to add a default track + // in front in ass_read_styles - this makes it impossible + // to completely override the "Default" track. + int sid = ass_alloc_style(track); + init_style(track->styles + sid, "MPlayerDummy", track->PlayResY); + } + if (ass_styles_file) ass_read_styles(track, ass_styles_file, sub_cp); - if (track->n_styles == 0) { + if (track->default_style <= 0) { int sid = ass_alloc_style(track); init_style(track->styles + sid, "Default", track->PlayResY); + track->default_style = sid; } ass_process_force_style(track); @@ -143,7 +152,7 @@ event->Start = sub->start * 10; event->Duration = (sub->end - sub->start) * 10; - event->Style = 0; + event->Style = track->default_style; for (j = 0; j < sub->lines; ++j) len += sub->text[j] ? strlen(sub->text[j]) : 0;