diff mbox series

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

Message ID 20200909060217.25794-9-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

rcombs Sept. 9, 2020, 6:02 a.m. UTC
---
 libavformat/id3v2.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
diff mbox series

Patch

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