Signed-off-by: Vittorio Giovara <[email protected]>
---
avprobe.c | 15 +++++++++++---
doc/APIchanges | 5 +++++
libavformat/dump.c | 10 +++++++++
libavutil/spherical.h | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++
libavutil/version.h | 2 +-
5 files changed, 84 insertions(+), 4 deletions(-)
diff --git a/avprobe.c b/avprobe.c
index a24e644..7e20da1 100644
--- a/avprobe.c
+++ b/avprobe.c
@@ -792,11 +792,20 @@ static void show_stream(InputFile *ifile, InputStream
*ist)
spherical = (AVSphericalMapping *)sd->data;
probe_object_header("spherical");
- if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR)
+ if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR) {
probe_str("projection", "equirectangular");
- else if (spherical->projection == AV_SPHERICAL_CUBEMAP)
+ } else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
probe_str("projection", "cubemap");
- else
+ probe_int("padding", spherical->padding);
+ } else if (spherical->projection ==
AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+ probe_str("projection", "tiled equirectangular");
+ probe_object_header("bounding");
+ probe_int("left", spherical->left_bound);
+ probe_int("top", spherical->top_bound);
+ probe_int("right", spherical->right_bound);
+ probe_int("bottom", spherical->bottom_bound);
+ probe_object_footer("bounding");
+ } else
probe_str("projection", "unknown");
probe_object_header("orientation");
diff --git a/doc/APIchanges b/doc/APIchanges
index c161618..f2b2d0e 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,11 @@ libavutil: 2015-08-28
API changes, most recent first:
+2017-02-10 - xxxxxxx - lavu 55.31.0 - spherical.h
+ Add AV_SPHERICAL_EQUIRECTANGULAR_TILE, and projection-specific properties
+ (left_bound, top_bound, right_bound, bottom_bound, padding) to
+ AVSphericalMapping.
+
2017-02-01 - xxxxxxx - lavc - avcodec.h
Deprecate AVCodecContext.refcounted_frames. This was useful for deprecated
API only (avcodec_decode_video2/avcodec_decode_audio4). The new decode APIs
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 660df0a..b7ae13d 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -321,6 +321,8 @@ static void dump_spherical(void *ctx, AVPacketSideData *sd)
av_log(ctx, AV_LOG_INFO, "equirectangular ");
else if (spherical->projection == AV_SPHERICAL_CUBEMAP)
av_log(ctx, AV_LOG_INFO, "cubemap ");
+ else if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE)
+ av_log(ctx, AV_LOG_INFO, "tiled equirectangular ");
else {
av_log(ctx, AV_LOG_WARNING, "unknown");
return;
@@ -330,6 +332,14 @@ static void dump_spherical(void *ctx, AVPacketSideData *sd)
pitch = ((double)spherical->pitch) / (1 << 16);
roll = ((double)spherical->roll) / (1 << 16);
av_log(ctx, AV_LOG_INFO, "(%f/%f/%f) ", yaw, pitch, roll);
+
+ if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+ av_log(ctx, AV_LOG_INFO, "[%zu, %zu, %zu, %zu] ",
+ spherical->left_bound, spherical->top_bound,
+ spherical->right_bound, spherical->bottom_bound);
+ } else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
+ av_log(ctx, AV_LOG_INFO, "[pad %zu] ", spherical->padding);
+ }
}
static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
diff --git a/libavutil/spherical.h b/libavutil/spherical.h
index 0045eb9..559f7e6 100644
--- a/libavutil/spherical.h
+++ b/libavutil/spherical.h
@@ -63,6 +63,13 @@ enum AVSphericalProjection {
* to the back.
*/
AV_SPHERICAL_CUBEMAP,
+
+ /**
+ * Video represents a portion of a sphere mapped on a flat surface
+ * using equirectangular projection. The @ref bounding fields indicate
+ * the position of the current video in a larger surface.
+ */
+ AV_SPHERICAL_EQUIRECTANGULAR_TILE,
};
/**
@@ -122,6 +129,55 @@ typedef struct AVSphericalMapping {
/**
* @}
*/
+
+ /**
+ * @name Bounding rectangle
+ * @anchor bounding
+ * @{
+ * These fields indicate the location of the current tile, and where
+ * it should be mapped relative to the original surface.
+ *
+ * @code{.unparsed}
+ * +----------------+----------+
+ * | |top_bound |
+ * | +--------+ |
+ * | left_bound |tile | |
+ * +<---------->| |<--->+right_bound
+ * | +--------+ |
+ * | | |
+ * | bottom_bound| |
+ * +----------------+----------+
+ * @endcode
+ *
+ * If needed, the original video surface dimensions can be derived
+ * by adding the current stream or frame size to the related bounds,
+ * like in the following example:
+ *
+ * @code{c}
+ * original_width = tile->width + left_bound + right_bound;
+ * original_height = tile->height + top_bound + bottom_bound;
+ * @endcode
+ *
+ * @note These values are valid only for the tiled equirectangular
+ * projection type (@ref AV_SPHERICAL_EQUIRECTANGULAR_TILE),
+ * and should be ignored in all other cases.
+ */
+ size_t left_bound; ///< Distance in pixel from the left edge
+ size_t top_bound; ///< Distance in pixel from the top edge
+ size_t right_bound; ///< Distance in pixel from the right edge
+ size_t bottom_bound; ///< Distance in pixel from the bottom edge
+ /**
+ * @}
+ */
+
+ /**
+ * Amount of pixel to pad from the edge of each cube face.
+ *
+ * @note This value is valid for only for the cubemap projection type
+ * (@ref AV_SPHERICAL_CUBEMAP), and should be ignored in all other
+ * cases.
+ */
+ size_t padding;
} AVSphericalMapping;
/**
diff --git a/libavutil/version.h b/libavutil/version.h
index 7856a0a..0fcd19a 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -54,7 +54,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 55
-#define LIBAVUTIL_VERSION_MINOR 30
+#define LIBAVUTIL_VERSION_MINOR 31
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
--
2.10.0
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel