From 20160fa2e13641acb4276ce68f7fad9025425b77 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 5 Apr 2015 20:52:14 +0200 Subject: 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. --- demux/demux_lavf.c | 12 +++--------- 1 file 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, -- cgit v1.2.3