On Thu, Apr 20, 2017 at 11:40 AM, Vittorio Giovara
<vittorio.giov...@gmail.com> wrote:
> From: James Almer <jamr...@gmail.com>
>
> Signed-off-by: James Almer <jamr...@gmail.com>
> Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
> ---
> Hopefully this is the version everyone can compromise on.
> Vittorio
>
>  doc/APIchanges        |  4 ++++
>  libavutil/spherical.c | 28 ++++++++++++++++++++++++++++
>  libavutil/spherical.h | 18 ++++++++++++++++++
>  libavutil/version.h   |  2 +-
>  4 files changed, 51 insertions(+), 1 deletion(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index a0ca3b7ac0..09b4b31557 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -13,6 +13,10 @@ libavutil:     2017-03-23
>
>  API changes, most recent first:
>
> +2017-04-xx - xxxxxxx - lavu 56.1.0 - spherical.h
> +  Add av_spherical_projection_name().
> +  Add av_spherical_from_name().
> +
>  2017-03-xx - xxxxxxx - lavc 57.37.0 - avcodec.h
>    Add AVCodecContext.hwaccel_flags field. This will control some hwaccels at
>    a later point.
> diff --git a/libavutil/spherical.c b/libavutil/spherical.c
> index f5accc487d..30c94951f1 100644
> --- a/libavutil/spherical.c
> +++ b/libavutil/spherical.c
> @@ -18,6 +18,7 @@
>   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
>   */
>
> +#include "common.h"
>  #include "mem.h"
>  #include "spherical.h"
>
> @@ -50,3 +51,30 @@ void av_spherical_tile_bounds(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 ((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 AVERROR(ENOSYS);

changed to EINVAL as per other thread
queuing this and the other two patches unless any objections arise
-- 
Vittorio
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to