summaryrefslogtreecommitdiff
path: root/libavcodec/ffv1enc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-09-15 20:27:14 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-09-15 20:46:04 +0200
commit72db5e96fc560c0b1e78099feeb3a90aa27eb7e4 (patch)
tree1968842345e22b50ae286d8468cdc3f2c23b368e /libavcodec/ffv1enc.c
parent0f711126b83eb98be508d5cbc058ea22ce6e941e (diff)
avcodec/ffv1enc: Fix error message when the requested version does not support the requested features
Found-by: "Peter B." <pb@das-werkstatt.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/ffv1enc.c')
-rw-r--r--libavcodec/ffv1enc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 265ced1172..338cc4e3c1 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);