summaryrefslogtreecommitdiffstats
path: root/demux/demux_lavf.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-04-05 20:52:14 +0200
committerwm4 <wm4@nowhere>2015-04-05 20:52:14 +0200
commit20160fa2e13641acb4276ce68f7fad9025425b77 (patch)
tree403f36f592a98eae43ffdea5b5d9f7ee4e29acf0 /demux/demux_lavf.c
parent642f84f9227607f0c64bf35ec5896cb80804f64f (diff)
downloadmpv-20160fa2e13641acb4276ce68f7fad9025425b77.tar.bz2
mpv-20160fa2e13641acb4276ce68f7fad9025425b77.tar.xz
demux_lavf: use mimetype instead of codec type for embedded fonts
We handle picking out font attachments by mime type ourselves in a higher level, so we really just want to use the mimetype. Also, Matroska is currently the only code in libavformat which uses the fonts at all, and we can drop use of the codec IDs completely.
Diffstat (limited to 'demux/demux_lavf.c')
-rw-r--r--demux/demux_lavf.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index 8d105eb421..6252fc92e9 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -584,16 +584,10 @@ static void handle_stream(demuxer_t *demuxer, int i)
break;
}
case AVMEDIA_TYPE_ATTACHMENT: {
- AVDictionaryEntry *ftag = av_dict_get(st->metadata, "filename",
- NULL, 0);
+ AVDictionaryEntry *ftag = av_dict_get(st->metadata, "filename", NULL, 0);
char *filename = ftag ? ftag->value : NULL;
- char *mimetype = NULL;
- switch (st->codec->codec_id) {
- case AV_CODEC_ID_TTF: mimetype = "application/x-truetype-font"; break;
-#if LIBAVFORMAT_VERSION_MICRO >= 100
- case AV_CODEC_ID_OTF: mimetype = "application/vnd.ms-opentype"; break;
-#endif
- }
+ AVDictionaryEntry *mt = av_dict_get(st->metadata, "mimetype", NULL, 0);
+ char *mimetype = mt ? mt->value : NULL;
if (mimetype) {
demuxer_add_attachment(demuxer, bstr0(filename), bstr0(mimetype),
(struct bstr){codec->extradata,