[FFmpeg-devel] [PATCH 1/5] avutil/spherical: Add more spherical types

James Almer jamrial at gmail.com
Tue Jun 11 21:44:48 EEST 2024


On 6/10/2024 3:44 PM, Derek Buitenhuis wrote:
> These originate from the Apple Vision Pro, and are documented here:
> 
>      https://developer.apple.com/documentation/coremedia/cmprojectiontype
> 
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> ---
>   libavutil/spherical.c |  3 +++
>   libavutil/spherical.h | 16 ++++++++++++++++
>   2 files changed, 19 insertions(+)
> 
> diff --git a/libavutil/spherical.c b/libavutil/spherical.c
> index 800d3459a5..d78f98f945 100644
> --- a/libavutil/spherical.c
> +++ b/libavutil/spherical.c
> @@ -57,6 +57,9 @@ static const char *const spherical_projection_names[] = {
>       [AV_SPHERICAL_EQUIRECTANGULAR]      = "equirectangular",
>       [AV_SPHERICAL_CUBEMAP]              = "cubemap",
>       [AV_SPHERICAL_EQUIRECTANGULAR_TILE] = "tiled equirectangular",
> +    [AV_SPHERICAL_HALF_EQUIRECTANGULAR] = "half equirectangular",
> +    [AV_SPHERICAL_RECTANGULAR]          = "rectangular",
> +    [AV_SPHERICAL_FISHEYE]              = "fisheye",
>   };
>   
>   const char *av_spherical_projection_name(enum AVSphericalProjection projection)
> diff --git a/libavutil/spherical.h b/libavutil/spherical.h
> index 828ac836da..118fbcc3d1 100644
> --- a/libavutil/spherical.h
> +++ b/libavutil/spherical.h
> @@ -66,6 +66,22 @@ enum AVSphericalProjection {
>        * the position of the current video in a larger surface.
>        */
>       AV_SPHERICAL_EQUIRECTANGULAR_TILE,
> +
> +    /**
> +     * Video frame displays as a 180 degree equirectangular projection.
> +     */
> +    AV_SPHERICAL_HALF_EQUIRECTANGULAR,
> +
> +    /**
> +     * Video contentframe displays on a flat, rectangular 2D surface.
> +     */
> +    AV_SPHERICAL_RECTANGULAR,

This should ideally be the enum with value 0, but until next major when 
such a change can happen, it would be IMO a good idea if you set 
spherical->projection to AV_SPHERICAL_RECTANGULAR in av_spherical_alloc().

> +
> +    /**
> +     * Fisheye projection (Apple).
> +     * See: https://developer.apple.com/documentation/coremedia/cmprojectiontype/fisheye
> +     */
> +    AV_SPHERICAL_FISHEYE,
>   };
>   
>   /**


More information about the ffmpeg-devel mailing list