diff mbox series

[FFmpeg-devel,12/15] lavf/mp3enc: use codec descs for query_codec

Message ID 20200909060217.25794-12-rcombs@rcombs.me
State New
Headers show
Series [FFmpeg-devel,01/15] lavc/codec_desc: add MIME type to AV_CODEC_ID_TEXT
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Ridley Combs Sept. 9, 2020, 6:02 a.m. UTC
---
 libavformat/mp3enc.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index a3586e1f86..eb8cc2e22f 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -489,12 +489,9 @@  static int mp3_write_trailer(struct AVFormatContext *s)
 
 static int query_codec(enum AVCodecID id, int std_compliance)
 {
-    const CodecMime *cm= ff_id3v2_mime_tags;
-    while(cm->id != AV_CODEC_ID_NONE) {
-        if(id == cm->id)
-            return MKTAG('A', 'P', 'I', 'C');
-        cm++;
-    }
+    const AVCodecDescriptor *desc = avcodec_descriptor_get(id);
+    if (desc && desc->type == AVMEDIA_TYPE_VIDEO && desc->mime_types)
+        return MKTAG('A', 'P', 'I', 'C');
     return -1;
 }