On Tue, Feb 28, 2017 at 10:58 AM, Vittorio Giovara
<vittorio.giov...@gmail.com> wrote:
> Update the fate test as needed.
>
> Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
> ---
>  libavformat/mov.c            | 28 +++++++++++++++++++++++++++-
>  tests/fate/mov.mak           |  2 +-
>  tests/ref/fate/mov-spherical |  6 +++++-
>  3 files changed, 33 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index f406831..d5ac6d2 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;
>      int32_t yaw, pitch, roll;
> +    size_t l, t, r, b;
> +    size_t padding = 0;
>      uint32_t tag;
>      enum AVSphericalProjection projection;
>
> @@ -3316,9 +3318,25 @@ 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 "
> +                   "%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");
> @@ -3335,6 +3353,14 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext 
> *pb, MOVAtom atom)
>      sc->spherical->pitch = pitch;
>      sc->spherical->roll  = roll;
>
> +    sc->spherical->padding = padding;
> +
> +    if (projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
> +        sc->spherical->bound_left   = l;
> +        sc->spherical->bound_top    = t;
> +        sc->spherical->bound_right  = r;
> +        sc->spherical->bound_bottom = b;
> +    }
>      return 0;

Similar to mkv, this has a local modification

-    if (projection == AV_SPHERICAL_EQUIRECTANGULAR_TILE) {
-        sc->spherical->bound_left   = l;
-        sc->spherical->bound_top    = t;
-        sc->spherical->bound_right  = r;
-        sc->spherical->bound_bottom = b;
-    }
+    sc->spherical->bound_left   = l;
+    sc->spherical->bound_top    = t;
+    sc->spherical->bound_right  = r;
+    sc->spherical->bound_bottom = b;

-- 
Vittorio
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to