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

Reply via email to