diff mbox

[FFmpeg-devel] avcodec/utils: only warn when passed invalid lowres value

Message ID 1470350157-90948-1-git-send-email-ffmpeg@tmm1.net
State Accepted
Commit b5f30fe8fea586545b140abbd0602188b09d3133
Headers show

Commit Message

Aman Karmani Aug. 4, 2016, 10:35 p.m. UTC
From: Aman Gupta <aman@tmm1.net>

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.
---
 libavcodec/utils.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Michael Niedermayer Aug. 12, 2016, 2:34 p.m. UTC | #1
On Thu, Aug 04, 2016 at 03:35:57PM -0700, Aman Gupta wrote:
> From: Aman Gupta <aman@tmm1.net>
> 
> 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.
> ---
>  libavcodec/utils.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

as video decoders can change their resolution at any time, this should
be ok thus
applied

thx

[...]
Carl Eugen Hoyos Aug. 13, 2016, 10:13 a.m. UTC | #2
Hi!

2016-08-05 0:35 GMT+02:00 Aman Gupta <ffmpeg@tmm1.net>:
> From: Aman Gupta <aman@tmm1.net>
>
> 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.

Was this a regression?

Thank you for the fix, Carl Eugen
diff mbox

Patch

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index f7adb52..783f62c 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -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