summaryrefslogtreecommitdiffstats
path: root/demux/demux_lavf.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-08-21 14:56:07 +0200
committerwm4 <wm4@nowhere>2017-08-21 14:56:07 +0200
commit028faacff56d7f90f6b119b0b0ac686fd614825f (patch)
tree33d77aa61946f3bebfdb28fa8670065fdb79aed8 /demux/demux_lavf.c
parent82d9419f62c90cecc13c492e3b68feebe0229daa (diff)
downloadmpv-028faacff56d7f90f6b119b0b0ac686fd614825f.tar.bz2
mpv-028faacff56d7f90f6b119b0b0ac686fd614825f.tar.xz
video: add metadata handling for spherical video
This adds handling of spherical video metadata: retrieving it from demux_lavf and demux_mkv, passing it through filters, and adjusting it with vf_format. This does not include support for rendering this type of video. We don't expect we need/want to support the other projection types like cube maps, so we don't include that for now. They can be added later as needed. Also raise the maximum sizes of stringified image params, since they can get really long.
Diffstat (limited to 'demux/demux_lavf.c')
-rw-r--r--demux/demux_lavf.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index f890b5d693..e61529fb71 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -38,6 +38,10 @@
#include <libavutil/display.h>
#include <libavutil/opt.h>
+#if HAVE_AVUTIL_SPHERICAL
+#include <libavutil/spherical.h>
+#endif
+
#include "common/msg.h"
#include "common/tags.h"
#include "common/av_common.h"
@@ -641,6 +645,19 @@ static void handle_new_stream(demuxer_t *demuxer, int i)
sh->codec->rotate = (((int)(-r) % 360) + 360) % 360;
}
+#if HAVE_AVUTIL_SPHERICAL
+ sd = av_stream_get_side_data(st, AV_PKT_DATA_SPHERICAL, NULL);
+ if (sd) {
+ AVSphericalMapping *sp = (void *)sd;
+ struct mp_spherical_params *mpsp = &sh->codec->spherical;
+ mpsp->type = sp->projection == AV_SPHERICAL_EQUIRECTANGULAR ?
+ MP_SPHERICAL_EQUIRECTANGULAR : MP_SPHERICAL_UNKNOWN;
+ mpsp->ref_angles[0] = sp->yaw / (float)(1 << 16);
+ mpsp->ref_angles[1] = sp->pitch / (float)(1 << 16);
+ mpsp->ref_angles[2] = sp->roll / (float)(1 << 16);
+ }
+#endif
+
// This also applies to vfw-muxed mkv, but we can't detect these easily.
sh->codec->avi_dts = matches_avinputformat_name(priv, "avi");