[FFmpeg-devel] [PATCH 1/3] avutil/spherical: add av_spherical_projection_name()
Benoit Fouet
benoit.fouet at free.fr
Thu Mar 30 10:14:07 EEST 2017
Hi,
On 29/03/2017 04:55, James Almer wrote:
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> doc/APIchanges | 3 +++
> libavutil/spherical.c | 15 +++++++++++++++
> libavutil/spherical.h | 9 +++++++++
> 3 files changed, 27 insertions(+)
>
[...]
> diff --git a/libavutil/spherical.c b/libavutil/spherical.c
> index f0b622128a..1d06e7c552 100644
> --- a/libavutil/spherical.c
> +++ b/libavutil/spherical.c
> @@ -50,3 +50,18 @@ void av_spherical_tile_bounds(const AVSphericalMapping *map,
> *right = orig_width - width - *left;
> *bottom = orig_height - height - *top;
> }
> +
> +static const char *spherical_projection_names[] = {
> + [AV_SPHERICAL_EQUIRECTANGULAR] = "equirectangular",
> + [AV_SPHERICAL_CUBEMAP] = "cubemap",
> + [AV_SPHERICAL_EQUIRECTANGULAR_TILE] = "tiled equirectangular",
> +
> +};
> +
> +const char *av_spherical_projection_name(enum AVSphericalProjection projection)
> +{
> + if (projection >= FF_ARRAY_ELEMS(spherical_projection_names))
> + return "unknown";
> +
You should also check for projection to be negative, or cast it to
unsigned when checking.
--
Ben
More information about the ffmpeg-devel
mailing list