[FFmpeg-devel] [PATCH 2/3] libx265: Return proper invalid data code

James Almer jamrial at gmail.com
Tue Feb 17 23:10:32 CET 2015


On 17/02/15 7:02 PM, Derek Buitenhuis wrote:
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> ---
>  libavcodec/libx265.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
> index 9f40e95..c35f6c2 100644
> --- a/libavcodec/libx265.c
> +++ b/libavcodec/libx265.c
> @@ -99,7 +99,7 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
>  
>      if (x265_param_default_preset(ctx->params, ctx->preset, ctx->tune) < 0) {
>          av_log(avctx, AV_LOG_ERROR, "Invalid preset or tune.\n");
> -        return AVERROR(EINVAL);
> +        return AVERROR_INVALIDDATA;

Afaik, if the error is based on user input then EINVAL (Invalid argument) is correct.
AVERROR_INVALIDDATA is when the error is in the bitstream/container and not an argument the 
user passed to the library.

>      }
>  
>      ctx->params->frameNumThreads = avctx->thread_count;
> 



More information about the ffmpeg-devel mailing list