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.
This commit is contained in:
wm4 2015-04-05 20:52:14 +02:00
parent 642f84f922
commit 20160fa2e1
1 changed files with 3 additions and 9 deletions

View File

@ -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,