summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2016-11-02 11:28:54 -0400
committerVittorio Giovara <vittorio.giovara@gmail.com>2016-12-07 14:34:34 -0500
commit2fb6acd9c28907e4f8c0510099a4603ea6caf861 (patch)
tree3b5b5f49e6918eefdda53c34b6354eeeb27e5639 /libavformat
parentc70add61d1551bf31734f7ef7d87824ff5389280 (diff)
lavc: Add spherical packet side data API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/dump.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 3b50f5d944..660df0a533 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,31 @@ static void dump_cpb(void *ctx, AVPacketSideData *sd)
cpb->vbv_delay);
}
+static void dump_spherical(void *ctx, AVPacketSideData *sd)
+{
+ AVSphericalMapping *spherical = (AVSphericalMapping *)sd->data;
+ double yaw, pitch, roll;
+
+ 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;
+ }
+
+ yaw = ((double)spherical->yaw) / (1 << 16);
+ pitch = ((double)spherical->pitch) / (1 << 16);
+ roll = ((double)spherical->roll) / (1 << 16);
+ av_log(ctx, AV_LOG_INFO, "(%f/%f/%f) ", yaw, pitch, roll);
+}
+
static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
{
int i;
@@ -354,6 +380,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);