summaryrefslogtreecommitdiffstats
path: root/sub/sd_ass.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-03-03 18:48:56 +0100
committerwm4 <wm4@nowhere>2016-03-03 18:48:56 +0100
commit3f60548df472d01387784601526e378d8ffb4659 (patch)
tree6bcec60b8c057111607e5b4f6f9f4d822a0e3982 /sub/sd_ass.c
parenta6f8a6977ec59d314b617780c60e374b585ebaca (diff)
downloadmpv-3f60548df472d01387784601526e378d8ffb4659.tar.bz2
mpv-3f60548df472d01387784601526e378d8ffb4659.tar.xz
sub: pass all attachments to the subtitle decoder
Commit 8d4a179c made subtitle decoders pick up fonts strictly from the same source file (i.e. the same demuxer). It breaks some fucked up use-case, and 2 people on this earth complained about the change because of this. Add it back. This copies all attached fonts on each subtitle init. I considered converting attachments to use refcounting, but it'd probably be much more complex. Since it's slightly harder to get a list of active demuxers with duplicate removed, the prev_demuxer variable serves as a hack to achieve almost the same thing, except in weird corner cases. (In which fonts could be added twice.)
Diffstat (limited to 'sub/sd_ass.c')
-rw-r--r--sub/sd_ass.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sub/sd_ass.c b/sub/sd_ass.c
index 5c56d3e0df..4426c2ebab 100644
--- a/sub/sd_ass.c
+++ b/sub/sd_ass.c
@@ -117,10 +117,10 @@ static void add_subtitle_fonts(struct sd *sd)
{
struct sd_ass_priv *ctx = sd->priv;
struct MPOpts *opts = sd->opts;
- if (!opts->ass_enabled || !sd->demuxer)
+ if (!opts->ass_enabled || !sd->attachments)
return;
- for (int i = 0; i < sd->demuxer->num_attachments; i++) {
- struct demux_attachment *f = &sd->demuxer->attachments[i];
+ for (int i = 0; i < sd->attachments->num_entries; i++) {
+ struct demux_attachment *f = &sd->attachments->entries[i];
if (opts->use_embedded_fonts && attachment_is_font(sd->log, f))
ass_add_font(ctx->ass_library, f->name, f->data, f->data_size);
}