From patchwork Sat Mar 6 19:42:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 26218 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 60A6A44B9AF for ; Sat, 6 Mar 2021 21:43:16 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2FD3B68A31D; Sat, 6 Mar 2021 21:43:16 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DABDE687F30 for ; Sat, 6 Mar 2021 21:43:09 +0200 (EET) Received: by mail-qv1-f47.google.com with SMTP id bh3so2728137qvb.5 for ; Sat, 06 Mar 2021 11:43:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=/rE+akdYJDOEd+/r4eiPj8ftVQL6PfntIBxudoCi4NY=; b=EUTLFfHbJ6RdRZn6H62mt0XknBwXRTmAUAGo0kISR/nqpe6Wf264bZJDE2PvBGtPJv xNsM5WPrf8myhQe0keP4Uc2Ot6/sp6u7t/OaD+EXjeelfk9+zuQVKY9UiDsCb7eKMaOz 1PWYEYG2yjWs8B9wXTao5gaBM+KvvBJ8k8R5vUASsklsl/OP/eVnJ2dFVeBPGqexsJSz PafbkPOk9BgiQVi5wr6Z4KXjy+N6APklAyLC+Y7qbpSryeNVHgLQw1Ypyvl+wFFQYdvI DjfZpNIFIoRriskw0vXKTD/VpexM4eB0QJPHkt+KesTHkSBgTSQguoOl17LIg2r33HIq qkoA== 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:mime-version :content-transfer-encoding; bh=/rE+akdYJDOEd+/r4eiPj8ftVQL6PfntIBxudoCi4NY=; b=arBqvoJDMApx4zImKNYB69+p371dLFRxMLvDbCW+nfBMvia83jF3F+qUQlueKU8aRn YoSFqtp30Je3FtXFwEmchHa0ybxnh2Q6GAe4jQfc8/RKMXMOxPran6W1ern9r5Bxsf0v 3S2rMRYDeu2PbXhT56/sfIOhTdOvvSUHTtGF6UlCzZuz+bjZE3mNHAR0Y4a+Hmk7b1b0 2I4cveSh69CaWcbK/5EfqluLzm1ryL63h8hzoD0EZv2lviVtgT9LXVGXfaqE+Zxu6y5m tEBH5d7WlsdWsjg2DNvFkUNBWwUXqsgFJSp9RtatVbmfEfbmGK3tIk2EdyLPKHOSBgLg X5XQ== X-Gm-Message-State: AOAM5331vK0Iq4ZrmcCZta0L50FqrryUCkpsnIOd5PD3xWYtLp4Z5SjF vHpoCpJ6OaFMVAyti00suZbdzuYPdWE24A== X-Google-Smtp-Source: ABdhPJzJg6dvfG+Hz+lYtyJaNx2DUnLCbUr/nTvomuxmBpOc0jMVf2fW4M1e8lgmx4qe3uUyBgA8rg== X-Received: by 2002:a0c:d78e:: with SMTP id z14mr14966058qvi.8.1615059788046; Sat, 06 Mar 2021 11:43:08 -0800 (PST) Received: from localhost.localdomain ([181.23.89.132]) by smtp.gmail.com with ESMTPSA id s19sm4376601qks.130.2021.03.06.11.43.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Mar 2021 11:43:07 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sat, 6 Mar 2021 16:42:35 -0300 Message-Id: <20210306194243.14931-1-jamrial@gmail.com> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/9 v3] avutil/buffer: change public function and struct size parameter types to size_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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: James Almer --- Changes since v2 is the addition of the buffer_size_t typedef to reduce the amount of ifdeffery required to adapt our code. doc/APIchanges | 4 ++++ libavutil/buffer.c | 14 +++++++------- libavutil/buffer.h | 32 ++++++++++++++++++++++++++++++++ libavutil/buffer_internal.h | 8 ++++---- libavutil/internal.h | 7 +++++++ libavutil/version.h | 5 ++++- 6 files changed, 58 insertions(+), 12 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 4027d599e7..7abc320db2 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,10 @@ libavutil: 2017-10-21 API changes, most recent first: +2021-03-xx - xxxxxxxxxx - lavu 56.68.100 - buffer.h + Change AVBufferRef related function and struct size parameter and fields + type to size_t at next major bump. + 2021-03-04 - xxxxxxxxxx - lavc 58.128.101 - avcodec.h Enable err_recognition to be set for encoders. diff --git a/libavutil/buffer.c b/libavutil/buffer.c index 3204f11b68..858633e8c7 100644 --- a/libavutil/buffer.c +++ b/libavutil/buffer.c @@ -26,7 +26,7 @@ #include "mem.h" #include "thread.h" -AVBufferRef *av_buffer_create(uint8_t *data, int size, +AVBufferRef *av_buffer_create(uint8_t *data, buffer_size_t size, void (*free)(void *opaque, uint8_t *data), void *opaque, int flags) { @@ -64,7 +64,7 @@ void av_buffer_default_free(void *opaque, uint8_t *data) av_free(data); } -AVBufferRef *av_buffer_alloc(int size) +AVBufferRef *av_buffer_alloc(buffer_size_t size) { AVBufferRef *ret = NULL; uint8_t *data = NULL; @@ -80,7 +80,7 @@ AVBufferRef *av_buffer_alloc(int size) return ret; } -AVBufferRef *av_buffer_allocz(int size) +AVBufferRef *av_buffer_allocz(buffer_size_t size) { AVBufferRef *ret = av_buffer_alloc(size); if (!ret) @@ -166,7 +166,7 @@ int av_buffer_make_writable(AVBufferRef **pbuf) return 0; } -int av_buffer_realloc(AVBufferRef **pbuf, int size) +int av_buffer_realloc(AVBufferRef **pbuf, buffer_size_t size) { AVBufferRef *buf = *pbuf; uint8_t *tmp; @@ -242,8 +242,8 @@ int av_buffer_replace(AVBufferRef **pdst, AVBufferRef *src) return 0; } -AVBufferPool *av_buffer_pool_init2(int size, void *opaque, - AVBufferRef* (*alloc)(void *opaque, int size), +AVBufferPool *av_buffer_pool_init2(buffer_size_t size, void *opaque, + AVBufferRef* (*alloc)(void *opaque, buffer_size_t size), void (*pool_free)(void *opaque)) { AVBufferPool *pool = av_mallocz(sizeof(*pool)); @@ -263,7 +263,7 @@ AVBufferPool *av_buffer_pool_init2(int size, void *opaque, return pool; } -AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size)) +AVBufferPool *av_buffer_pool_init(buffer_size_t size, AVBufferRef* (*alloc)(buffer_size_t size)) { AVBufferPool *pool = av_mallocz(sizeof(*pool)); if (!pool) diff --git a/libavutil/buffer.h b/libavutil/buffer.h index fd4e381efa..241a80ed67 100644 --- a/libavutil/buffer.h +++ b/libavutil/buffer.h @@ -25,8 +25,11 @@ #ifndef AVUTIL_BUFFER_H #define AVUTIL_BUFFER_H +#include #include +#include "version.h" + /** * @defgroup lavu_buffer AVBuffer * @ingroup lavu_data @@ -90,7 +93,11 @@ typedef struct AVBufferRef { /** * Size of data in bytes. */ +#if FF_API_BUFFER_SIZE_T int size; +#else + size_t size; +#endif } AVBufferRef; /** @@ -98,13 +105,21 @@ typedef struct AVBufferRef { * * @return an AVBufferRef of given size or NULL when out of memory */ +#if FF_API_BUFFER_SIZE_T AVBufferRef *av_buffer_alloc(int size); +#else +AVBufferRef *av_buffer_alloc(size_t size); +#endif /** * Same as av_buffer_alloc(), except the returned buffer will be initialized * to zero. */ +#if FF_API_BUFFER_SIZE_T AVBufferRef *av_buffer_allocz(int size); +#else +AVBufferRef *av_buffer_allocz(size_t size); +#endif /** * Always treat the buffer as read-only, even when it has only one @@ -127,7 +142,11 @@ AVBufferRef *av_buffer_allocz(int size); * * @return an AVBufferRef referring to data on success, NULL on failure. */ +#if FF_API_BUFFER_SIZE_T AVBufferRef *av_buffer_create(uint8_t *data, int size, +#else +AVBufferRef *av_buffer_create(uint8_t *data, size_t size, +#endif void (*free)(void *opaque, uint8_t *data), void *opaque, int flags); @@ -195,7 +214,11 @@ int av_buffer_make_writable(AVBufferRef **buf); * reference to it (i.e. the one passed to this function). In all other cases * a new buffer is allocated and the data is copied. */ +#if FF_API_BUFFER_SIZE_T int av_buffer_realloc(AVBufferRef **buf, int size); +#else +int av_buffer_realloc(AVBufferRef **buf, size_t size); +#endif /** * Ensure dst refers to the same data as src. @@ -262,7 +285,11 @@ typedef struct AVBufferPool AVBufferPool; * (av_buffer_alloc()). * @return newly created buffer pool on success, NULL on error. */ +#if FF_API_BUFFER_SIZE_T AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size)); +#else +AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size)); +#endif /** * Allocate and initialize a buffer pool with a more complex allocator. @@ -279,8 +306,13 @@ AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size)); * data. May be NULL. * @return newly created buffer pool on success, NULL on error. */ +#if FF_API_BUFFER_SIZE_T AVBufferPool *av_buffer_pool_init2(int size, void *opaque, AVBufferRef* (*alloc)(void *opaque, int size), +#else +AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque, + AVBufferRef* (*alloc)(void *opaque, size_t size), +#endif void (*pool_free)(void *opaque)); /** diff --git a/libavutil/buffer_internal.h b/libavutil/buffer_internal.h index 70d2615a06..0b549e3a53 100644 --- a/libavutil/buffer_internal.h +++ b/libavutil/buffer_internal.h @@ -32,7 +32,7 @@ struct AVBuffer { uint8_t *data; /**< data described by this buffer */ - int size; /**< size of data in bytes */ + buffer_size_t size; /**< size of data in bytes */ /** * number of existing AVBufferRef instances referring to this buffer @@ -89,10 +89,10 @@ struct AVBufferPool { */ atomic_uint refcount; - int size; + buffer_size_t size; void *opaque; - AVBufferRef* (*alloc)(int size); - AVBufferRef* (*alloc2)(void *opaque, int size); + AVBufferRef* (*alloc)(buffer_size_t size); + AVBufferRef* (*alloc2)(void *opaque, buffer_size_t size); void (*pool_free)(void *opaque); }; diff --git a/libavutil/internal.h b/libavutil/internal.h index 93ea57c324..572daefec3 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -299,4 +299,11 @@ int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t time #define FF_PSEUDOPAL 0 #endif +// Temporary typedef to simplify porting all AVBufferRef users to size_t +#if FF_API_BUFFER_SIZE_T +typedef int buffer_size_t; +#else +typedef size_t buffer_size_t; +#endif + #endif /* AVUTIL_INTERNAL_H */ diff --git a/libavutil/version.h b/libavutil/version.h index 356c54d633..9a290d57e7 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 67 +#define LIBAVUTIL_VERSION_MINOR 68 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ @@ -132,6 +132,9 @@ #ifndef FF_API_CHILD_CLASS_NEXT #define FF_API_CHILD_CLASS_NEXT (LIBAVUTIL_VERSION_MAJOR < 57) #endif +#ifndef FF_API_BUFFER_SIZE_T +#define FF_API_BUFFER_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 57) +#endif #ifndef FF_API_D2STR #define FF_API_D2STR (LIBAVUTIL_VERSION_MAJOR < 58) #endif From patchwork Sat Mar 6 19:42:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 26219 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id A843444B9AF for ; Sat, 6 Mar 2021 21:43:17 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 907D168A5E4; Sat, 6 Mar 2021 21:43:17 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EA010687F30 for ; Sat, 6 Mar 2021 21:43:10 +0200 (EET) Received: by mail-qk1-f180.google.com with SMTP id g185so5551049qkf.6 for ; Sat, 06 Mar 2021 11:43:10 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=RMFUw8p3mKZQFpcUaBl+Ik75iha13lTcn//40UhB4KI=; b=cVhv3sTc25M3YeLqFjmnSp2FCguzAehJphBkXyD3aY4RC7DSz5Y2blNPB+J5y9UHrF uxTTt7CbhNEYbHC1MEqIAOSnMHcFckIBAtrIS7JE5mHn56QTQcOLXnvhYIeZD7AjaA+l HQ78Eq1wpBc5h+ZfuJLIOwz1hAWfe+A1OpKEiTaB41J+olo4qoiB1VL4QxYovve+bG29 t6c1bJT4T9+ad7ZGiniL8UNSxI6sdpBqHtHNOcS1ii7FU4ZAJt4C1x9Kuvc7c+h0Nvp5 Mcl+jXZ9ZwMwPH6znuSVgrdo3ci0vZlKuawF4zoTkVbknURBB9OkQbSqZz09BMbYrQUt ywrA== 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:mime-version:content-transfer-encoding; bh=RMFUw8p3mKZQFpcUaBl+Ik75iha13lTcn//40UhB4KI=; b=B8PIG8ARXK88zthvUw+SrVW68O5SZZEKOPmE3Y7U9yW9jVPauBqDf9sLd4H3qIACZt IwGAMz4vBzOTuGlXQv+B5oC4SdI6tqiLgqQGbueTgD4GtM9xWD37GeemoaxItI3oQQC/ QLWNCX5yBGrtLS7UZmPmF6sGd8UiSzMNkasHVF8pxs07FXBnfRfsMq3hF+KjNAo5SJCg Yf9kTSsjVmUh1kh5v3VFlYs7gOvApabH2/ENbkd17JcvDdN55P4cEyq2fI6NxQB9lyCi YR3gp8ts7o7/qRa0wCxQo4Dftzc5jmOifeLlJ25bZ271kKDWI0vlMJtuhnvYA6irNPSA qlIg== X-Gm-Message-State: AOAM532e6rFOGTPkPPgLi0ahvIPAHFXlFjOyAfm3v8r4wMnqrz6Dvwqq 1TR4FPCEzpaX5svr5WyBPbyslkKzHeNR6A== X-Google-Smtp-Source: ABdhPJwSxRf99W7SitC6gAoyg1dJPTla1XpR0w974oct2j4n/K0pc/qJTpGkzIulJwVyu4zieGcLxQ== X-Received: by 2002:a37:a855:: with SMTP id r82mr14298016qke.230.1615059789284; Sat, 06 Mar 2021 11:43:09 -0800 (PST) Received: from localhost.localdomain ([181.23.89.132]) by smtp.gmail.com with ESMTPSA id s19sm4376601qks.130.2021.03.06.11.43.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Mar 2021 11:43:08 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sat, 6 Mar 2021 16:42:36 -0300 Message-Id: <20210306194243.14931-2-jamrial@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210306194243.14931-1-jamrial@gmail.com> References: <20210306194243.14931-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/9 v3] avutil/frame: change av_frame_new_side_data() size parameter type to size_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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: James Almer --- Changes since v2 is using the buffer_size_t typedef. doc/APIchanges | 6 +++--- libavutil/frame.c | 2 +- libavutil/frame.h | 8 ++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 7abc320db2..d2d107de78 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,9 +15,9 @@ libavutil: 2017-10-21 API changes, most recent first: -2021-03-xx - xxxxxxxxxx - lavu 56.68.100 - buffer.h - Change AVBufferRef related function and struct size parameter and fields - type to size_t at next major bump. +2021-03-xx - xxxxxxxxxx - lavu 56.68.100 - buffer.h frame.h + Change AVBufferRef and relevant AVFrame function and struct size + parameter and fields type to size_t at next major bump. 2021-03-04 - xxxxxxxxxx - lavc 58.128.101 - avcodec.h Enable err_recognition to be set for encoders. diff --git a/libavutil/frame.c b/libavutil/frame.c index eab51b6a32..75e347bf2f 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -725,7 +725,7 @@ AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame, AVFrameSideData *av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, - int size) + buffer_size_t size) { AVFrameSideData *ret; AVBufferRef *buf = av_buffer_alloc(size); diff --git a/libavutil/frame.h b/libavutil/frame.h index 1aeafef6de..7d1f8e2935 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -220,7 +220,11 @@ enum AVActiveFormatDescription { typedef struct AVFrameSideData { enum AVFrameSideDataType type; uint8_t *data; +#if FF_API_BUFFER_SIZE_T int size; +#else + size_t size; +#endif AVDictionary *metadata; AVBufferRef *buf; } AVFrameSideData; @@ -913,7 +917,11 @@ AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane); */ AVFrameSideData *av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, +#if FF_API_BUFFER_SIZE_T int size); +#else + size_t size); +#endif /** * Add a new side data to a frame from an existing AVBufferRef From patchwork Sat Mar 6 19:42:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 26220 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id A307F44B9AF for ; Sat, 6 Mar 2021 21:43:19 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9153E68A91A; Sat, 6 Mar 2021 21:43:19 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 068EF68A329 for ; Sat, 6 Mar 2021 21:43:12 +0200 (EET) Received: by mail-qv1-f44.google.com with SMTP id d9so2736222qvo.3 for ; Sat, 06 Mar 2021 11:43:11 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=AX1UMC80XdUbc4d7Afdvs3JXLd35it2or6Up4VPzuos=; b=U0X8XdBcRQPTIuf5LLUASsUlt+jsVnumDLQFVqh6362QO4W1aTLyNrEdpV4dbWgR6H HwrO8klkHjDSJS35fguVWfTW32RvK7+unPgQM2GRNzUBRjposGaFGI6kdncFoIppGVF9 2BtW944jacnanqOfmsLgFSgXpV+Dr8/UeSpe9nfrBpHfcrrLU6v5k9iV2rL2n6HhsFdO MJbW8qMPPky+PiL/Y7vaScFiM0MYWIKSpkTXaIavKWJ37fSrp8b/tc6Nl+bktVaNA1Ah A4G/HjL6mGuZyXSXu34hzbRGPiT/2Mkkl1inqoFtQT9kYvbd7kQqvYtDalu3zVqqBLpJ ryRA== 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:mime-version:content-transfer-encoding; bh=AX1UMC80XdUbc4d7Afdvs3JXLd35it2or6Up4VPzuos=; b=StJAJg/nZxSy5T+shEznH+fGwNkAVHvoWRGPO2AWraLrOAYoDPNoHX4hYaCYDmFP5f npX3cr/a8xiAF3k9w0p3R+U5z01Bk9QHQ3Y8k1fg6Cmz6HRMPmGnOrPsEmBuABmiAGnc qJTYUS6cwJ82uU9UWCj5OwN7obALE/Y5wN4eryk1+br/bCv2WNy5wBkpbJGFgpZxGabs yDi00JNsPVcXx6DaNNfur8Mr26SFLFT5dvNSeQ0d1/bzbDRZ6Q6ah1T7ie7dp4wqd1zA 3JDW+5M0B5dfXx6JT+ZrLGnVCJptGluLOAiYwKKz//EBg9AM+5RKFs0HavQem2/K0Ps9 pr+A== X-Gm-Message-State: AOAM532hVVnD3v37Za2MJH/AzZERYqrA9tOvfnGypu5D2UFbUOY1SczS GmZAZIvliObQ+IX2LlG6wmjwcbJCeo7oLg== X-Google-Smtp-Source: ABdhPJxzw6h6U8pHT+/SAj5MXm2+uQlmw8reIbCSXkr4/8iAjdpJGGZrdV/7udhyb958ruLQRFtm/w== X-Received: by 2002:a0c:b611:: with SMTP id f17mr14242907qve.42.1615059790485; Sat, 06 Mar 2021 11:43:10 -0800 (PST) Received: from localhost.localdomain ([181.23.89.132]) by smtp.gmail.com with ESMTPSA id s19sm4376601qks.130.2021.03.06.11.43.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Mar 2021 11:43:10 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sat, 6 Mar 2021 16:42:37 -0300 Message-Id: <20210306194243.14931-3-jamrial@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210306194243.14931-1-jamrial@gmail.com> References: <20210306194243.14931-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/9 v2] avcodec/packet: change side data related public function and struct size types to size_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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" av_packet_add_side_data() already defines size as a size_t, so this makes it consistent across all side data functions. Signed-off-by: James Almer --- Changes since v1 is using the buffer_size_t typedef. doc/APIchanges | 4 ++++ libavcodec/avpacket.c | 10 +++++++--- libavcodec/packet.h | 16 ++++++++++++++++ libavcodec/version.h | 2 +- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index d2d107de78..34b15605e6 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,10 @@ libavutil: 2017-10-21 API changes, most recent first: +2021-03-xx - xxxxxxxxxx - lavc 58.130.100 - packet.h + Change AVBufferRef related AVPacket function and struct size + parameter and fields type to size_t at next major bump. + 2021-03-xx - xxxxxxxxxx - lavu 56.68.100 - buffer.h frame.h Change AVBufferRef and relevant AVFrame function and struct size parameter and fields type to size_t at next major bump. diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index e4ba403cf6..291c778d95 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -330,12 +330,16 @@ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, - int size) + buffer_size_t size) { int ret; uint8_t *data; +#if FF_API_BUFFER_SIZE_T if ((unsigned)size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) +#else + if (size > SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE) +#endif return NULL; data = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!data) @@ -351,7 +355,7 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, } uint8_t *av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, - int *size) + buffer_size_t *size) { int i; @@ -554,7 +558,7 @@ int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **di } int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, - int size) + buffer_size_t size) { int i; diff --git a/libavcodec/packet.h b/libavcodec/packet.h index b9d4c9c2c8..3d9013d783 100644 --- a/libavcodec/packet.h +++ b/libavcodec/packet.h @@ -305,7 +305,11 @@ enum AVPacketSideDataType { typedef struct AVPacketSideData { uint8_t *data; +#if FF_API_BUFFER_SIZE_T int size; +#else + size_t size; +#endif enum AVPacketSideDataType type; } AVPacketSideData; @@ -559,7 +563,11 @@ void av_free_packet(AVPacket *pkt); * @return pointer to fresh allocated data or NULL otherwise */ uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, +#if FF_API_BUFFER_SIZE_T int size); +#else + size_t size); +#endif /** * Wrap an existing array as a packet side data. @@ -586,7 +594,11 @@ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, * @return 0 on success, < 0 on failure */ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, +#if FF_API_BUFFER_SIZE_T int size); +#else + size_t size); +#endif /** * Get side information from packet. @@ -598,7 +610,11 @@ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, * @return pointer to data if present or NULL otherwise */ uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, +#if FF_API_BUFFER_SIZE_T int *size); +#else + size_t *size); +#endif #if FF_API_MERGE_SD_API attribute_deprecated diff --git a/libavcodec/version.h b/libavcodec/version.h index 169c763e8a..3124ec8061 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 58 -#define LIBAVCODEC_VERSION_MINOR 129 +#define LIBAVCODEC_VERSION_MINOR 130 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ From patchwork Sat Mar 6 19:42:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 26221 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id C395944B9AF for ; Sat, 6 Mar 2021 21:43:20 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A4A34688128; Sat, 6 Mar 2021 21:43:20 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3E8B168A8FD for ; Sat, 6 Mar 2021 21:43:13 +0200 (EET) Received: by mail-qk1-f170.google.com with SMTP id a9so5508789qkn.13 for ; Sat, 06 Mar 2021 11:43:13 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=oOZkgnb5apTSEmHcZlA0E461GYm65tCLYjzCbgGJCtg=; b=BtKk4QCMFc6w7cFziuWhnZNFR8sobYi6tnSfu21KoZ/orXe8Y3BDrG11POor6Iede8 r9HvZGqHkBZRxZ16xU7/s25nySvzQsKJEieF8uNa9LFZdiybU/72vQreFcKyac18CukL yf7yIP8AEAKwcF81nHXzGmG89j/M17PxO8/QT1bE2IXLwyB+aJ4vJygcExRZZe5di5Bt TScHCBTV6aI2AMqIH8WNhMgfYzt1JxMDcNGxU+dOReB1eXxVnxr7yYgZlSJayY/2XwGe u4IawRULz8Yx7EgYZjywkKEi7ZwzU83xuuEDcXzVRsxN8Qsdl/Jacr14A1864046zjF9 IW6A== 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:mime-version:content-transfer-encoding; bh=oOZkgnb5apTSEmHcZlA0E461GYm65tCLYjzCbgGJCtg=; b=aGrshUf1/jqSCUvEIRLmLQOiPs+X3aWtX16/7vJju9F3EZRhvUVOs5uM0t89t6xf1D oXe15hdwMhWMxlIWkvX5LIcE1PWeUyt+J+/KX12cho8RbnobcLrMqw3mMs/pWqqZQ/Si BcvR0hil2bzbZMY5CXeYPJtuI1xxhIyybzzGD/bsTmo9n5x09e1qwxjCM1260F5MUXNM jkal+OSYjS3Vo9Djwn/rt8i5O7qVKgVATvI8douaxsfZFLWskITe8Ii9wfRbVbestJk0 /qD05LlQ36qZrUc/4sNiT1RC8MO7jCN9uyH1rgcyIwDngMvDkDx7nl+SrqexVrq13Uiy Uqkw== X-Gm-Message-State: AOAM533gFz2f9DrhU/JFeW5SbdLYTuaE+EQ+W0I2w2s09wkawhakhDYh gSS/JhfhlCFoaY+R2h0nTlbumpSSnxh7Fw== X-Google-Smtp-Source: ABdhPJzURu+14PdNwbsQsB/SnoHVYqk3QIrb+AdGINF0KwVPO3UlLAf0xujF5qdaedT4E8VpQTnHZg== X-Received: by 2002:a37:a996:: with SMTP id s144mr14253839qke.407.1615059791741; Sat, 06 Mar 2021 11:43:11 -0800 (PST) Received: from localhost.localdomain ([181.23.89.132]) by smtp.gmail.com with ESMTPSA id s19sm4376601qks.130.2021.03.06.11.43.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Mar 2021 11:43:11 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sat, 6 Mar 2021 16:42:38 -0300 Message-Id: <20210306194243.14931-4-jamrial@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210306194243.14931-1-jamrial@gmail.com> References: <20210306194243.14931-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/9 v2] avformat/utils: change AVStream side data related public function and struct size types to size_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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" av_stream_add_side_data() already defines size as a size_t, so this makes it consistent across all side data functions. Signed-off-by: James Almer --- Changes since v1 is using the buffer_size_t typedef. doc/APIchanges | 4 ++++ libavformat/avformat.h | 8 ++++++++ libavformat/utils.c | 4 ++-- libavformat/version.h | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 34b15605e6..584d9ee17d 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,10 @@ libavutil: 2017-10-21 API changes, most recent first: +2021-03-xx - xxxxxxxxxx - lavf 58.72.100 - avformat.h + Change AVBufferRef related AVStream function and struct size + parameter and fields type to size_t at next major bump. + 2021-03-xx - xxxxxxxxxx - lavc 58.130.100 - packet.h Change AVBufferRef related AVPacket function and struct size parameter and fields type to size_t at next major bump. diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 7da2f3d98e..e3bd01ec7f 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -2083,7 +2083,11 @@ int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type, * @return pointer to fresh allocated data or NULL otherwise */ uint8_t *av_stream_new_side_data(AVStream *stream, +#if FF_API_BUFFER_SIZE_T enum AVPacketSideDataType type, int size); +#else + enum AVPacketSideDataType type, size_t size); +#endif /** * Get side information from stream. * @@ -2094,7 +2098,11 @@ uint8_t *av_stream_new_side_data(AVStream *stream, * @return pointer to data if present or NULL otherwise */ uint8_t *av_stream_get_side_data(const AVStream *stream, +#if FF_API_BUFFER_SIZE_T enum AVPacketSideDataType type, int *size); +#else + enum AVPacketSideDataType type, size_t *size); +#endif AVProgram *av_new_program(AVFormatContext *s, int id); diff --git a/libavformat/utils.c b/libavformat/utils.c index 36164e0f0d..98e6c55602 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -5471,7 +5471,7 @@ int ff_generate_avci_extradata(AVStream *st) } uint8_t *av_stream_get_side_data(const AVStream *st, - enum AVPacketSideDataType type, int *size) + enum AVPacketSideDataType type, buffer_size_t *size) { int i; @@ -5524,7 +5524,7 @@ int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type, } uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type, - int size) + buffer_size_t size) { int ret; uint8_t *data = av_malloc(size); diff --git a/libavformat/version.h b/libavformat/version.h index a05676d979..2a2804582c 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -32,7 +32,7 @@ // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) // Also please add any ticket numbers that you believe might be affected here #define LIBAVFORMAT_VERSION_MAJOR 58 -#define LIBAVFORMAT_VERSION_MINOR 71 +#define LIBAVFORMAT_VERSION_MINOR 72 #define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ From patchwork Sat Mar 6 19:42:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 26222 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id D35C344B9AF for ; Sat, 6 Mar 2021 21:43:21 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BB04E68A99E; Sat, 6 Mar 2021 21:43:21 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E41ED68A94D for ; Sat, 6 Mar 2021 21:43:14 +0200 (EET) Received: by mail-qk1-f177.google.com with SMTP id b130so5522311qkc.10 for ; Sat, 06 Mar 2021 11:43:14 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=HQXEqRSessOgBzdqJt+Oe2ZLLIzvvWit0hStm1fD8Yw=; b=fX51zCZJJh7q2WVJW9su8ncGm61CB1Dp9+lvts+hWC2RIjzsmhBByJ7HgaRiR2tUd2 coWSEgCqLTEAK73zLgPk7hzm3NeQjZMtDny8PQaTwvwTO7Q9AxYPqtnWMVkbN4exzhkk ce1Ps4sb0a8KNaIXkeOBZf/6ufv9yvhFee7bBwedmO0zLWslbNtxuz2YNHEpFEUFvsu1 7jx14HlCCvIoy19H6uGTB/GoeKppTxrSQSdUoHzWIJV+SlrdtCucaHQ4zRqSeubAQCpp S56e06iKi0Ba4egotrrLRsSUsGB3QdXgAI8ur3+WgI5RaNkuqLgHukqmDQH+5WRoaxJN D5xQ== 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:mime-version:content-transfer-encoding; bh=HQXEqRSessOgBzdqJt+Oe2ZLLIzvvWit0hStm1fD8Yw=; b=jC9LeMv1OKBQuvjWfYAklBlNw4RZNC5MbzKdkYVkGVfH4jlTXbEPFlmzMZ/QANuHPw GcTGrf2VV0BpTUCCEHhrEgE0xGxRpeY6xhlKt9VRsr41bz1o5+71n6uCcLSVVlp4eWk9 AI+ktjbKzWZ6JyQYQN6v1+fpa+K2C/xT02tJ7dNvT2rNFMEhj7aoCXI4FS2KwHGKg2F/ dRE8nJ0DvoZiFQqzMxXWDUtm6fRC/kaKtulFzFfl/OAfLtineyVzC0sWscYcmUiA3B7w PmlZZutiRq/uKvmJSUh4QZSj7zFTKD42xjde60m9c48cg4Cl9d01SK6uEnZJHlArzkqs xkkg== X-Gm-Message-State: AOAM530dfByE6mFifLXksdiSRAGb8R1f62FeeLF8vE0qu+2Bph6WloWW qGJz3tZJ3uZaEVcsFgyvRIwwkOZxyhJNNA== X-Google-Smtp-Source: ABdhPJwi6kwcbtLsyWH3qUeV9+gmzZ4zJ2Q8qL38rhDRHQaQmnDwzvOvUn+KYOXhJ7trPpb/bMFGIQ== X-Received: by 2002:a37:c441:: with SMTP id h1mr14733198qkm.123.1615059793159; Sat, 06 Mar 2021 11:43:13 -0800 (PST) Received: from localhost.localdomain ([181.23.89.132]) by smtp.gmail.com with ESMTPSA id s19sm4376601qks.130.2021.03.06.11.43.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Mar 2021 11:43:12 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sat, 6 Mar 2021 16:42:39 -0300 Message-Id: <20210306194243.14931-5-jamrial@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210306194243.14931-1-jamrial@gmail.com> References: <20210306194243.14931-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/9] avcodec: use the buffer_size_t typedef where required 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: James Almer --- libavcodec/8bps.c | 2 +- libavcodec/aacdec_template.c | 4 ++-- libavcodec/adxdec.c | 2 +- libavcodec/audiotoolboxdec.c | 2 +- libavcodec/avpacket.c | 6 +++--- libavcodec/cbs_bsf.c | 2 +- libavcodec/cinepak.c | 2 +- libavcodec/decode.c | 9 +++++---- libavcodec/gdv.c | 3 ++- libavcodec/h264_metadata_bsf.c | 2 +- libavcodec/h264dec.c | 2 +- libavcodec/hevcdec.c | 2 +- libavcodec/idcinvideo.c | 2 +- libavcodec/imx.c | 3 ++- libavcodec/interplayvideo.c | 2 +- libavcodec/kmvc.c | 2 +- libavcodec/libvpxdec.c | 2 +- libavcodec/mscc.c | 2 +- libavcodec/msrle.c | 2 +- libavcodec/msvideo1.c | 2 +- libavcodec/nvdec.c | 4 ++-- libavcodec/qpeg.c | 2 +- libavcodec/qtrle.c | 2 +- libavcodec/rawdec.c | 2 +- libavcodec/rscc.c | 2 +- libavcodec/smc.c | 2 +- libavcodec/srtdec.c | 3 ++- libavcodec/tscc.c | 2 +- libavcodec/vaapi_encode.c | 3 ++- 29 files changed, 41 insertions(+), 36 deletions(-) diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c index aa2318fa2d..53e939d35d 100644 --- a/libavcodec/8bps.c +++ b/libavcodec/8bps.c @@ -122,7 +122,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, } if (avctx->bits_per_coded_sample <= 8) { - int size; + buffer_size_t size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index aa89f7cbb8..403bb15615 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -3436,11 +3436,11 @@ static int aac_decode_frame(AVCodecContext *avctx, void *data, int buf_consumed; int buf_offset; int err; - int new_extradata_size; + buffer_size_t new_extradata_size; const uint8_t *new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &new_extradata_size); - int jp_dualmono_size; + buffer_size_t jp_dualmono_size; const uint8_t *jp_dualmono = av_packet_get_side_data(avpkt, AV_PKT_DATA_JP_DUALMONO, &jp_dualmono_size); diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c index 35b20c5cf4..94de3eee19 100644 --- a/libavcodec/adxdec.c +++ b/libavcodec/adxdec.c @@ -103,7 +103,7 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data, const uint8_t *buf = avpkt->data; const uint8_t *buf_end = buf + avpkt->size; int num_blocks, ch, ret; - int new_extradata_size; + buffer_size_t new_extradata_size; uint8_t *new_extradata; new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, diff --git a/libavcodec/audiotoolboxdec.c b/libavcodec/audiotoolboxdec.c index 1f3f7f5ac5..c0addcb2f3 100644 --- a/libavcodec/audiotoolboxdec.c +++ b/libavcodec/audiotoolboxdec.c @@ -483,7 +483,7 @@ static int ffat_decode(AVCodecContext *avctx, void *data, if (avctx->codec_id == AV_CODEC_ID_AAC) { if (!at->extradata_size) { uint8_t *side_data; - int side_data_size; + buffer_size_t side_data_size; side_data = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &side_data_size); diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 291c778d95..32cb71fcf0 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -593,7 +593,7 @@ FF_ENABLE_DEPRECATION_WARNINGS dst->side_data_elems = 0; for (i = 0; i < src->side_data_elems; i++) { enum AVPacketSideDataType type = src->side_data[i].type; - int size = src->side_data[i].size; + buffer_size_t size = src->side_data[i].size; uint8_t *src_data = src->side_data[i].data; uint8_t *dst_data = av_packet_new_side_data(dst, type, size); @@ -800,7 +800,7 @@ void avpriv_packet_list_free(AVPacketList **pkt_buf, AVPacketList **pkt_buf_end) int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type) { uint8_t *side_data; - int side_data_size; + buffer_size_t side_data_size; int i; side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_QUALITY_STATS, &side_data_size); @@ -826,7 +826,7 @@ int ff_side_data_set_prft(AVPacket *pkt, int64_t timestamp) { AVProducerReferenceTime *prft; uint8_t *side_data; - int side_data_size; + buffer_size_t side_data_size; side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PRFT, &side_data_size); if (!side_data) { diff --git a/libavcodec/cbs_bsf.c b/libavcodec/cbs_bsf.c index 9b521cf111..f0f7dd79b5 100644 --- a/libavcodec/cbs_bsf.c +++ b/libavcodec/cbs_bsf.c @@ -24,7 +24,7 @@ static int cbs_bsf_update_side_data(AVBSFContext *bsf, AVPacket *pkt) CBSBSFContext *ctx = bsf->priv_data; CodedBitstreamFragment *frag = &ctx->fragment; uint8_t *side_data; - int side_data_size; + buffer_size_t side_data_size; int err; side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c index 17148a3577..d70cb4b694 100644 --- a/libavcodec/cinepak.c +++ b/libavcodec/cinepak.c @@ -477,7 +477,7 @@ static int cinepak_decode_frame(AVCodecContext *avctx, return ret; if (s->palette_video) { - int size; + buffer_size_t size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); if (pal && size == AVPALETTE_SIZE) { s->frame->palette_has_changed = 1; diff --git a/libavcodec/decode.c b/libavcodec/decode.c index c976795311..102580b4b3 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -66,7 +66,8 @@ typedef struct FramePool { static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt) { - int size, ret; + int ret; + buffer_size_t size; const uint8_t *data; uint32_t flags; int64_t val; @@ -349,7 +350,7 @@ static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame, got_frame = 0; } else if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) { uint8_t *side; - int side_size; + buffer_size_t side_size; uint32_t discard_padding = 0; uint8_t skip_reason = 0; uint8_t discard_reason = 0; @@ -1713,7 +1714,7 @@ int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags static int add_metadata_from_side_data(const AVPacket *avpkt, AVFrame *frame) { - int size; + buffer_size_t size; const uint8_t *side_metadata; AVDictionary **frame_md = &frame->metadata; @@ -1759,7 +1760,7 @@ FF_ENABLE_DEPRECATION_WARNINGS frame->pkt_size = pkt->size; for (i = 0; i < FF_ARRAY_ELEMS(sd); i++) { - int size; + buffer_size_t size; uint8_t *packet_sd = av_packet_get_side_data(pkt, sd[i].packet, &size); if (packet_sd) { AVFrameSideData *frame_sd = av_frame_new_side_data(frame, diff --git a/libavcodec/gdv.c b/libavcodec/gdv.c index 2be1e2ea7f..860634c9ec 100644 --- a/libavcodec/gdv.c +++ b/libavcodec/gdv.c @@ -461,7 +461,8 @@ static int gdv_decode_frame(AVCodecContext *avctx, void *data, GetByteContext *gb = &gdv->gb; PutByteContext *pb = &gdv->pb; AVFrame *frame = data; - int ret, i, pal_size; + int ret, i; + buffer_size_t pal_size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size); int compression; unsigned flags; diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c index 6673a32601..c3a63f3578 100644 --- a/libavcodec/h264_metadata_bsf.c +++ b/libavcodec/h264_metadata_bsf.c @@ -371,7 +371,7 @@ static int h264_metadata_handle_display_orientation(AVBSFContext *bsf, H264RawSEIDisplayOrientation *disp = &ctx->display_orientation_payload; uint8_t *data; - int size; + buffer_size_t size; int write = 0; data = av_packet_get_side_data(pkt, AV_PKT_DATA_DISPLAYMATRIX, &size); diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 8856be0f59..47b9abbc5c 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -975,7 +975,7 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data, return send_next_delayed_frame(h, pict, got_frame, 0); if (av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, NULL)) { - int side_size; + buffer_size_t side_size; uint8_t *side = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); ff_h264_decode_extradata(side, side_size, &h->ps, &h->is_avc, &h->nal_length_size, diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index ac788a4a16..2231aed259 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -3303,7 +3303,7 @@ static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output, AVPacket *avpkt) { int ret; - int new_extradata_size; + buffer_size_t new_extradata_size; uint8_t *new_extradata; HEVCContext *s = avctx->priv_data; diff --git a/libavcodec/idcinvideo.c b/libavcodec/idcinvideo.c index 941a89d36d..569191511f 100644 --- a/libavcodec/idcinvideo.c +++ b/libavcodec/idcinvideo.c @@ -214,7 +214,7 @@ static int idcin_decode_frame(AVCodecContext *avctx, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; IdcinContext *s = avctx->priv_data; - int pal_size; + buffer_size_t pal_size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size); AVFrame *frame = data; int ret; diff --git a/libavcodec/imx.c b/libavcodec/imx.c index 982175d8c0..0d6c99e5bf 100644 --- a/libavcodec/imx.c +++ b/libavcodec/imx.c @@ -49,7 +49,8 @@ static int imx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { SimbiosisIMXContext *imx = avctx->priv_data; - int ret, x, y, pal_size; + int ret, x, y; + buffer_size_t pal_size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size); AVFrame *frame = imx->frame; GetByteContext gb; diff --git a/libavcodec/interplayvideo.c b/libavcodec/interplayvideo.c index 58400b6ace..4d16fdf619 100644 --- a/libavcodec/interplayvideo.c +++ b/libavcodec/interplayvideo.c @@ -1317,7 +1317,7 @@ static int ipvideo_decode_frame(AVCodecContext *avctx, return ret; if (!s->is_16bpp) { - int size; + buffer_size_t size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); if (pal && size == AVPALETTE_SIZE) { frame->palette_has_changed = 1; diff --git a/libavcodec/kmvc.c b/libavcodec/kmvc.c index ffe6a142e9..0d96139220 100644 --- a/libavcodec/kmvc.c +++ b/libavcodec/kmvc.c @@ -268,7 +268,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame, int i, ret; int header; int blocksize; - int pal_size; + buffer_size_t pal_size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size); bytestream2_init(&ctx->g, avpkt->data, avpkt->size); diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c index 3e320446f8..86982325a7 100644 --- a/libavcodec/libvpxdec.c +++ b/libavcodec/libvpxdec.c @@ -221,7 +221,7 @@ static int vpx_decode(AVCodecContext *avctx, struct vpx_image *img, *img_alpha; int ret; uint8_t *side_data = NULL; - int side_data_size; + buffer_size_t side_data_size; ret = decode_frame(avctx, &ctx->decoder, avpkt->data, avpkt->size); if (ret) diff --git a/libavcodec/mscc.c b/libavcodec/mscc.c index 86e4e88ed3..fe02649623 100644 --- a/libavcodec/mscc.c +++ b/libavcodec/mscc.c @@ -152,7 +152,7 @@ static int decode_frame(AVCodecContext *avctx, } if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { - int size; + buffer_size_t size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); if (pal && size == AVPALETTE_SIZE) { diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c index 9233b34cc5..feea2b60bb 100644 --- a/libavcodec/msrle.c +++ b/libavcodec/msrle.c @@ -97,7 +97,7 @@ static int msrle_decode_frame(AVCodecContext *avctx, return ret; if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) { - int size; + buffer_size_t size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); if (pal && size == AVPALETTE_SIZE) { diff --git a/libavcodec/msvideo1.c b/libavcodec/msvideo1.c index c9bcce552d..b4b5ea4666 100644 --- a/libavcodec/msvideo1.c +++ b/libavcodec/msvideo1.c @@ -314,7 +314,7 @@ static int msvideo1_decode_frame(AVCodecContext *avctx, return ret; if (s->mode_8bit) { - int size; + buffer_size_t size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); if (pal && size == AVPALETTE_SIZE) { diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index 23c84d9acf..d6b6608866 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -242,7 +242,7 @@ fail: return ret; } -static AVBufferRef *nvdec_decoder_frame_alloc(void *opaque, int size) +static AVBufferRef *nvdec_decoder_frame_alloc(void *opaque, buffer_size_t size) { NVDECFramePool *pool = opaque; AVBufferRef *ret; @@ -283,7 +283,7 @@ static void nvdec_free_dummy(struct AVHWFramesContext *ctx) av_buffer_pool_uninit(&ctx->pool); } -static AVBufferRef *nvdec_alloc_dummy(int size) +static AVBufferRef *nvdec_alloc_dummy(buffer_size_t size) { return av_buffer_create(NULL, 0, NULL, NULL, 0); } diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c index 8bc710acfd..f4edc4b16f 100644 --- a/libavcodec/qpeg.c +++ b/libavcodec/qpeg.c @@ -274,7 +274,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame * const ref = a->ref; uint8_t* outdata; int delta, intra, ret; - int pal_size; + buffer_size_t pal_size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size); if (avpkt->size < 0x86) { diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c index 6bdde75df4..e04fd31431 100644 --- a/libavcodec/qtrle.c +++ b/libavcodec/qtrle.c @@ -540,7 +540,7 @@ static int qtrle_decode_frame(AVCodecContext *avctx, } if(has_palette) { - int size; + buffer_size_t size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); if (pal && size == AVPALETTE_SIZE) { diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index 26663cabc2..c18c3dd3e1 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -367,7 +367,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, } if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { - int pal_size; + buffer_size_t pal_size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size); int ret; diff --git a/libavcodec/rscc.c b/libavcodec/rscc.c index 07a7c3dca3..79b02da441 100644 --- a/libavcodec/rscc.c +++ b/libavcodec/rscc.c @@ -346,7 +346,7 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data, /* Palette handling */ if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { - int size; + buffer_size_t size; const uint8_t *palette = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); diff --git a/libavcodec/smc.c b/libavcodec/smc.c index 342ebb71d1..33581bbf81 100644 --- a/libavcodec/smc.c +++ b/libavcodec/smc.c @@ -435,7 +435,7 @@ static int smc_decode_frame(AVCodecContext *avctx, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; SmcContext *s = avctx->priv_data; - int pal_size; + buffer_size_t pal_size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &pal_size); int ret; int total_blocks = ((s->avctx->width + 3) / 4) * ((s->avctx->height + 3) / 4); diff --git a/libavcodec/srtdec.c b/libavcodec/srtdec.c index ecc0801595..98f84ac673 100644 --- a/libavcodec/srtdec.c +++ b/libavcodec/srtdec.c @@ -58,7 +58,8 @@ static int srt_decode_frame(AVCodecContext *avctx, AVSubtitle *sub = data; AVBPrint buffer; int x1 = -1, y1 = -1, x2 = -1, y2 = -1; - int size, ret; + int ret; + buffer_size_t size; const uint8_t *p = av_packet_get_side_data(avpkt, AV_PKT_DATA_SUBTITLE_POSITION, &size); FFASSDecoderContext *s = avctx->priv_data; diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c index 6d03081bb0..d33639f3a4 100644 --- a/libavcodec/tscc.c +++ b/libavcodec/tscc.c @@ -72,7 +72,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, int palette_has_changed = 0; if (c->avctx->pix_fmt == AV_PIX_FMT_PAL8) { - int size; + buffer_size_t size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); if (pal && size == AVPALETTE_SIZE) { diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 518e5b2c00..3c57c07f67 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -21,6 +21,7 @@ #include "libavutil/avassert.h" #include "libavutil/common.h" +#include "libavutil/internal.h" #include "libavutil/log.h" #include "libavutil/pixdesc.h" @@ -2234,7 +2235,7 @@ static void vaapi_encode_free_output_buffer(void *opaque, } static AVBufferRef *vaapi_encode_alloc_output_buffer(void *opaque, - int size) + buffer_size_t size) { AVCodecContext *avctx = opaque; VAAPIEncodeContext *ctx = avctx->priv_data; From patchwork Sat Mar 6 19:42:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 26223 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id BD34E44B9AF for ; Sat, 6 Mar 2021 21:43:24 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A377868A9FC; Sat, 6 Mar 2021 21:43:24 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3AD9468A98D for ; Sat, 6 Mar 2021 21:43:16 +0200 (EET) Received: by mail-qk1-f173.google.com with SMTP id a9so5508879qkn.13 for ; Sat, 06 Mar 2021 11:43:16 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=sEZRSIkGaKDQddLuI0atC/7Zu+tEu22c4y0hMUlfxHk=; b=qb+rTN8OEKOy+usviTltG5IPaxfrL796elHP5On1XWTHp/dUhX4PpOLCf0zEN9eahn iO0aNAoprFzI+DPgK2/nwZ3Ecqa1uRBqbuI3R/1EH/aG8mLCz1CgUCx95mZYmT3OqTfQ LMixxo9jRa+5CLQoItLrgHK+kmkTHJWEe3bjYefANC2rfIuZstJPrEj6Nu30A/DEoEIc nneCiXpqbcE1+auDJ6Fu5PCL3AedbnZ5tFbM7LOuzGETR21Jm6kGwkA1vMO8CS4ulOdn lqqsDLRXxyzsrqYHRyS4+JlxOGPNzjgRAVd2MFp0OFHoet3WaApsiwOtURMZxY8S05pJ +dfA== 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:mime-version:content-transfer-encoding; bh=sEZRSIkGaKDQddLuI0atC/7Zu+tEu22c4y0hMUlfxHk=; b=DGPjH0oR4I29CElAZJs82MobkYyG7DGGN7UjIVzeY0aOeXvU/QlH2UNI+yIBxi0K3C 2YrjFjlnueieRCb1JL159+2q71l1lcFDeWD8xIxIvpCeAVKpfuxLjUzIClM4ymbpkO/V G72+pQdAJDQEn3vQ8OU6Zt7ALPtScrGlwwZXKTj5s1F5U7OQgZj4HUYS6pS2isqjAYPP 8o9/c+brM0XYpJFvI371ItwJ1SoBZMnVo5hms8DbsxcJ8uoWz8NZD1FLmKeA/vR51S4x 9u2SvAORBmUtfrhxU/kL1mFnp1d4EnxcpUChRCP0D8YujmkHtz0zXE/oMqzf+oFq/5nU TlNw== X-Gm-Message-State: AOAM531amV3yr2X9tVwQDKf2lseRUWHD9Q3BkHAmHjjtnYjWDPofHUum 0lvv4lNRwaiGD1t92J4yueGY/x7fc5s0qg== X-Google-Smtp-Source: ABdhPJyRKSKGALnLTTtNbXszDPTX0TX6RtVK8eVZNQoD5EJ8Z8vOkMmXl6qUv4NcToXJW1WwcEzqZA== X-Received: by 2002:a37:6889:: with SMTP id d131mr14327970qkc.264.1615059794542; Sat, 06 Mar 2021 11:43:14 -0800 (PST) Received: from localhost.localdomain ([181.23.89.132]) by smtp.gmail.com with ESMTPSA id s19sm4376601qks.130.2021.03.06.11.43.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Mar 2021 11:43:14 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sat, 6 Mar 2021 16:42:40 -0300 Message-Id: <20210306194243.14931-6-jamrial@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210306194243.14931-1-jamrial@gmail.com> References: <20210306194243.14931-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/9] avformat: use the buffer_size_t typedef where required 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: James Almer --- libavformat/adtsenc.c | 3 ++- libavformat/apngenc.c | 2 +- libavformat/dashenc.c | 5 +++-- libavformat/flacenc.c | 2 +- libavformat/flvenc.c | 2 +- libavformat/latmenc.c | 3 ++- libavformat/matroskaenc.c | 9 ++++++--- libavformat/mov.c | 3 ++- libavformat/movenc.c | 12 +++++++----- libavformat/mp3enc.c | 5 +++-- libavformat/mpegtsenc.c | 4 ++-- libavformat/rtpenc.c | 2 +- libavformat/segment.c | 2 +- libavformat/srtenc.c | 3 ++- libavformat/utils.c | 2 +- libavformat/webvttenc.c | 2 +- 16 files changed, 36 insertions(+), 25 deletions(-) diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index 44ff5a70ee..3595cb3bb2 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -170,7 +170,8 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; if (!par->extradata_size) { uint8_t *side_data; - int side_data_size, ret; + buffer_size_t side_data_size; + int ret; side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_data_size); diff --git a/libavformat/apngenc.c b/libavformat/apngenc.c index 7ad6a923d5..7e86f45143 100644 --- a/libavformat/apngenc.c +++ b/libavformat/apngenc.c @@ -119,7 +119,7 @@ static int flush_packet(AVFormatContext *format_context, AVPacket *packet) AVIOContext *io_context = format_context->pb; AVStream *codec_stream = format_context->streams[0]; uint8_t *side_data = NULL; - int side_data_size; + buffer_size_t side_data_size; av_assert0(apng->prev_packet); diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 2d757b3a87..81a5c2b452 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -1815,7 +1815,8 @@ static int update_stream_extradata(AVFormatContext *s, OutputStream *os, { AVCodecParameters *par = os->ctx->streams[0]->codecpar; uint8_t *extradata; - int ret, extradata_size; + buffer_size_t extradata_size; + int ret; if (par->extradata_size) return 0; @@ -2030,7 +2031,7 @@ static int dash_parse_prft(DASHContext *c, AVPacket *pkt) { OutputStream *os = &c->streams[pkt->stream_index]; AVProducerReferenceTime *prft; - int side_data_size; + buffer_size_t side_data_size; prft = (AVProducerReferenceTime *)av_packet_get_side_data(pkt, AV_PKT_DATA_PRFT, &side_data_size); if (!prft || side_data_size != sizeof(AVProducerReferenceTime) || (prft->flags && prft->flags != 24)) { diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index 1c983486aa..088f347bbf 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -280,7 +280,7 @@ static int flac_write_audio_packet(struct AVFormatContext *s, AVPacket *pkt) { FlacMuxerContext *c = s->priv_data; uint8_t *streaminfo; - int streaminfo_size; + buffer_size_t streaminfo_size; /* check for updated streaminfo */ streaminfo = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 1cfcdc6392..35bf7ace5e 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -902,7 +902,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4) { - int side_size; + buffer_size_t side_size; uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) { ret = ff_alloc_extradata(par, side_size); diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c index 701c3932c4..91e96e90b0 100644 --- a/libavformat/latmenc.c +++ b/libavformat/latmenc.c @@ -176,7 +176,8 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt) return ff_raw_write_packet(s, pkt); else { uint8_t *side_data; - int side_data_size, ret; + buffer_size_t side_data_size; + int ret; side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_data_size); diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 367e05b36b..1749b7fd37 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -2023,7 +2023,8 @@ static int mkv_write_block(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar; mkv_track *track = &mkv->tracks[pkt->stream_index]; uint8_t *data = NULL, *side_data = NULL; - int err = 0, offset = 0, size = pkt->size, side_data_size; + buffer_size_t side_data_size; + int err = 0, offset = 0, size = pkt->size; int64_t ts = track->write_dts ? pkt->dts : pkt->pts; uint64_t additional_id; int64_t discard_padding = 0; @@ -2133,7 +2134,8 @@ static int mkv_write_vtt_blocks(AVFormatContext *s, AVIOContext *pb, const AVPac MatroskaMuxContext *mkv = s->priv_data; mkv_track *track = &mkv->tracks[pkt->stream_index]; ebml_master blockgroup; - int id_size, settings_size, size; + buffer_size_t id_size, settings_size; + int size; const char *id, *settings; int64_t ts = track->write_dts ? pkt->dts : pkt->pts; const int flags = 0; @@ -2198,7 +2200,8 @@ static int mkv_check_new_extra_data(AVFormatContext *s, const AVPacket *pkt) mkv_track *track = &mkv->tracks[pkt->stream_index]; AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar; uint8_t *side_data; - int side_data_size, ret; + buffer_size_t side_data_size; + int ret; side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_data_size); diff --git a/libavformat/mov.c b/libavformat/mov.c index 1c07cff6b5..23b0ead01e 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -6375,7 +6375,8 @@ static int mov_read_pssh(MOVContext *c, AVIOContext *pb, MOVAtom atom) AVStream *st; uint8_t *side_data, *extra_data, *old_side_data; size_t side_data_size; - int ret = 0, old_side_data_size; + buffer_size_t old_side_data_size; + int ret = 0; unsigned int version, kid_count, extra_data_size, alloc_size = 0; if (c->fc->nb_streams < 1) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index ccb9768564..1f0aaf5bc5 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1978,7 +1978,7 @@ static int mov_write_colr_tag(AVIOContext *pb, MOVTrack *track, int prefer_icc) // Ref (MP4): ISO/IEC 14496-12:2012 const uint8_t *icc_profile; - int icc_profile_size; + buffer_size_t icc_profile_size; if (prefer_icc) { icc_profile = av_stream_get_side_data(track->st, AV_PKT_DATA_ICC_PROFILE, &icc_profile_size); @@ -3033,7 +3033,8 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov, int group = 0; uint32_t *display_matrix = NULL; - int display_matrix_size, i; + buffer_size_t display_matrix_size; + int i; if (st) { if (mov->per_stream_grouping) @@ -4173,7 +4174,8 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, track->tref_tag = MKTAG('h','i','n','t'); track->tref_id = mov->tracks[track->src_track].track_id; } else if (track->par->codec_type == AVMEDIA_TYPE_AUDIO) { - int * fallback, size; + buffer_size_t size; + int *fallback; fallback = (int*)av_stream_get_side_data(track->st, AV_PKT_DATA_FALLBACK_TRACK, &size); @@ -5556,7 +5558,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) AVProducerReferenceTime *prft; unsigned int samples_in_chunk = 0; int size = pkt->size, ret = 0, offset = 0; - int prft_size; + buffer_size_t prft_size; uint8_t *reformatted_data = NULL; ret = check_pkt(s, pkt); @@ -5908,7 +5910,7 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt) trk->par->codec_id == AV_CODEC_ID_AAC || trk->par->codec_id == AV_CODEC_ID_AV1 || trk->par->codec_id == AV_CODEC_ID_FLAC) { - int side_size; + buffer_size_t side_size; uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) { void *newextra = av_mallocz(side_size + AV_INPUT_BUFFER_PADDING_SIZE); diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index 4f91c4f1c3..ce503e3473 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -355,7 +355,7 @@ static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt) if (mp3->xing_offset) { uint8_t *side_data = NULL; - int side_data_size; + buffer_size_t side_data_size; mp3_xing_add_frame(mp3, pkt); mp3->audio_size += pkt->size; @@ -402,7 +402,8 @@ static void mp3_update_xing(AVFormatContext *s) AVReplayGain *rg; uint16_t tag_crc; uint8_t *toc; - int i, rg_size; + buffer_size_t rg_size; + int i; int64_t old_pos = avio_tell(s->pb); /* replace "Xing" identification string with "Info" for CBR files. */ diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 45f8d5f373..8158a20497 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -1677,7 +1677,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) const int64_t max_audio_delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE) / 2; int64_t dts = pkt->dts, pts = pkt->pts; int opus_samples = 0; - int side_data_size; + buffer_size_t side_data_size; uint8_t *side_data = NULL; int stream_id = -1; @@ -1814,7 +1814,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) /* Add Opus control header */ if ((AV_RB16(pkt->data) >> 5) != 0x3ff) { uint8_t *side_data; - int side_data_size; + buffer_size_t side_data_size; int i, n; int ctrl_header_size; int trim_start = 0, trim_end = 0; diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c index 9ef7e9094d..38e4c65c4e 100644 --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@ -589,7 +589,7 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt) break; case AV_CODEC_ID_H263: if (s->flags & FF_RTP_FLAG_RFC2190) { - int mb_info_size; + buffer_size_t mb_info_size; const uint8_t *mb_info = av_packet_get_side_data(pkt, AV_PKT_DATA_H263_MB_INFO, &mb_info_size); diff --git a/libavformat/segment.c b/libavformat/segment.c index dff3d0ed48..5265ecaebb 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -859,7 +859,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR(EINVAL); if (!st->codecpar->extradata_size) { - int pkt_extradata_size; + buffer_size_t pkt_extradata_size; uint8_t *pkt_extradata = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &pkt_extradata_size); if (pkt_extradata && pkt_extradata_size > 0) { ret = ff_alloc_extradata(st->codecpar, pkt_extradata_size); diff --git a/libavformat/srtenc.c b/libavformat/srtenc.c index d811a4da0e..484dd4d230 100644 --- a/libavformat/srtenc.c +++ b/libavformat/srtenc.c @@ -61,7 +61,8 @@ static int srt_write_packet(AVFormatContext *avf, AVPacket *pkt) SRTContext *srt = avf->priv_data; int64_t s = pkt->pts, e, d = pkt->duration; - int size, x1 = -1, y1 = -1, x2 = -1, y2 = -1; + buffer_size_t size; + int x1 = -1, y1 = -1, x2 = -1, y2 = -1; const uint8_t *p; p = av_packet_get_side_data(pkt, AV_PKT_DATA_SUBTITLE_POSITION, &size); diff --git a/libavformat/utils.c b/libavformat/utils.c index 98e6c55602..8573117694 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -5698,7 +5698,7 @@ int ff_standardize_creation_time(AVFormatContext *s) int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, uint32_t *palette) { uint8_t *side_data; - int size; + buffer_size_t size; side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PALETTE, &size); if (side_data) { diff --git a/libavformat/webvttenc.c b/libavformat/webvttenc.c index cbd989dcb6..552bc38b65 100644 --- a/libavformat/webvttenc.c +++ b/libavformat/webvttenc.c @@ -64,7 +64,7 @@ static int webvtt_write_header(AVFormatContext *ctx) static int webvtt_write_packet(AVFormatContext *ctx, AVPacket *pkt) { AVIOContext *pb = ctx->pb; - int id_size, settings_size; + buffer_size_t id_size, settings_size; uint8_t *id, *settings; avio_printf(pb, "\n"); From patchwork Sat Mar 6 19:42:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 26224 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id E455144B9AF for ; Sat, 6 Mar 2021 21:43:25 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C91B568AA16; Sat, 6 Mar 2021 21:43:25 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 68D6E68A957 for ; Sat, 6 Mar 2021 21:43:17 +0200 (EET) Received: by mail-qt1-f179.google.com with SMTP id h26so228088qtm.5 for ; Sat, 06 Mar 2021 11:43:17 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=OJ8vWLyuInmYq7pq3/NRrufBFAdg95O7vrB9m4quU4c=; b=E2bNusL+tnQm4SN9xQuvn2yzOm/RFCatBqhHP1Qwl2ACJtwzZI9VuJWUUU57w1QMsS JVR/63/7jy7/SgCB+i5L+rae56n0Ggvqfg2wn0f73fMBUPdzUDTXUjpzTseLT7gCuUFA 2hhyH+fPHJW1ox8wCZYB5xoDwCkTItWqkzXpXbT+GEmBcTOimeTGrspJjyi/rblpuNuf 7ACK+cMCiIeI+1FOhb50fBX8m/LRjoqG0nxtO/+6uREbIXyvKyCnCoIycB6+z14N8WVx 3P3zDz+5sRRibqMJmQ3mdYI7w6xC5xcIc6KABAkwO4+DDT3hE4+MmTwyuhX1HO5JxM4v ezrA== 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:mime-version:content-transfer-encoding; bh=OJ8vWLyuInmYq7pq3/NRrufBFAdg95O7vrB9m4quU4c=; b=T2TO/q1VTm1UEkQk5t8dHy4Kl36Cmc+nClcwU14TqO0nRcw+7GMoKMRfDBDdWbRwl3 T1E+NRudwkTp1IdAQpF2RM0r11zYgK/vU/5cNS8XbK1+CHx13AyLqYmsxUjiSIXXFPV9 Jarithn5obeYh1F5D466CgbPbsXIqAHZOBakMFRRbbb3SyXDFmBcMus+Gsk8rInBxPfg vI57n1O3AFmotzfDKXlkCWH5TudW9o1twELdHMPPCkGiAXC1II+gLkg2YbTXChp3kOpm trqT+p0On4yD0QbUZTrTZYIadNQDjyYBrkuwh9Jq/YTrwf5FMMlcJOhIHkOo1+0ymJoQ wSHQ== X-Gm-Message-State: AOAM530PU+7GbTkYvQdwJOJCiL9dvaHTx0R/2AjmtoZwCA2k5VOoCdvz i1IYc1uqs9q2oc8go4ZKBob9MM0pwtsh7A== X-Google-Smtp-Source: ABdhPJxfuwUhhQnKYZe+tIkD/0LCLJk8k+vmsQCJFRef2z2gZ4SVbTAJLbmX76cob0OnyFDaahVA+Q== X-Received: by 2002:aed:38a6:: with SMTP id k35mr12346164qte.280.1615059795793; Sat, 06 Mar 2021 11:43:15 -0800 (PST) Received: from localhost.localdomain ([181.23.89.132]) by smtp.gmail.com with ESMTPSA id s19sm4376601qks.130.2021.03.06.11.43.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Mar 2021 11:43:15 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sat, 6 Mar 2021 16:42:41 -0300 Message-Id: <20210306194243.14931-7-jamrial@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210306194243.14931-1-jamrial@gmail.com> References: <20210306194243.14931-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 7/9] avdevice: use the buffer_size_t typedef where required 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: James Almer --- libavdevice/decklink_dec.cpp | 2 +- libavdevice/decklink_enc.cpp | 3 ++- libavdevice/xcbgrab.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp index 4f8103e614..6c0a338fca 100644 --- a/libavdevice/decklink_dec.cpp +++ b/libavdevice/decklink_dec.cpp @@ -1437,7 +1437,7 @@ int ff_decklink_read_packet(AVFormatContext *avctx, AVPacket *pkt) avpacket_queue_get(&ctx->queue, pkt, 1); if (ctx->tc_format && !(av_dict_get(ctx->video_st->metadata, "timecode", NULL, 0))) { - int size; + buffer_size_t size; const uint8_t *side_metadata = av_packet_get_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA, &size); if (side_metadata) { if (av_packet_unpack_dictionary(side_metadata, size, &ctx->video_st->metadata) < 0) diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp index 6c73968d5f..df901b0d68 100644 --- a/libavdevice/decklink_enc.cpp +++ b/libavdevice/decklink_enc.cpp @@ -312,7 +312,8 @@ static void construct_cc(AVFormatContext *avctx, struct decklink_ctx *ctx, uint16_t *cdp_words; uint16_t len; uint8_t cc_count; - int size, ret, i; + buffer_size_t size; + int ret, i; const uint8_t *data = av_packet_get_side_data(pkt, AV_PKT_DATA_A53_CC, &size); if (!data) diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c index 9604a5aaf2..f9ea5a56b2 100644 --- a/libavdevice/xcbgrab.c +++ b/libavdevice/xcbgrab.c @@ -236,7 +236,7 @@ static void free_shm_buffer(void *opaque, uint8_t *data) shmdt(data); } -static AVBufferRef *allocate_shm_buffer(void *opaque, int size) +static AVBufferRef *allocate_shm_buffer(void *opaque, buffer_size_t size) { xcb_connection_t *conn = opaque; xcb_shm_seg_t segment; From patchwork Sat Mar 6 19:42:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 26225 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id D489D44B9AF for ; Sat, 6 Mar 2021 21:43:26 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AD9F768AA48; Sat, 6 Mar 2021 21:43:26 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7B4FD68A957 for ; Sat, 6 Mar 2021 21:43:18 +0200 (EET) Received: by mail-qt1-f178.google.com with SMTP id 18so4608339qty.3 for ; Sat, 06 Mar 2021 11:43:18 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=wjL3VIj7ZPII0dZ6USXuHWyuH2Uv7hxNqmsTYHRPqIE=; b=kLkIDMF/p+dIS2Z+FTFOy8oVECmYGWp4iA8LrlQ9QVysZosYF0fxVY/+sscPDMHfIk aNCRVzP3WojU43DPtks/FL0m3rJxeGx93k+LaWRLduY8NXWqegMC169WgbSE2sowhAnG fqgcWGKoA3FlmEXgJulvg0lC90yI693eIQMVJz5GXZ+oVw1AWBfxu/U0aIBbv0tSOki6 uc+ND5RqjYZ7nBDUv43ga7wAChdcsn/unkeD7XmpMdXqoxlo2AjepWw+PS5AgbtnOdH1 Sc9olIDq4SPFF7hQ5pjjifSFysPbiYxAydwCKrCYe8D0y4yd3/JQg7hKxCsb8iyNulqb nsBg== 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:mime-version:content-transfer-encoding; bh=wjL3VIj7ZPII0dZ6USXuHWyuH2Uv7hxNqmsTYHRPqIE=; b=hKrBsBXoQnasfXpglR6aL3Cn3XbwiVOjAo+r7THx/K/xafcylqQGTDRXdW8t9AsO2D 830sC1gw07v7e/vPvHzGd/UKXOD0wklS89j+PDjp6NK8qPPRSnGsL33xQtXAm0Fx86O2 U9NX6goaGEvLTkIVd+IF6TY9mRD/HYE5ozDsd3bN4Ey8Mv7ZxtmT4wsU0cuamlDi+EKb PJxbWar1zvcI7Qtdv77I0rf9lBPBOMkxZJ92ofqCX/aEkCym+ehJYlzpA3Vj2bS3SpuV AeG+C+7lB2B8CzXGLU/lJzAAG8NO9Q8LzNQgk8MemQs3rYZ5oxPG1XMliCN4vgsozmmy HT6Q== X-Gm-Message-State: AOAM533s0RGJlDNshcRIa/w2OLeENM2RVH3OLJKrPXisVsRsZzTDtpDY oz+EMgmDcXh2Tclh3PoRfc7OzPGECRvc5g== X-Google-Smtp-Source: ABdhPJzGyp5T0vBaBxWJWb4J1FoAbOOBAeSFNryglyfx+uH1bw4aR4pWgTv04dPMaocwg7PE7tAfMw== X-Received: by 2002:ac8:7089:: with SMTP id y9mr11837991qto.264.1615059797060; Sat, 06 Mar 2021 11:43:17 -0800 (PST) Received: from localhost.localdomain ([181.23.89.132]) by smtp.gmail.com with ESMTPSA id s19sm4376601qks.130.2021.03.06.11.43.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Mar 2021 11:43:16 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sat, 6 Mar 2021 16:42:42 -0300 Message-Id: <20210306194243.14931-8-jamrial@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210306194243.14931-1-jamrial@gmail.com> References: <20210306194243.14931-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 8/9] avfilter: use the buffer_size_t typedef where required 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: James Almer --- libavfilter/framepool.c | 4 ++-- libavfilter/framepool.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c index 3b178cebb8..dab8891524 100644 --- a/libavfilter/framepool.c +++ b/libavfilter/framepool.c @@ -48,7 +48,7 @@ struct FFFramePool { }; -FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(int size), +FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(buffer_size_t size), int width, int height, enum AVPixelFormat format, @@ -116,7 +116,7 @@ fail: return NULL; } -FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(int size), +FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(buffer_size_t size), int channels, int nb_samples, enum AVSampleFormat format, diff --git a/libavfilter/framepool.h b/libavfilter/framepool.h index e5560e4c6e..28857a4a16 100644 --- a/libavfilter/framepool.h +++ b/libavfilter/framepool.h @@ -23,6 +23,7 @@ #include "libavutil/buffer.h" #include "libavutil/frame.h" +#include "libavutil/internal.h" /** * Frame pool. This structure is opaque and not meant to be accessed @@ -43,7 +44,7 @@ typedef struct FFFramePool FFFramePool; * @param align buffers alignement of each frame in this pool * @return newly created video frame pool on success, NULL on error. */ -FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(int size), +FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(buffer_size_t size), int width, int height, enum AVPixelFormat format, @@ -61,7 +62,7 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(int size), * @param align buffers alignement of each frame in this pool * @return newly created audio frame pool on success, NULL on error. */ -FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(int size), +FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(buffer_size_t size), int channels, int samples, enum AVSampleFormat format, From patchwork Sat Mar 6 19:42:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 26226 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 0049F44B9AF for ; Sat, 6 Mar 2021 21:43:28 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E536068AA53; Sat, 6 Mar 2021 21:43:27 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CE08868AA1F for ; Sat, 6 Mar 2021 21:43:19 +0200 (EET) Received: by mail-qt1-f172.google.com with SMTP id h26so228178qtm.5 for ; Sat, 06 Mar 2021 11:43:19 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=of0s46SfTjNmhluzffU+E+SSDnnL5dyh9caU7rbNAVs=; b=M/fKjAobMH+H/q9Vv5eZVlfUaGdbretyENp4kJk4yhjj+T+QN1JYhiSrPicX5wJAac loJHZ98hLx8M7sDQ9xHKh9qvy8p+FC5xnArUsJxSsRy8K7d7mB5p+G4glM88IAdP9q4Y LNif6ScFscZ3N5tzqK17ZjaZBXiJg4UBHwRAWhRlMJP3HmdnByEePXVpRMetYFKuzOiy QcM07/x49WlLpQ/vGHtLz/McEyROAXSYOjozs/0acH13/RDasFUSojqydI171g1nNrl2 DLr6VukbgvmNI9rsUJnOIxU4Mul9QbLnQ6qYR44xV/aW2+sVjCETveNZRniIhVMnE2es MLkg== 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:mime-version:content-transfer-encoding; bh=of0s46SfTjNmhluzffU+E+SSDnnL5dyh9caU7rbNAVs=; b=uB1ZOdU/Ucyt5cMSYrrkWoqu0WTHKMGMgG2nC1qPXxxhNyJmLKp5uRnWNToEQxOi6G c2OrKG0izdsEsx53uEn655G1B30RB7EDS9y+tH0ts7PP6oI4k2/hlRKVcu8N9sR11bWc woItMiJ+jDkSbrqdgHrjXD2LenXkUb/BeRncy8bBwQj1n1JJNgteSSl83+oXebb1KBVS xq62bxNEoitcIBs6nHNbVm+FdZ0mS37N2woVn8csWFnc3y3QkUso/brdnesop72a0wKR yOb6AmH+sOIDidH0A8Sn14qHhXxB2BoR6Cw8HsgN258Sy0OMWl1UEIfXHhexxHjaUPlo 1dnQ== X-Gm-Message-State: AOAM531R93rMmfjxc61JUm6e46TvsHPIzPfzOAKnpUa6fy76+PFhg4Kd +dCB4UqxS0f00KPL5GL2YiZz7O/HC5CS6w== X-Google-Smtp-Source: ABdhPJwqFDutOmHQN6AHVhAp+x68Y8m5p/28bmDcZt97Y4LZBWhy2K3gvS7HFGYx2JZqpGVOqb04Uw== X-Received: by 2002:ac8:5a0d:: with SMTP id n13mr13897439qta.345.1615059798311; Sat, 06 Mar 2021 11:43:18 -0800 (PST) Received: from localhost.localdomain ([181.23.89.132]) by smtp.gmail.com with ESMTPSA id s19sm4376601qks.130.2021.03.06.11.43.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Mar 2021 11:43:17 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sat, 6 Mar 2021 16:42:43 -0300 Message-Id: <20210306194243.14931-9-jamrial@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210306194243.14931-1-jamrial@gmail.com> References: <20210306194243.14931-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 9/9] avutil: use the buffer_size_t typedef where required 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: James Almer --- libavutil/hwcontext_cuda.c | 2 +- libavutil/hwcontext_d3d11va.c | 2 +- libavutil/hwcontext_dxva2.c | 2 +- libavutil/hwcontext_opencl.c | 2 +- libavutil/hwcontext_qsv.c | 2 +- libavutil/hwcontext_vaapi.c | 2 +- libavutil/hwcontext_vdpau.c | 2 +- libavutil/hwcontext_vulkan.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c index 58ffc81378..3773cd9eb8 100644 --- a/libavutil/hwcontext_cuda.c +++ b/libavutil/hwcontext_cuda.c @@ -93,7 +93,7 @@ static void cuda_buffer_free(void *opaque, uint8_t *data) CHECK_CU(cu->cuCtxPopCurrent(&dummy)); } -static AVBufferRef *cuda_pool_alloc(void *opaque, int size) +static AVBufferRef *cuda_pool_alloc(void *opaque, buffer_size_t size) { AVHWFramesContext *ctx = opaque; AVHWDeviceContext *device_ctx = ctx->device_ctx; diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index c8ae58f908..2a3549ebd8 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -202,7 +202,7 @@ static AVBufferRef *d3d11va_alloc_single(AVHWFramesContext *ctx) return wrap_texture_buf(tex, 0); } -static AVBufferRef *d3d11va_pool_alloc(void *opaque, int size) +static AVBufferRef *d3d11va_pool_alloc(void *opaque, buffer_size_t size) { AVHWFramesContext *ctx = (AVHWFramesContext*)opaque; D3D11VAFramesContext *s = ctx->internal->priv; diff --git a/libavutil/hwcontext_dxva2.c b/libavutil/hwcontext_dxva2.c index 64366cea89..33b3dc80ff 100644 --- a/libavutil/hwcontext_dxva2.c +++ b/libavutil/hwcontext_dxva2.c @@ -124,7 +124,7 @@ static void dxva2_pool_release_dummy(void *opaque, uint8_t *data) // released in dxva2_frames_uninit() } -static AVBufferRef *dxva2_pool_alloc(void *opaque, int size) +static AVBufferRef *dxva2_pool_alloc(void *opaque, buffer_size_t size) { AVHWFramesContext *ctx = (AVHWFramesContext*)opaque; DXVA2FramesContext *s = ctx->internal->priv; diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c index cd8638abbb..ee814602b2 100644 --- a/libavutil/hwcontext_opencl.c +++ b/libavutil/hwcontext_opencl.c @@ -1617,7 +1617,7 @@ static void opencl_pool_free(void *opaque, uint8_t *data) av_free(desc); } -static AVBufferRef *opencl_pool_alloc(void *opaque, int size) +static AVBufferRef *opencl_pool_alloc(void *opaque, buffer_size_t size) { AVHWFramesContext *hwfc = opaque; AVOpenCLDeviceContext *hwctx = hwfc->device_ctx->hwctx; diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index 35a944f8f8..30b0d81f84 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -194,7 +194,7 @@ static void qsv_pool_release_dummy(void *opaque, uint8_t *data) { } -static AVBufferRef *qsv_pool_alloc(void *opaque, int size) +static AVBufferRef *qsv_pool_alloc(void *opaque, buffer_size_t size) { AVHWFramesContext *ctx = (AVHWFramesContext*)opaque; QSVFramesContext *s = ctx->internal->priv; diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index 2227d6ed69..4b81bd1f67 100644 --- a/libavutil/hwcontext_vaapi.c +++ b/libavutil/hwcontext_vaapi.c @@ -464,7 +464,7 @@ static void vaapi_buffer_free(void *opaque, uint8_t *data) } } -static AVBufferRef *vaapi_pool_alloc(void *opaque, int size) +static AVBufferRef *vaapi_pool_alloc(void *opaque, buffer_size_t size) { AVHWFramesContext *hwfc = opaque; VAAPIFramesContext *ctx = hwfc->internal->priv; diff --git a/libavutil/hwcontext_vdpau.c b/libavutil/hwcontext_vdpau.c index 8f014eaba7..a6fd7126f3 100644 --- a/libavutil/hwcontext_vdpau.c +++ b/libavutil/hwcontext_vdpau.c @@ -225,7 +225,7 @@ static void vdpau_buffer_free(void *opaque, uint8_t *data) device_priv->surf_destroy(surf); } -static AVBufferRef *vdpau_pool_alloc(void *opaque, int size) +static AVBufferRef *vdpau_pool_alloc(void *opaque, buffer_size_t size) { AVHWFramesContext *ctx = opaque; VDPAUFramesContext *priv = ctx->internal->priv; diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index e835ffe90e..2e3faaaa1a 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -1693,7 +1693,7 @@ static void try_export_flags(AVHWFramesContext *hwfc, } } -static AVBufferRef *vulkan_pool_alloc(void *opaque, int size) +static AVBufferRef *vulkan_pool_alloc(void *opaque, buffer_size_t size) { int err; AVVkFrame *f;