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

rcombs rcombs at rcombs.me
Wed Sep 9 09:02:13 EEST 2020


---
 libavformat/flacenc.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

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);
-- 
2.27.0



More information about the ffmpeg-devel mailing list