summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2017-02-10 15:36:56 -0500
committerVittorio Giovara <vittorio.giovara@gmail.com>2017-03-07 11:07:02 -0500
commita825980f9f93af32c719497f9aab1e14248ab471 (patch)
tree6e89603faffce5f63e29b7698c31731b9bbb1243
parent6bce6aa17d7f22bf46fde0d4610a41d2af0c0e48 (diff)
mov: Export bounds and padding from spherical metadata
Update the fate test as needed. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
-rw-r--r--libavformat/mov.c27
-rw-r--r--libavformat/version.h2
-rw-r--r--tests/fate/mov.mak2
-rw-r--r--tests/ref/fate/mov-spherical6
4 files changed, 33 insertions, 4 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 2bd48079ec..c6e7a38398 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3237,6 +3237,8 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
MOVStreamContext *sc;
int size, version, layout;
int32_t yaw, pitch, roll;
+ size_t l = 0, t = 0, r = 0, b = 0;
+ size_t padding = 0;
uint32_t tag;
enum AVSphericalProjection projection;
@@ -3322,9 +3324,25 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return 0;
}
projection = AV_SPHERICAL_CUBEMAP;
+ padding = avio_rb32(pb);
break;
case MKTAG('e','q','u','i'):
- projection = AV_SPHERICAL_EQUIRECTANGULAR;
+ t = avio_rb32(pb);
+ b = avio_rb32(pb);
+ l = avio_rb32(pb);
+ r = avio_rb32(pb);
+
+ if (b >= UINT_MAX - t || r >= UINT_MAX - l) {
+ av_log(c->fc, AV_LOG_ERROR,
+ "Invalid bounding rectangle coordinates "
+ "%zu,%zu,%zu,%zu\n", l, t, r, b);
+ return AVERROR_INVALIDDATA;
+ }
+
+ if (l || t || r || b)
+ projection = AV_SPHERICAL_EQUIRECTANGULAR_TILE;
+ else
+ projection = AV_SPHERICAL_EQUIRECTANGULAR;
break;
default:
av_log(c->fc, AV_LOG_ERROR, "Unknown projection type\n");
@@ -3341,6 +3359,13 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
sc->spherical->pitch = pitch;
sc->spherical->roll = roll;
+ sc->spherical->padding = padding;
+
+ sc->spherical->bound_left = l;
+ sc->spherical->bound_top = t;
+ sc->spherical->bound_right = r;
+ sc->spherical->bound_bottom = b;
+
return 0;
}
diff --git a/libavformat/version.h b/libavformat/version.h
index 92f3407909..98faff77c0 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 57
#define LIBAVFORMAT_VERSION_MINOR 11
-#define LIBAVFORMAT_VERSION_MICRO 0
+#define LIBAVFORMAT_VERSION_MICRO 1
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak
index 57cbb1cac0..9d64fd3a4a 100644
--- a/tests/fate/mov.mak
+++ b/tests/fate/mov.mak
@@ -11,7 +11,7 @@ FATE_MOV += fate-mov-sar
fate-mov-sar: CMD = probestream sample_aspect_ratio $(TARGET_SAMPLES)/mov/displaymatrix.mov
FATE_MOV += fate-mov-spherical
-fate-mov-spherical: CMD = probestream projection,yaw,pitch,roll $(TARGET_SAMPLES)/mov/spherical.mov
+fate-mov-spherical: CMD = probestream projection,yaw,pitch,roll,left,top,right,bottom $(TARGET_SAMPLES)/mov/spherical.mov
FATE_MOV += fate-mov-stereo3d
fate-mov-stereo3d: CMD = probestream type $(TARGET_SAMPLES)/mov/spherical.mov
diff --git a/tests/ref/fate/mov-spherical b/tests/ref/fate/mov-spherical
index 760ae880e8..a3f8cdfa60 100644
--- a/tests/ref/fate/mov-spherical
+++ b/tests/ref/fate/mov-spherical
@@ -1,4 +1,8 @@
-equirectangular
+tiled equirectangular
+148
+73
+147
+72
45
30
15