[FFmpeg-devel] [PATCH 10/15] lavf/flac_picture: use avcodec_descriptor_get_by_mime_type

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


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

diff --git a/libavformat/flac_picture.c b/libavformat/flac_picture.c
index 53e24b28b7..3e684b58a3 100644
--- a/libavformat/flac_picture.c
+++ b/libavformat/flac_picture.c
@@ -31,7 +31,7 @@
 
 int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, int truncate_workaround)
 {
-    const CodecMime *mime = ff_id3v2_mime_tags;
+    const AVCodecDescriptor *cdesc;
     enum AVCodecID id = AV_CODEC_ID_NONE;
     AVBufferRef *data = NULL;
     uint8_t mimetype[64], *desc = NULL;
@@ -78,13 +78,8 @@ int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, int tr
     bytestream2_get_bufferu(&g, mimetype, len);
     mimetype[len] = 0;
 
-    while (mime->id != AV_CODEC_ID_NONE) {
-        if (!strncmp(mime->str, mimetype, sizeof(mimetype))) {
-            id = mime->id;
-            break;
-        }
-        mime++;
-    }
+    if ((cdesc = avcodec_descriptor_get_by_mime_type(mimetype, "image")))
+        id = cdesc->id;
     if (id == AV_CODEC_ID_NONE) {
         av_log(s, AV_LOG_ERROR, "Unknown attached picture mimetype: %s.\n",
                mimetype);
-- 
2.27.0



More information about the ffmpeg-devel mailing list