On Wed, 20 Sep 2017 14:23:32 +0200
Vittorio Giovara <vittorio.giov...@gmail.com> wrote:

> Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
> ---
> Updated following review.
> Vittorio
> 
>  libavutil/pixdesc.c | 65 
> +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  libavutil/pixdesc.h | 25 +++++++++++++++++++++
>  2 files changed, 90 insertions(+)
> 
> diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> index 33aa2d705f..26e208a947 100644
> --- a/libavutil/pixdesc.c
> +++ b/libavutil/pixdesc.c
> @@ -2749,26 +2749,91 @@ const char *av_color_range_name(enum AVColorRange 
> range)
>          color_range_names[range] : NULL;
>  }
>  
> +int av_color_range_from_name(const char *name)
> +{
> +    int i;
> +
> +    for (i = 0; i < FF_ARRAY_ELEMS(color_range_names); i++) {
> +        size_t len = strlen(color_range_names[i]);
> +        if (!strncmp(color_range_names[i], name, len))
> +            return i;
> +    }
> +
> +    return AVERROR(ENOSYS);
> +}

To be honest, ENOSYS is even more confusing than -1. Think about what
happens if someone converts the error to a string and displays that to
a user.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to