[FFmpeg-cvslog] avcodec/ffv1enc: Fix error message when the requested version does not support the requested features

Michael Niedermayer git at videolan.org
Tue Sep 15 20:47:41 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Sep 15 20:27:14 2015 +0200| [72db5e96fc560c0b1e78099feeb3a90aa27eb7e4] | committer: Michael Niedermayer

avcodec/ffv1enc: Fix error message when the requested version does not support the requested features

Found-by: "Peter B." <pb at das-werkstatt.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/ffv1enc.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 265ced1..338cc4e 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -683,8 +683,13 @@ static av_cold int encode_init(AVCodecContext *avctx)
     if (avctx->level <= 0 && s->version == 2) {
         s->version = 3;
     }
-    if (avctx->level >= 0 && avctx->level <= 4)
-        s->version = FFMAX(s->version, avctx->level);
+    if (avctx->level >= 0 && avctx->level <= 4) {
+        if (avctx->level < s->version) {
+            av_log(avctx, AV_LOG_ERROR, "Version %d needed for requested features but %d requested\n", s->version, avctx->level);
+            return AVERROR(EINVAL);
+        }
+        s->version = avctx->level;
+    }
 
     if (s->ec < 0) {
         s->ec = (s->version >= 3);



More information about the ffmpeg-cvslog mailing list