Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
---
No particular change.
Vittorio

 avprobe.c            | 28 ++++++++++++++++++++++++++++
 doc/APIchanges       |  4 ++++
 libavcodec/avcodec.h |  6 ++++++
 libavcodec/utils.c   |  1 +
 libavcodec/version.h |  4 ++--
 libavformat/dump.c   | 32 ++++++++++++++++++++++++++++++++
 6 files changed, 73 insertions(+), 2 deletions(-)

diff --git a/avprobe.c b/avprobe.c
index ff28a0b..24233ff 100644
--- a/avprobe.c
+++ b/avprobe.c
@@ -27,6 +27,7 @@
 #include "libavutil/display.h"
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
+#include "libavutil/spherical.h"
 #include "libavutil/stereo3d.h"
 #include "libavutil/dict.h"
 #include "libavutil/libm.h"
@@ -766,6 +767,7 @@ static void show_stream(InputFile *ifile, InputStream *ist)
         for (i = 0; i < stream->nb_side_data; i++) {
             const AVPacketSideData* sd = &stream->side_data[i];
             AVStereo3D *stereo;
+            AVSphericalMapping *spherical;
 
             switch (sd->type) {
             case AV_PKT_DATA_DISPLAYMATRIX:
@@ -786,6 +788,32 @@ static void show_stream(InputFile *ifile, InputStream *ist)
                           !!(stereo->flags & AV_STEREO3D_FLAG_INVERT));
                 probe_object_footer("stereo3d");
                 break;
+            case AV_PKT_DATA_SPHERICAL:
+                spherical = (AVSphericalMapping *)sd->data;
+                probe_object_header("spherical");
+
+                if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR)
+                    probe_str("projection", "equirectangular");
+                else if (spherical->projection == AV_SPHERICAL_CUBEMAP)
+                    probe_str("projection", "cubemap");
+                else
+                    probe_str("projection", "unknown");
+
+                probe_object_header("orientation");
+                probe_int("yaw", spherical->yaw);
+                probe_int("pitch", spherical->pitch);
+                probe_int("roll", spherical->roll);
+                probe_object_footer("orientation");
+
+                probe_object_header("offset");
+                probe_int("left", spherical->left_off);
+                probe_int("top", spherical->top_off);
+                probe_int("right", spherical->right_off);
+                probe_int("bottom", spherical->bottom_off);
+                probe_object_footer("offset");
+
+                probe_object_footer("spherical");
+                break;
             }
         }
         probe_object_footer("sidedata");
diff --git a/doc/APIchanges b/doc/APIchanges
index b34d475..f3f3eae 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,10 @@ libavutil:     2015-08-28
 
 API changes, most recent first:
 
+2016-xx-xx - xxxxxxx - lavc 57.30.0 - avcodec.h
+  Add AV_PKT_DATA_SPHERICAL packet side data to export AVSphericalMapping
+  information from containers.
+
 2016-xx-xx - xxxxxxx - lavu 55.28.0 - spherical.h
   Add AV_FRAME_DATA_SPHERICAL, av_spherical_alloc() and AVSphericalMapping
   type to export and describe spherical video properties.
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 88e6c62..47506a4 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1289,6 +1289,12 @@ enum AVPacketSideDataType {
      * This side data corresponds to the AVCPBProperties struct.
      */
     AV_PKT_DATA_CPB_PROPERTIES,
+
+    /**
+     * This side data should be associated with a video stream and corresponds
+     * to the AVSphericalMapping structure.
+     */
+    AV_PKT_DATA_SPHERICAL,
 };
 
 typedef struct AVPacketSideData {
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 329233d..549bf81 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -544,6 +544,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame 
*frame)
         { AV_PKT_DATA_REPLAYGAIN ,   AV_FRAME_DATA_REPLAYGAIN },
         { AV_PKT_DATA_DISPLAYMATRIX, AV_FRAME_DATA_DISPLAYMATRIX },
         { AV_PKT_DATA_STEREO3D,      AV_FRAME_DATA_STEREO3D },
+        { AV_PKT_DATA_SPHERICAL,     AV_FRAME_DATA_SPHERICAL },
         { AV_PKT_DATA_AUDIO_SERVICE_TYPE, AV_FRAME_DATA_AUDIO_SERVICE_TYPE },
     };
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index a4856bf..adab9b4 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,8 +28,8 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR 57
-#define LIBAVCODEC_VERSION_MINOR 28
-#define LIBAVCODEC_VERSION_MICRO  2
+#define LIBAVCODEC_VERSION_MINOR 30
+#define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 3b50f5d..44cf910 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -27,6 +27,7 @@
 #include "libavutil/log.h"
 #include "libavutil/mathematics.h"
 #include "libavutil/replaygain.h"
+#include "libavutil/spherical.h"
 #include "libavutil/stereo3d.h"
 
 #include "avformat.h"
@@ -306,6 +307,33 @@ static void dump_cpb(void *ctx, AVPacketSideData *sd)
            cpb->vbv_delay);
 }
 
+static void dump_spherical(void *ctx, AVPacketSideData *sd)
+{
+    AVSphericalMapping *spherical = (AVSphericalMapping *)sd->data;
+
+    if (sd->size < sizeof(*spherical)) {
+        av_log(ctx, AV_LOG_INFO, "invalid data");
+        return;
+    }
+
+    if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR)
+        av_log(ctx, AV_LOG_INFO, "equirectangular ");
+    else if (spherical->projection == AV_SPHERICAL_CUBEMAP)
+        av_log(ctx, AV_LOG_INFO, "cubemap ");
+    else {
+        av_log(ctx, AV_LOG_WARNING, "unknown");
+        return;
+    }
+
+    av_log(ctx, AV_LOG_INFO, "(%f/%f/%f) ",
+           spherical->yaw, spherical->pitch, spherical->roll);
+
+    if (spherical->left_off || spherical->top_off ||
+        spherical->right_off || spherical->bottom_off)
+        av_log(ctx, AV_LOG_INFO, "[%d-%d-%d-%d] ", spherical->left_off,
+               spherical->top_off, spherical->right_off, 
spherical->bottom_off);
+}
+
 static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
 {
     int i;
@@ -354,6 +382,10 @@ static void dump_sidedata(void *ctx, AVStream *st, const 
char *indent)
             av_log(ctx, AV_LOG_INFO, "cpb: ");
             dump_cpb(ctx, &sd);
             break;
+        case AV_PKT_DATA_SPHERICAL:
+            av_log(ctx, AV_LOG_INFO, "spherical: ");
+            dump_spherical(ctx, &sd);
+            break;
         default:
             av_log(ctx, AV_LOG_WARNING,
                    "unknown side data type %d (%d bytes)", sd.type, sd.size);
-- 
2.10.0

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to