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

Vittorio Giovara vittorio.giovara at gmail.com
Mon Apr 3 12:18:40 EEST 2017


On Fri, Mar 31, 2017 at 7:15 PM, James Almer <jamrial at gmail.com> wrote:
> On 3/31/2017 5:42 AM, Vittorio Giovara wrote:
>> On Wed, Mar 29, 2017 at 4:55 AM, James Almer <jamrial at gmail.com> 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(+)
>>
>> version bump
>>
>>> diff --git a/doc/APIchanges b/doc/APIchanges
>>> index 2274543024..5f3c268d05 100644
>>> --- a/doc/APIchanges
>>> +++ b/doc/APIchanges
>>> @@ -15,6 +15,9 @@ libavutil:     2015-08-28
>>>
>>>  API changes, most recent first:
>>>
>>> +2017-xx-xx - xxxxxxx - lavu 55.xx.xxx - spherical.h
>>> +  Add av_spherical_projection_name()
>>
>> nit: full stop
>>
>>> +
>>>  2017-03-xx - xxxxxxx - lavf 57.68.100 - avformat.h
>>>    Deprecate that demuxers export the stream rotation angle in AVStream.metadata
>>>    (via an entry named "rotate"). Use av_stream_get_side_data() with
>>> diff --git a/libavutil/spherical.h b/libavutil/spherical.h
>>> index a7952875af..2c8dd3cd97 100644
>>> --- a/libavutil/spherical.h
>>> +++ b/libavutil/spherical.h
>>> @@ -206,6 +206,15 @@ void av_spherical_tile_bounds(const AVSphericalMapping *map,
>>>                                size_t width, size_t height,
>>>                                size_t *left, size_t *top,
>>>                                size_t *right, size_t *bottom);
>>> +
>>> +/**
>>> + * Provide a human-readable name of a given AVSphericalProjection.
>>> + *
>>> + * @param projection The input AVSphericalProjection.
>>> + *
>>> + * @return The name of the AVSphericalProjection, or "unknown".
>>> + */
>>> +const char *av_spherical_projection_name(enum AVSphericalProjection projection);
>>
>> ./ffmpeg/libavutil/spherical.c:59:14: warning: comparison of
>>       constant 8 with expression of type 'enum AVSphericalProjection'
>> is always false
>>       [-Wtautological-constant-out-of-range-compare]
>>     if (type >= FF_ARRAY_ELEMS(spherical_projection_names))
>>
>> you gotta use unsigned int as the first argument
>
> I went with Benoit's suggestion to cast projection to unsigned instead.
> https://ffmpeg.org/pipermail/ffmpeg-devel/2017-March/209394.html

That works too, in the code sometimes we use one way sometimes we use the other.

>> not required but nice to have would be the opposite function so that
>> you can get the projection type from a string.
>
> Sure, done and pushed. Thanks.

Looking forward to see the patches that keep API aligned across lavu providers.
-- 
Vittorio


More information about the ffmpeg-devel mailing list