avcodec/utils: only warn when passed invalid lowres value

This makes it easier to use the lowres option when dealing with input
files in different codecs. If the codec doesn't support lowres=1 for
instance, it will throw a warning and use lowres=0 instead of erroring
out completely.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Aman Gupta 2016-08-04 15:35:57 -07:00 committed by Michael Niedermayer
parent e8b355a028
commit b5f30fe8fe

View File

@ -1389,10 +1389,9 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
avctx->thread_count = 1;
if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) {
av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n",
av_log(avctx, AV_LOG_WARNING, "The maximum value for lowres supported by the decoder is %d\n",
avctx->codec->max_lowres);
ret = AVERROR(EINVAL);
goto free_and_end;
avctx->lowres = avctx->codec->max_lowres;
}
#if FF_API_VISMV