[FFmpeg-devel] [PATCH 09/15] lavf/id3v2: use avcodec_descriptor_get_by_mime_type

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


---
 libavformat/id3v2.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index cecd9b9f6d..72a10bd1e1 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -585,7 +585,7 @@ static void read_apic(AVFormatContext *s, AVIOContext *pb, int taglen,
 {
     int enc, pic_type;
     char mimetype[64] = {0};
-    const CodecMime *mime     = ff_id3v2_mime_tags;
+    const AVCodecDescriptor *desc;
     enum AVCodecID id         = AV_CODEC_ID_NONE;
     ID3v2ExtraMetaAPIC *apic  = NULL;
     ID3v2ExtraMeta *new_extra = NULL;
@@ -614,13 +614,9 @@ static void read_apic(AVFormatContext *s, AVIOContext *pb, int taglen,
         taglen    -= 3;
     }
 
-    while (mime->id != AV_CODEC_ID_NONE) {
-        if (!av_strncasecmp(mime->str, mimetype, sizeof(mimetype))) {
-            id = mime->id;
-            break;
-        }
-        mime++;
-    }
+    if ((desc = avcodec_descriptor_get_by_mime_type(mimetype, "image")))
+        id = desc->id;
+
     if (id == AV_CODEC_ID_NONE) {
         av_log(s, AV_LOG_WARNING,
                "Unknown attached picture mimetype: %s, skipping.\n", mimetype);
-- 
2.27.0



More information about the ffmpeg-devel mailing list