diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2017-02-10 15:36:56 -0500 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2017-03-07 11:25:37 -0500 |
commit | 022b4ea5837bb79b9fe32bf707c3117be8e6d730 (patch) | |
tree | 34a4c608e5c12895369ee3d09e91b3ef98e2b6ee /libavformat/mov.c | |
parent | 1b7ffddb3a999f37443c58232b112534c0abcf28 (diff) | |
download | ffmpeg-022b4ea5837bb79b9fe32bf707c3117be8e6d730.tar.gz |
mov: Export bounds and padding from spherical metadata
Update the fate test as needed.
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r-- | libavformat/mov.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 2a7cbfe142..cc098cd977 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -4637,6 +4637,8 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom) MOVStreamContext *sc; int size; 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; @@ -4698,9 +4700,26 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom) switch (tag) { case MKTAG('c','b','m','p'): 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 %"SIZE_SPECIFIER"," + "%"SIZE_SPECIFIER",%"SIZE_SPECIFIER",%"SIZE_SPECIFIER"\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"); @@ -4717,6 +4736,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; } |