summaryrefslogtreecommitdiffstats
path: root/player/loadfile.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-23 17:31:42 +0100
committerwm4 <wm4@nowhere>2013-12-23 17:31:42 +0100
commitd259d88af81210a68d398ddd66b022254156bfc8 (patch)
tree3df5daff88f4b6a69e42c850a3acd0dbb6ceda1f /player/loadfile.c
parentfd081c467d2e2e4fe9a6918b8f07a063bcd01c8e (diff)
downloadmpv-d259d88af81210a68d398ddd66b022254156bfc8.tar.bz2
mpv-d259d88af81210a68d398ddd66b022254156bfc8.tar.xz
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.
Diffstat (limited to 'player/loadfile.c')
-rw-r--r--player/loadfile.c13
1 files 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);
+ }
}
}
}