[FFmpeg-devel] [PATCH 1/3] avutil/spherical: add av_spherical_projection_name()
James Almer
jamrial at gmail.com
Wed Mar 29 05:55:55 EEST 2017
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/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()
+
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.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";
+
+ return spherical_projection_names[projection];
+}
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);
/**
* @}
* @}
--
2.12.1
More information about the ffmpeg-devel
mailing list