From patchwork Sat Mar 11 23:33:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 2895 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.50.79 with SMTP id y76csp632096vsy; Sat, 11 Mar 2017 15:34:35 -0800 (PST) X-Received: by 10.223.135.109 with SMTP id 42mr23889450wrz.141.1489275275075; Sat, 11 Mar 2017 15:34:35 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 76si1906039wmw.165.2017.03.11.15.34.34; Sat, 11 Mar 2017 15:34:35 -0800 (PST) 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 3E4B9689A8F; Sun, 12 Mar 2017 01:34:16 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk0-f193.google.com (mail-qk0-f193.google.com [209.85.220.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F323F689A66 for ; Sun, 12 Mar 2017 01:34:09 +0200 (EET) Received: by mail-qk0-f193.google.com with SMTP id n141so33289551qke.3 for ; Sat, 11 Mar 2017 15:34:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=25JI59NjZSjdFNbYy0jrmZt0D2IxkDKDesoSVCYa2Nc=; b=nLi+6xDearGgIOua9pexO7qUu4AY+PU5eNijUNkYoNS7MrxY4Kpkx9x/7lpLmObwjq p+vqqj4PuVUL0pSpCzgORWm9iwYLRw0LYJbVtz769yhGnV2o/J43CWlodHtAD891vJ0I 4sX78wAaFogvKR3uq/OtuVFItxV1Wc+R6xTGs54G/wdlWx3TRCHU+ZgNVC6Jnd4JBYvx 1XXapHPLl+h9Ezu4aCFVi9pAMU48cY0gEJ8qlaNw8WX11JdCJKMNcGIEJyo5cSDxe/9x Y12kZLeYIIUFBAg10ylLrHbb0GG+XUy+rR5HI+W3x+rM/ljOuCcTvjWnm2PjOq6GYJDC 2XyQ== 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; bh=25JI59NjZSjdFNbYy0jrmZt0D2IxkDKDesoSVCYa2Nc=; b=m6XGIN/IbS6Jc86i9gmPMDL2hcycqj/6dWwCKz7takG50o5MUfAE6K0kVDsBAOw4n9 IketQGcGpiXGAgn9/rG2tuGnwZcYWNsmsXi649WOt8bVAtj/D6Q45GYddfRld18Np9d9 MCMOmOTGdzCJLwlRujPEGM/fJZjtOPhGz/myZy21les+PanPGvgP7LmAHKvjUgVJLuWo 9ZjeqhM71AMoZ3B6Xo+0WGkO9JWMfyOBWoFXZ6nHeX2YrUJ4l2tXu73kpMBQFSZRUG4G NPXRvWnZXbmXhi16QdHEPlGLHAC8JhKoVs+jYMu3eNlgEyi1iFWHI5LZUrivsWMnEVF8 FoRw== X-Gm-Message-State: AMke39mgz25qOLpWzLC3ViwASkWj/O5wcF4pYzXNPUWMoV7nkPrn80P4o55vFGQE6WqdXQ== X-Received: by 10.55.47.4 with SMTP id v4mr25404110qkh.77.1489275263537; Sat, 11 Mar 2017 15:34:23 -0800 (PST) Received: from localhost.localdomain ([181.231.62.139]) by smtp.gmail.com with ESMTPSA id v63sm9248896qkc.5.2017.03.11.15.34.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 11 Mar 2017 15:34:23 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 Mar 2017 20:33:52 -0300 Message-Id: <20170311233353.4836-1-jamrial@gmail.com> X-Mailer: git-send-email 2.12.0 Subject: [FFmpeg-devel] [PATCH 1/2] tests/api-seek: make the crc array 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" Signed-off-by: James Almer --- tests/api/api-seek-test.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/api/api-seek-test.c b/tests/api/api-seek-test.c index cc3287b28f..6ef3b91933 100644 --- a/tests/api/api-seek-test.c +++ b/tests/api/api-seek-test.c @@ -30,17 +30,17 @@ #include "libavutil/imgutils.h" int64_t *pts_array; -int64_t *crc_array; +uint32_t *crc_array; int size_of_array; int number_of_elements; -static int add_crc_to_array(int64_t crc, int64_t pts) +static int add_crc_to_array(uint32_t crc, int64_t pts) { if (size_of_array <= number_of_elements) { if (size_of_array == 0) size_of_array = 10; size_of_array *= 2; - crc_array = av_realloc(crc_array, size_of_array * sizeof(int64_t)); + crc_array = av_realloc(crc_array, size_of_array * sizeof(uint32_t)); pts_array = av_realloc(pts_array, size_of_array * sizeof(int64_t)); if ((crc_array == NULL) || (pts_array == NULL)) { av_log(NULL, AV_LOG_ERROR, "Can't allocate array to store crcs\n"); @@ -53,13 +53,13 @@ static int add_crc_to_array(int64_t crc, int64_t pts) return 0; } -static int compare_crc_in_array(int64_t crc, int64_t pts) +static int compare_crc_in_array(uint32_t crc, int64_t pts) { int i; for (i = 0; i < number_of_elements; i++) { if (pts_array[i] == pts) { if (crc_array[i] == crc) { - printf("Comparing 0x%08lx %"PRId64" %d is OK\n", crc, pts, i); + printf("Comparing 0x%08"PRIx32" %"PRId64" %d is OK\n", crc, pts, i); return 0; } else { @@ -81,7 +81,7 @@ static int compute_crc_of_packets(AVFormatContext *fmt_ctx, int video_stream, int end_of_stream = 0; int byte_buffer_size; uint8_t *byte_buffer; - int64_t crc; + uint32_t crc; AVPacket pkt; byte_buffer_size = av_image_get_buffer_size(ctx->pix_fmt, ctx->width, ctx->height, 16); @@ -132,7 +132,7 @@ static int compute_crc_of_packets(AVFormatContext *fmt_ctx, int video_stream, if ((!no_seeking) && (fr->pts > ts_end)) break; crc = av_adler32_update(0, (const uint8_t*)byte_buffer, number_of_written_bytes); - printf("%10"PRId64", 0x%08lx\n", fr->pts, crc); + printf("%10"PRId64", 0x%08"PRIx32"\n", fr->pts, crc); if (no_seeking) { if (add_crc_to_array(crc, fr->pts) < 0) return -1; @@ -185,7 +185,8 @@ static int seek_test(const char *input_filename, const char *start, const char * size_of_array = 0; number_of_elements = 0; - crc_array = pts_array = NULL; + crc_array = NULL; + pts_array = NULL; result = avformat_open_input(&fmt_ctx, input_filename, NULL, NULL); if (result < 0) {