From d259d88af81210a68d398ddd66b022254156bfc8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 23 Dec 2013 17:31:42 +0100 Subject: player: warn if Matroska font attachments have incorrect MIME type Normally we shouldn't load these files. But for some reason it was added in commit b784346e some years ago, and disabling this hack would probably be an inconvenience. So just print a warning. --- player/loadfile.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/player/loadfile.c b/player/loadfile.c index 46238c2d2d..0e325e7fa8 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -800,7 +800,7 @@ static void open_subtitles_from_resolve(struct MPContext *mpctx) } } -static bool attachment_is_font(struct demux_attachment *att) +static bool attachment_is_font(struct mp_log *log, struct demux_attachment *att) { if (!att->name || !att->type || !att->data || !att->data_size) return false; @@ -813,7 +813,13 @@ static bool attachment_is_font(struct demux_attachment *att) char *ext = att->name + strlen(att->name) - 4; if (strcasecmp(ext, ".ttf") == 0 || strcasecmp(ext, ".ttc") == 0 || strcasecmp(ext, ".otf") == 0) + { + mp_warn(log, "Loading font attachment '%s' with MIME type %s. " + "Assuming is probably a broken Matroska file, which was " + "muxed without setting a correct font MIME type.\n", + att->name, att->type); return true; + } } return false; } @@ -826,9 +832,12 @@ static void add_subtitle_fonts_from_sources(struct MPContext *mpctx) struct demuxer *d = mpctx->sources[j]; for (int i = 0; i < d->num_attachments; i++) { struct demux_attachment *att = d->attachments + i; - if (mpctx->opts->use_embedded_fonts && attachment_is_font(att)) + if (mpctx->opts->use_embedded_fonts && + attachment_is_font(mpctx->log, att)) + { ass_add_font(mpctx->ass_library, att->name, att->data, att->data_size); + } } } } -- cgit v1.2.3