[FFmpeg-devel] [PATCH 1/3] avutil/spherical: add av_spherical_projection_name()

James Almer jamrial at gmail.com
Thu Mar 30 17:12:05 EEST 2017


On 3/30/2017 4:14 AM, Benoit Fouet wrote:
> 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.

Changed locally, thanks.



More information about the ffmpeg-devel mailing list