[FFmpeg-cvslog] avcodec: use the buffer_size_t typedef where required
James Almer
git at videolan.org
Thu Mar 11 01:43:52 EET 2021
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sat Mar 6 13:29:37 2021 -0300| [d8a18c8fc2907004448cb45e704dc82bcd2df528] | committer: James Almer
avcodec: use the buffer_size_t typedef where required
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d8a18c8fc2907004448cb45e704dc82bcd2df528
---
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 2a60a16650..98f77a3ad7 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -3437,11 +3437,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 8f9a8d5c27..bf3e00959f 100644
--- a/libavcodec/audiotoolboxdec.c
+++ b/libavcodec/audiotoolboxdec.c
@@ -484,7 +484,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 082188195c..c7dbf7b791 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;
@@ -1709,7 +1710,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;
@@ -1755,7 +1756,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;
More information about the ffmpeg-cvslog
mailing list