[FFmpeg-cvslog] Merge commit '883ce264d9ffc5bdaf477e09ee155b03339c46a6'
James Almer
git at videolan.org
Tue Oct 24 01:06:18 EEST 2017
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Mon Oct 23 18:51:34 2017 -0300| [0acb18d298721a75f433b49030204f59b6544f27] | committer: James Almer
Merge commit '883ce264d9ffc5bdaf477e09ee155b03339c46a6'
* commit '883ce264d9ffc5bdaf477e09ee155b03339c46a6':
vf_showinfo: Display spherical properties
Merged-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0acb18d298721a75f433b49030204f59b6544f27
---
libavfilter/vf_showinfo.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 834e742fcb..e0b3223801 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -29,6 +29,7 @@
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/pixdesc.h"
+#include "libavutil/spherical.h"
#include "libavutil/stereo3d.h"
#include "libavutil/timestamp.h"
@@ -36,6 +37,43 @@
#include "internal.h"
#include "video.h"
+static void dump_spherical(AVFilterContext *ctx, AVFrame *frame, AVFrameSideData *sd)
+{
+ AVSphericalMapping *spherical = (AVSphericalMapping *)sd->data;
+ double yaw, pitch, roll;
+
+ av_log(ctx, AV_LOG_INFO, "spherical information: ");
+ 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 if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE)
+ av_log(ctx, AV_LOG_INFO, "tiled equirectangular ");
+ 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);
+
+ if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+ size_t l, t, r, b;
+ av_spherical_tile_bounds(spherical, frame->width, frame->height,
+ &l, &t, &r, &b);
+ av_log(ctx, AV_LOG_INFO, "[%zu, %zu, %zu, %zu] ", l, t, r, b);
+ } else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
+ av_log(ctx, AV_LOG_INFO, "[pad %"PRIu32"] ", spherical->padding);
+ }
+}
+
static void dump_stereo3d(AVFilterContext *ctx, AVFrameSideData *sd)
{
AVStereo3D *stereo;
@@ -128,6 +166,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
case AV_FRAME_DATA_A53_CC:
av_log(ctx, AV_LOG_INFO, "A/53 closed captions (%d bytes)", sd->size);
break;
+ case AV_FRAME_DATA_SPHERICAL:
+ dump_spherical(ctx, frame, sd);
+ break;
case AV_FRAME_DATA_STEREO3D:
dump_stereo3d(ctx, sd);
break;
======================================================================
diff --cc libavfilter/vf_showinfo.c
index 834e742fcb,d5605e6922..e0b3223801
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@@ -29,13 -29,54 +29,51 @@@
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/pixdesc.h"
+ #include "libavutil/spherical.h"
#include "libavutil/stereo3d.h"
+#include "libavutil/timestamp.h"
#include "avfilter.h"
#include "internal.h"
#include "video.h"
-typedef struct ShowInfoContext {
- unsigned int frame;
-} ShowInfoContext;
-
+ static void dump_spherical(AVFilterContext *ctx, AVFrame *frame, AVFrameSideData *sd)
+ {
+ AVSphericalMapping *spherical = (AVSphericalMapping *)sd->data;
+ double yaw, pitch, roll;
+
+ av_log(ctx, AV_LOG_INFO, "spherical information: ");
+ 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 if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE)
+ av_log(ctx, AV_LOG_INFO, "tiled equirectangular ");
+ 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);
+
+ if (spherical->projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
+ size_t l, t, r, b;
+ av_spherical_tile_bounds(spherical, frame->width, frame->height,
+ &l, &t, &r, &b);
+ av_log(ctx, AV_LOG_INFO, "[%zu, %zu, %zu, %zu] ", l, t, r, b);
+ } else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
+ av_log(ctx, AV_LOG_INFO, "[pad %"PRIu32"] ", spherical->padding);
+ }
+ }
+
static void dump_stereo3d(AVFilterContext *ctx, AVFrameSideData *sd)
{
AVStereo3D *stereo;
More information about the ffmpeg-cvslog
mailing list