Re: [libav-devel] [PATCH 1/3] avutil/spherical: add functions to retrieve and request projection names

2017-04-07 Thread Luca Barbato
On 04/04/2017 22:24, James Almer wrote:
> +const char *av_spherical_projection_name(enum AVSphericalProjection 
> projection)
> +{
> +if ((unsigned)projection >= FF_ARRAY_ELEMS(spherical_projection_names))
> +return "unknown";
> +
> +return spherical_projection_names[projection];
> +}
> +
> +int av_spherical_from_name(const char *name)
> +{
> +int i;
> +
> +for (i = 0; i < FF_ARRAY_ELEMS(spherical_projection_names); i++) {
> +size_t len = strlen(spherical_projection_names[i]);
> +if (!strncmp(spherical_projection_names[i], name, len))
> +return i;
> +}
> +
> +return -1;
> +}

Having an explicit NONE or UNKNOWN with the negative value sounds
better. Then av_spherical_from_name can output the enum directly...

lu
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 1/3] avutil/spherical: add functions to retrieve and request projection names

2017-04-06 Thread Vittorio Giovara
On Tue, Apr 4, 2017 at 10:24 PM, James Almer  wrote:
> Signed-off-by: James Almer 
> ---
>  doc/APIchanges|  4 
>  libavutil/spherical.c | 28 
>  libavutil/spherical.h | 18 ++
>  libavutil/version.h   |  2 +-
>  4 files changed, 51 insertions(+), 1 deletion(-)

The set looks good to me, thank you
-- 
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel