[FFmpeg-cvslog] lavf: check that the codec is supported by extract_extradata

Anton Khirnov git at videolan.org
Fri Mar 24 00:43:30 EET 2017


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue Oct 18 20:50:03 2016 +0200| [096a8effa3f8f3455292c958c3ed07e798def7bd] | committer: Anton Khirnov

lavf: check that the codec is supported by extract_extradata

Avoids superfluous error message spam after
8e2ea691351c5079cdab245ff7bfa5c0f3e3bfe4

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=096a8effa3f8f3455292c958c3ed07e798def7bd
---

 libavformat/utils.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 1c93326..37ba5a8 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -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);



More information about the ffmpeg-cvslog mailing list