summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-03 02:05:55 +0200
committerwm4 <wm4@nowhere>2013-06-03 22:40:31 +0200
commit3289be9a2856c0f935fcb49768fc39d878044202 (patch)
treeb6a98805e5de8ba559d18e66351c6e2f80956d34 /sub
parent8c63b318dc106f43d9ab17250452216bab485587 (diff)
downloadmpv-3289be9a2856c0f935fcb49768fc39d878044202.tar.bz2
mpv-3289be9a2856c0f935fcb49768fc39d878044202.tar.xz
sd_ass: add default style if there aren't any styles
The default style is added by mp_ass_default_track(), but not by ass_new_track(). Considering this, the previous condition at this point didn't make much sense anymore: the actual (converted) subtitle format doesn't matter much for what styling should be applied. What matters is if the subtitle was originally ASS, or if it was converted to it. Change the code such that the default style is added if there aren't any, even after reading sub extradata. (The extradata contains the ASS header, including the style section.) This might change behavior with scripts that don't define any styles. The change is either with this commit or with an earlier commit in this branch, depending on the situation - there are multiple places where default styles are added in libass API functions, and it's all a big mess. Other than with very old or broken files (where different behavior doesn't matter much), the current code should be pretty safe, though.
Diffstat (limited to 'sub')
-rw-r--r--sub/sd_ass.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sub/sd_ass.c b/sub/sd_ass.c
index 1f7f33b026..c4373d4511 100644
--- a/sub/sd_ass.c
+++ b/sub/sd_ass.c
@@ -63,25 +63,29 @@ static void free_last_event(ASS_Track *track)
static int init(struct sd *sd)
{
+ struct MPOpts *opts = sd->opts;
if (!sd->ass_library || !sd->ass_renderer)
return -1;
- bool ass = is_native_ass(sd->codec);
bool is_converted = sd->converted_from != NULL;
+
struct sd_ass_priv *ctx = talloc_zero(NULL, struct sd_ass_priv);
sd->priv = ctx;
if (sd->ass_track) {
ctx->ass_track = sd->ass_track;
- } else if (ass) {
+ } else {
ctx->ass_track = ass_new_track(sd->ass_library);
- } else
- ctx->ass_track = mp_ass_default_track(sd->ass_library, sd->opts);
+ if (!is_converted)
+ ctx->ass_track->track_type = TRACK_TYPE_ASS;
+ }
if (sd->extradata) {
ass_process_codec_private(ctx->ass_track, sd->extradata,
sd->extradata_len);
}
+ mp_ass_add_default_styles(ctx->ass_track, opts);
+
ctx->vsfilter_aspect = !is_converted;
return 0;
}