[FFmpeg-cvslog] spherical: Change types of bounding and pad to uint32_t

Vittorio Giovara git at videolan.org
Fri Mar 17 20:59:25 EET 2017


ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Thu Mar 16 17:20:47 2017 -0400| [f20bcec4c2b1c2a57ed89e5be1ac2e0db1bc62b4] | committer: Vittorio Giovara

spherical: Change types of bounding and pad to uint32_t

These values are defined to be 32bit in the specification,
so it makes more sense to store them as fixed width.

Based on a patch by Micahel Niedermayer <michael at niedermayer.cc>.

Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f20bcec4c2b1c2a57ed89e5be1ac2e0db1bc62b4
---

 libavformat/dump.c        |  2 +-
 libavformat/matroskadec.c |  7 +++----
 libavformat/mov.c         |  8 +++-----
 libavutil/spherical.h     | 10 +++++-----
 4 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/libavformat/dump.c b/libavformat/dump.c
index 505d572..3e62183 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -375,7 +375,7 @@ static void dump_spherical(void *ctx, AVCodecParameters *par, AVPacketSideData *
                                  &l, &t, &r, &b);
         av_log(ctx, AV_LOG_INFO, "[%zu, %zu, %zu, %zu] ", l, t, r, b);
     } else if (spherical->projection == AV_SPHERICAL_CUBEMAP) {
-        av_log(ctx, AV_LOG_INFO, "[pad %zu] ", spherical->padding);
+        av_log(ctx, AV_LOG_INFO, "[pad %"PRIu32"] ", spherical->padding);
     }
 }
 
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index fdb23ab..bad034b 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1913,8 +1913,8 @@ static int mkv_parse_video_projection(AVStream *st, const MatroskaTrack *track)
     AVSphericalMapping *spherical;
     enum AVSphericalProjection projection;
     size_t spherical_size;
-    size_t l = 0, t = 0, r = 0, b = 0;
-    size_t padding = 0;
+    uint32_t l = 0, t = 0, r = 0, b = 0;
+    uint32_t padding = 0;
     int ret;
     GetByteContext gb;
 
@@ -1939,8 +1939,7 @@ static int mkv_parse_video_projection(AVStream *st, const MatroskaTrack *track)
             if (b >= UINT_MAX - t || r >= UINT_MAX - l) {
                 av_log(NULL, AV_LOG_ERROR,
                        "Invalid bounding rectangle coordinates "
-                       "%"SIZE_SPECIFIER",%"SIZE_SPECIFIER","
-                       "%"SIZE_SPECIFIER",%"SIZE_SPECIFIER"\n",
+                       "%"PRIu32",%"PRIu32",%"PRIu32",%"PRIu32"\n",
                        l, t, r, b);
                 return AVERROR_INVALIDDATA;
             }
diff --git a/libavformat/mov.c b/libavformat/mov.c
index d5c3949..5e7be49 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4637,9 +4637,8 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     MOVStreamContext *sc;
     int size, layout;
     int32_t yaw, pitch, roll;
-    size_t l = 0, t = 0, r = 0, b = 0;
-    size_t padding = 0;
-    uint32_t tag;
+    uint32_t l = 0, t = 0, r = 0, b = 0;
+    uint32_t tag, padding = 0;
     enum AVSphericalProjection projection;
 
     if (c->fc->nb_streams < 1)
@@ -4717,8 +4716,7 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         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);
+                   "%"PRIu32",%"PRIu32",%"PRIu32",%"PRIu32"\n", l, t, r, b);
             return AVERROR_INVALIDDATA;
         }
 
diff --git a/libavutil/spherical.h b/libavutil/spherical.h
index f4e0d60..a795287 100644
--- a/libavutil/spherical.h
+++ b/libavutil/spherical.h
@@ -164,10 +164,10 @@ typedef struct AVSphericalMapping {
      *       projection type (@ref AV_SPHERICAL_EQUIRECTANGULAR_TILE),
      *       and should be ignored in all other cases.
      */
-    size_t bound_left;   ///< Distance from the left edge
-    size_t bound_top;    ///< Distance from the top edge
-    size_t bound_right;  ///< Distance from the right edge
-    size_t bound_bottom; ///< Distance from the bottom edge
+    uint32_t bound_left;   ///< Distance from the left edge
+    uint32_t bound_top;    ///< Distance from the top edge
+    uint32_t bound_right;  ///< Distance from the right edge
+    uint32_t bound_bottom; ///< Distance from the bottom edge
     /**
      * @}
      */
@@ -179,7 +179,7 @@ typedef struct AVSphericalMapping {
      *       (@ref AV_SPHERICAL_CUBEMAP), and should be ignored in all other
      *       cases.
      */
-    size_t padding;
+    uint32_t padding;
 } AVSphericalMapping;
 
 /**



More information about the ffmpeg-cvslog mailing list