diff mbox series

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

Message ID 20200909060217.25794-10-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/flac_picture.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
diff mbox series

Patch

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