lavf: check that the codec is supported by extract_extradata
authorAnton Khirnov <anton@khirnov.net>
Tue, 18 Oct 2016 18:50:03 +0000 (20:50 +0200)
committerAnton Khirnov <anton@khirnov.net>
Fri, 21 Oct 2016 08:11:20 +0000 (10:11 +0200)
Avoids superfluous error message spam after
8e2ea691351c5079cdab245ff7bfa5c0f3e3bfe4

libavformat/utils.c

index 1c93326..37ba5a8 100644 (file)
@@ -2099,6 +2099,16 @@ static int extract_extradata_init(AVStream *st)
     if (!f)
         goto finish;
 
+    /* check that the codec id is supported */
+    if (f->codec_ids) {
+        const enum AVCodecID *ids;
+        for (ids = f->codec_ids; *ids != AV_CODEC_ID_NONE; ids++)
+            if (*ids == st->codecpar->codec_id)
+                break;
+        if (*ids == AV_CODEC_ID_NONE)
+            goto finish;
+    }
+
     i->extract_extradata.pkt = av_packet_alloc();
     if (!i->extract_extradata.pkt)
         return AVERROR(ENOMEM);