From patchwork Fri Mar 17 15:47:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vittorio Giovara X-Patchwork-Id: 2991 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.50.79 with SMTP id y76csp320460vsy; Fri, 17 Mar 2017 08:53:41 -0700 (PDT) X-Received: by 10.223.130.214 with SMTP id 80mr14218131wrc.43.1489766021185; Fri, 17 Mar 2017 08:53:41 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z64si11654588wrc.261.2017.03.17.08.53.40; Fri, 17 Mar 2017 08:53:41 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 22867688343; Fri, 17 Mar 2017 17:53:21 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk0-f194.google.com (mail-qk0-f194.google.com [209.85.220.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 983356882CF for ; Fri, 17 Mar 2017 17:53:14 +0200 (EET) Received: by mail-qk0-f194.google.com with SMTP id o135so10285872qke.2 for ; Fri, 17 Mar 2017 08:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=U2QvWhkGXIXZBiGJKTwN4rcvdZDb/H7eLGKaeQdGBNk=; b=rouyURlYPBQqj33xw+td4uMV6HFHtNf2+mHcY/BzfukdCU5/VdGdB1F+flSDGdRgUx qFqiNkxBw/F8UxFvrFlRduqGF70YJQ1cJjJMDoLdELvESMFIThgV2xP1/0DTP3+5cvxB oaVB4yQsoI4mVOln0MwxANow97jGx0gIZqYzL42bFHBBLjMZYN1W/Xkj7GBhwOGvyxcy xtrMt0WTLdyolLULkANzUUpHQ8y2hK4kG8zmgq/k+2IgNCFvhup/9T9aU4Q963c5y3HE p24cgKea+YGdB/nQRo4bRLGgQFiiclCniGhvCZ5vHSWxQkUJOEDoZkSrHxq61zyra4ec xgaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=U2QvWhkGXIXZBiGJKTwN4rcvdZDb/H7eLGKaeQdGBNk=; b=jvpYSTyul/84uaVqmUANpMlxe+kzMUyrZgXD2JVstXjMkAGwZecAkVvjAUg7LTO656 ykSoq2sjbRE5OuNwCQRZjBK5+z1kPE9LMtc1cdW4KouA26zuCncVq5ED66ARlA7KENw3 JvyEbPhSeFveELf+FwIHjD/Gb2HYlICOiRhYiqvG1yCt/E9AT1slqCNI5YczCGmMMtG1 Pb7suJBqxEbgafHnhRaJk6GyFGLvGcdbsRnxjxhpVlZqBgkDKbLQVj10n4Hx1bbF+XTK sVaZYBkMy/XGi70IbqthKgv/aNdcdpWtdawD9X0rt8HHwxElJZuJxJqqMuv9Intgr1Lp KJvg== X-Gm-Message-State: AFeK/H1vBGf8Ae95sZjDdIUs5HCCQ/DVjK05W6FrRVSZ7JZ5OgqpkcIGQwfquJ1vn7w6wg== X-Received: by 10.55.161.13 with SMTP id k13mr15224122qke.265.1489765652509; Fri, 17 Mar 2017 08:47:32 -0700 (PDT) Received: from vimacbookpro.vimeows.com ([8.40.92.161]) by smtp.gmail.com with ESMTPSA id s71sm6157953qkl.60.2017.03.17.08.47.31 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 17 Mar 2017 08:47:31 -0700 (PDT) From: Vittorio Giovara To: ffmpeg-devel@ffmpeg.org Date: Fri, 17 Mar 2017 11:47:30 -0400 Message-Id: <20170317154730.58137-1-vittorio.giovara@gmail.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: References: Subject: [FFmpeg-devel] [PATCH] spherical: Change types of bounding and pad to uint32_t X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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 . Signed-off-by: Vittorio Giovara --- Hi, this is the version which applies cleanly to master and contains changes requested by James. Please CC. Vittorio 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 505d572301..3e6218303d 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 fdb23ab05e..bad034b770 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 d5c3949050..5e7be49563 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 db9bdc0be5..ff1922ade7 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; /**