diff mbox series

[FFmpeg-devel,11/15] lavf/flacenc: use codec-desc-provided MIME types

Message ID 20200909060217.25794-11-rcombs@rcombs.me
State New
Headers show
Series [FFmpeg-devel,01/15] lavc/codec_desc: add MIME type to AV_CODEC_ID_TEXT | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Ridley Combs Sept. 9, 2020, 6:02 a.m. UTC
---
 libavformat/flacenc.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index b947a3b067..ebb0ffb967 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -80,22 +80,17 @@  static int flac_write_picture(struct AVFormatContext *s, AVPacket *pkt)
     FlacMuxerContext *c = s->priv_data;
     AVIOContext *pb = s->pb;
     const AVPixFmtDescriptor *pixdesc;
-    const CodecMime *mime = ff_id3v2_mime_tags;
     AVDictionaryEntry *e;
     const char *mimetype = NULL, *desc = "";
     const AVStream *st = s->streams[pkt->stream_index];
+    const AVCodecDescriptor *cdesc = avcodec_descriptor_get(st->codecpar->codec_id);
     int i, mimelen, desclen, type = 0, blocklen;
 
     if (!pkt->data)
         return 0;
 
-    while (mime->id != AV_CODEC_ID_NONE) {
-        if (mime->id == st->codecpar->codec_id) {
-            mimetype = mime->str;
-            break;
-        }
-        mime++;
-    }
+    if (cdesc && cdesc->mime_types)
+        mimetype = cdesc->mime_types[0];
     if (!mimetype) {
         av_log(s, AV_LOG_ERROR, "No mimetype is known for stream %d, cannot "
                "write an attached picture.\n", st->index);