aboutsummaryrefslogtreecommitdiffhomepage
path: root/video/filter
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2017-08-21 14:56:07 +0200
committerGravatar wm4 <wm4@nowhere>2017-08-21 14:56:07 +0200
commit028faacff56d7f90f6b119b0b0ac686fd614825f (patch)
tree33d77aa61946f3bebfdb28fa8670065fdb79aed8 /video/filter
parent82d9419f62c90cecc13c492e3b68feebe0229daa (diff)
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 'video/filter')
-rw-r--r--video/filter/vf.c2
-rw-r--r--video/filter/vf_format.c15
2 files changed, 16 insertions, 1 deletions
diff --git a/video/filter/vf.c b/video/filter/vf.c
index a126007498..0db6f2a286 100644
--- a/video/filter/vf.c
+++ b/video/filter/vf.c
@@ -224,7 +224,7 @@ void vf_print_filter_chain(struct vf_chain *c, int msglevel,
return;
for (vf_instance_t *f = c->first; f; f = f->next) {
- char b[128] = {0};
+ char b[256] = {0};
mp_snprintf_cat(b, sizeof(b), " [%s] ", f->full_name);
if (f->label)
mp_snprintf_cat(b, sizeof(b), "\"%s\" ", f->label);
diff --git a/video/filter/vf_format.c b/video/filter/vf_format.c
index 1953b61ab6..581bbe332f 100644
--- a/video/filter/vf_format.c
+++ b/video/filter/vf_format.c
@@ -19,6 +19,7 @@
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
+#include <math.h>
#include <libavutil/rational.h>
@@ -46,6 +47,8 @@ struct vf_priv_s {
int rotate;
int dw, dh;
double dar;
+ int spherical;
+ float spherical_ref_angles[3];
};
static bool is_compatible(int fmt1, int fmt2)
@@ -127,6 +130,13 @@ static int reconfig(struct vf_instance *vf, struct mp_image_params *in,
dsize = av_d2q(p->dar, INT_MAX);
mp_image_params_set_dsize(out, dsize.num, dsize.den);
+ if (p->spherical)
+ out->spherical.type = p->spherical;
+ for (int n = 0; n < 3; n++) {
+ if (isfinite(p->spherical_ref_angles[n]))
+ out->spherical.ref_angles[n] = p->spherical_ref_angles[n];
+ }
+
// Make sure the user-overrides are consistent (no RGB csp for YUV, etc.).
mp_image_params_guess_csp(out);
@@ -165,6 +175,10 @@ static const m_option_t vf_opts_fields[] = {
OPT_INT("dw", dw, 0),
OPT_INT("dh", dh, 0),
OPT_DOUBLE("dar", dar, 0),
+ OPT_CHOICE_C("spherical", spherical, 0, mp_spherical_names),
+ OPT_FLOAT("spherical-yaw", spherical_ref_angles[0], 0),
+ OPT_FLOAT("spherical-pitch", spherical_ref_angles[1], 0),
+ OPT_FLOAT("spherical-roll", spherical_ref_angles[2], 0),
OPT_REMOVED("outputlevels", "use the --video-output-levels global option"),
OPT_REMOVED("peak", "use sig-peak instead (changed value scale!)"),
{0}
@@ -178,5 +192,6 @@ const vf_info_t vf_info_format = {
.options = vf_opts_fields,
.priv_defaults = &(const struct vf_priv_s){
.rotate = -1,
+ .spherical_ref_angles = {NAN, NAN, NAN},
},
};