summaryrefslogtreecommitdiff
path: root/libavformat/dump.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2016-11-11 17:37:43 -0500
committerVittorio Giovara <vittorio.giovara@gmail.com>2016-12-07 14:40:06 -0500
commite7a6f8c972a0b5b98ef7bbf393e95c434e9e2539 (patch)
tree42c66d8d8c6d25467241d92b68b111b33dd55d7c /libavformat/dump.c
parent8f58ecc344a92e63193c38e28c173be987954bbb (diff)
lavc: Add spherical packet side data API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavformat/dump.c')
-rw-r--r--libavformat/dump.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 2a2f6fd023..d9aa3afe58 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -31,6 +31,7 @@
#include "libavutil/opt.h"
#include "libavutil/avstring.h"
#include "libavutil/replaygain.h"
+#include "libavutil/spherical.h"
#include "libavutil/stereo3d.h"
#include "avformat.h"
@@ -342,6 +343,31 @@ static void dump_mastering_display_metadata(void *ctx, AVPacketSideData* sd) {
av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance));
}
+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;
@@ -393,6 +419,10 @@ static void dump_sidedata(void *ctx, AVStream *st, const char *indent)
case AV_PKT_DATA_MASTERING_DISPLAY_METADATA:
dump_mastering_display_metadata(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_INFO,
"unknown side data type %d (%d bytes)", sd.type, sd.size);