summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-04-14 14:59:32 +0200
committerJames Almer <jamrial@gmail.com>2021-04-27 10:43:13 -0300
commitef6a9e5e311f09fa8032974fa4d0c1e166a959bb (patch)
treeb9b1893c45771cde9f36853685a5bc8a6b5cf27c
parent985c0dac674846721ec8ff23344c16ac7d1c9a1e (diff)
avutil/buffer: Switch AVBuffer API to size_t
Announced in 14040a1d913794d9a3fd6406a6d8c2f0e37e0062. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--fftools/ffprobe.c2
-rw-r--r--libavcodec/aacdec_template.c4
-rw-r--r--libavcodec/adxdec.c2
-rw-r--r--libavcodec/audiotoolboxdec.c2
-rw-r--r--libavcodec/avpacket.c28
-rw-r--r--libavcodec/cbs_bsf.c2
-rw-r--r--libavcodec/decode.c13
-rw-r--r--libavcodec/h264_metadata_bsf.c2
-rw-r--r--libavcodec/h264dec.c2
-rw-r--r--libavcodec/hevcdec.c2
-rw-r--r--libavcodec/libvpxdec.c2
-rw-r--r--libavcodec/mpeg12enc.c4
-rw-r--r--libavcodec/mscc.c5
-rw-r--r--libavcodec/nvdec.c4
-rw-r--r--libavcodec/packet.h24
-rw-r--r--libavcodec/srtdec.c2
-rw-r--r--libavcodec/vaapi_encode.c2
-rw-r--r--libavdevice/decklink_dec.cpp4
-rw-r--r--libavdevice/decklink_enc.cpp2
-rw-r--r--libavdevice/lavfi.c2
-rw-r--r--libavdevice/xcbgrab.c2
-rw-r--r--libavfilter/af_ashowinfo.c3
-rw-r--r--libavfilter/framepool.c4
-rw-r--r--libavfilter/framepool.h4
-rw-r--r--libavfilter/vf_showinfo.c10
-rw-r--r--libavformat/adtsenc.c2
-rw-r--r--libavformat/apngenc.c2
-rw-r--r--libavformat/avformat.h8
-rw-r--r--libavformat/concatdec.c2
-rw-r--r--libavformat/dashenc.c4
-rw-r--r--libavformat/dump.c4
-rw-r--r--libavformat/flacenc.c2
-rw-r--r--libavformat/flvenc.c2
-rw-r--r--libavformat/framecrcenc.c6
-rw-r--r--libavformat/hashenc.c7
-rw-r--r--libavformat/img2dec.c2
-rw-r--r--libavformat/latmenc.c2
-rw-r--r--libavformat/matroskaenc.c6
-rw-r--r--libavformat/mov.c3
-rw-r--r--libavformat/movenc.c10
-rw-r--r--libavformat/mp3enc.c4
-rw-r--r--libavformat/mpegtsenc.c4
-rw-r--r--libavformat/oggdec.h2
-rw-r--r--libavformat/rtpenc.c2
-rw-r--r--libavformat/segment.c2
-rw-r--r--libavformat/srtenc.c2
-rw-r--r--libavformat/utils.c6
-rw-r--r--libavformat/webvttdec.c2
-rw-r--r--libavformat/webvttenc.c2
-rw-r--r--libavutil/buffer.c14
-rw-r--r--libavutil/buffer.h29
-rw-r--r--libavutil/buffer_internal.h8
-rw-r--r--libavutil/detection_bbox.c4
-rw-r--r--libavutil/frame.c2
-rw-r--r--libavutil/frame.h8
-rw-r--r--libavutil/hwcontext_cuda.c2
-rw-r--r--libavutil/hwcontext_d3d11va.c2
-rw-r--r--libavutil/hwcontext_dxva2.c2
-rw-r--r--libavutil/hwcontext_opencl.c2
-rw-r--r--libavutil/hwcontext_qsv.c2
-rw-r--r--libavutil/hwcontext_vaapi.c2
-rw-r--r--libavutil/hwcontext_vdpau.c2
-rw-r--r--libavutil/hwcontext_vulkan.c2
-rw-r--r--libavutil/internal.h7
-rw-r--r--libavutil/version.h3
-rw-r--r--libavutil/video_enc_params.c4
66 files changed, 110 insertions, 206 deletions
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 13ed16431d..7b28f6b3ce 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2158,7 +2158,7 @@ static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int p
pkt->flags & AV_PKT_FLAG_DISCARD ? 'D' : '_');
if (pkt->side_data_elems) {
- int size;
+ size_t size;
const uint8_t *side_metadata;
side_metadata = av_packet_get_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA, &size);
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index 98f77a3ad7..d78e60ec2e 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;
- buffer_size_t new_extradata_size;
+ size_t new_extradata_size;
const uint8_t *new_extradata = av_packet_get_side_data(avpkt,
AV_PKT_DATA_NEW_EXTRADATA,
&new_extradata_size);
- buffer_size_t jp_dualmono_size;
+ 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 94de3eee19..eb05145da9 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;
- buffer_size_t new_extradata_size;
+ 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 fa55f58988..a4fb8c9120 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;
- buffer_size_t side_data_size;
+ 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 622b50d5eb..e32c467586 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -218,16 +218,12 @@ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
- buffer_size_t size)
+ 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)
@@ -243,7 +239,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,
- buffer_size_t *size)
+ size_t *size)
{
int i;
@@ -297,11 +293,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type)
return NULL;
}
-#if FF_API_BUFFER_SIZE_T
-uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size)
-#else
uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size)
-#endif
{
uint8_t *data = NULL;
*size = 0;
@@ -320,11 +312,7 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size)
if (pass)
memcpy(data + total_length, str, len);
-#if FF_API_BUFFER_SIZE_T
- else if (len > INT_MAX - total_length)
-#else
else if (len > SIZE_MAX - total_length)
-#endif
return NULL;
total_length += len;
}
@@ -340,12 +328,8 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size)
return data;
}
-#if FF_API_BUFFER_SIZE_T
-int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict)
-#else
int av_packet_unpack_dictionary(const uint8_t *data, size_t size,
AVDictionary **dict)
-#endif
{
const uint8_t *end;
int ret;
@@ -372,7 +356,7 @@ int av_packet_unpack_dictionary(const uint8_t *data, size_t size,
}
int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
- buffer_size_t size)
+ size_t size)
{
int i;
@@ -402,7 +386,7 @@ int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
dst->side_data_elems = 0;
for (i = 0; i < src->side_data_elems; i++) {
enum AVPacketSideDataType type = src->side_data[i].type;
- buffer_size_t size = src->side_data[i].size;
+ 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);
@@ -599,7 +583,7 @@ void avpriv_packet_list_free(PacketList **pkt_buf, PacketList **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;
- buffer_size_t side_data_size;
+ size_t side_data_size;
int i;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_QUALITY_STATS, &side_data_size);
@@ -625,7 +609,7 @@ int ff_side_data_set_prft(AVPacket *pkt, int64_t timestamp)
{
AVProducerReferenceTime *prft;
uint8_t *side_data;
- buffer_size_t side_data_size;
+ 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 f0f7dd79b5..0977d431f7 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;
- buffer_size_t side_data_size;
+ size_t side_data_size;
int err;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 9e5230ae1d..cd98c98a97 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -67,7 +67,7 @@ typedef struct FramePool {
static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt)
{
int ret;
- buffer_size_t size;
+ size_t size;
const uint8_t *data;
uint32_t flags;
int64_t val;
@@ -344,7 +344,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;
- buffer_size_t side_size;
+ size_t side_size;
uint32_t discard_padding = 0;
uint8_t skip_reason = 0;
uint8_t discard_reason = 0;
@@ -1463,7 +1463,7 @@ int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags
static int add_metadata_from_side_data(const AVPacket *avpkt, AVFrame *frame)
{
- buffer_size_t size;
+ size_t size;
const uint8_t *side_metadata;
AVDictionary **frame_md = &frame->metadata;
@@ -1502,7 +1502,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
frame->pkt_size = pkt->size;
for (int i = 0; i < FF_ARRAY_ELEMS(sd); i++) {
- buffer_size_t size;
+ 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,
@@ -1841,14 +1841,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
int ff_copy_palette(void *dst, const AVPacket *src, void *logctx)
{
- buffer_size_t size;
+ size_t size;
const void *pal = av_packet_get_side_data(src, AV_PKT_DATA_PALETTE, &size);
if (pal && size == AVPALETTE_SIZE) {
memcpy(dst, pal, AVPALETTE_SIZE);
return 1;
} else if (pal) {
- av_log(logctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
+ av_log(logctx, AV_LOG_ERROR,
+ "Palette size %"SIZE_SPECIFIER" is wrong\n", size);
}
return 0;
}
diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c
index 06d23e3142..ef74cba560 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;
- buffer_size_t size;
+ 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 e5b77abc6a..536020095c 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)) {
- buffer_size_t side_size;
+ 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 2231aed259..ad38f37187 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;
- buffer_size_t new_extradata_size;
+ size_t new_extradata_size;
uint8_t *new_extradata;
HEVCContext *s = avctx->priv_data;
diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
index 9b5728fba4..67d56fb05e 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;
- buffer_size_t side_data_size;
+ size_t side_data_size;
ret = decode_frame(avctx, &ctx->decoder, avpkt->data, avpkt->size);
if (ret)
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index fd3e7de94a..432d27e1f6 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -575,8 +575,8 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
put_bits(&s->pb, 8, 0xff); // marker_bits
} else {
av_log(s->avctx, AV_LOG_WARNING,
- "Warning Closed Caption size (%d) can not exceed 93 bytes "
- "and must be a multiple of 3\n", side_data->size);
+ "Closed Caption size (%"SIZE_SPECIFIER") can not exceed "
+ "93 bytes and must be a multiple of 3\n", side_data->size);
}
}
}
diff --git a/libavcodec/mscc.c b/libavcodec/mscc.c
index fe02649623..e685b2a32b 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) {
- buffer_size_t size;
+ size_t size;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
if (pal && size == AVPALETTE_SIZE) {
@@ -160,7 +160,8 @@ static int decode_frame(AVCodecContext *avctx,
for (j = 0; j < 256; j++)
s->pal[j] = 0xFF000000 | AV_RL32(pal + j * 4);
} else if (pal) {
- av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
+ av_log(avctx, AV_LOG_ERROR,
+ "Palette size %"SIZE_SPECIFIER" is wrong\n", size);
}
memcpy(frame->data[1], s->pal, AVPALETTE_SIZE);
}
diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
index d6b6608866..251be039a8 100644
--- a/libavcodec/nvdec.c
+++ b/libavcodec/nvdec.c
@@ -242,7 +242,7 @@ fail:
return ret;
}
-static AVBufferRef *nvdec_decoder_frame_alloc(void *opaque, buffer_size_t size)
+static AVBufferRef *nvdec_decoder_frame_alloc(void *opaque, 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(buffer_size_t size)
+static AVBufferRef *nvdec_alloc_dummy(size_t size)
{
return av_buffer_create(NULL, 0, NULL, NULL, 0);
}
diff --git a/libavcodec/packet.h b/libavcodec/packet.h
index 6e6d9c58c9..fad8341c12 100644
--- a/libavcodec/packet.h
+++ b/libavcodec/packet.h
@@ -305,11 +305,7 @@ 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;
@@ -528,11 +524,7 @@ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size);
* @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.
@@ -559,11 +551,7 @@ 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.
@@ -575,11 +563,7 @@ 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
const char *av_packet_side_data_name(enum AVPacketSideDataType type);
@@ -590,11 +574,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type);
* @param size pointer to store the size of the returned data
* @return pointer to data if successful, NULL otherwise
*/
-#if FF_API_BUFFER_SIZE_T
-uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size);
-#else
uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size);
-#endif
/**
* Unpack a dictionary from side_data.
*
@@ -603,12 +583,8 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size);
* @param dict the metadata storage dictionary
* @return 0 on success, < 0 on failure
*/
-#if FF_API_BUFFER_SIZE_T
-int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict);
-#else
int av_packet_unpack_dictionary(const uint8_t *data, size_t size,
AVDictionary **dict);
-#endif
/**
* Convenience function to free all the side data stored.
diff --git a/libavcodec/srtdec.c b/libavcodec/srtdec.c
index 98f84ac673..e77b94f74e 100644
--- a/libavcodec/srtdec.c
+++ b/libavcodec/srtdec.c
@@ -59,7 +59,7 @@ static int srt_decode_frame(AVCodecContext *avctx,
AVBPrint buffer;
int x1 = -1, y1 = -1, x2 = -1, y2 = -1;
int ret;
- buffer_size_t size;
+ 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/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 607858435f..7510816ec1 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -2235,7 +2235,7 @@ static void vaapi_encode_free_output_buffer(void *opaque,
}
static AVBufferRef *vaapi_encode_alloc_output_buffer(void *opaque,
- buffer_size_t size)
+ size_t size)
{
AVCodecContext *avctx = opaque;
VAAPIEncodeContext *ctx = avctx->priv_data;
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 79d96cd620..491fe4be3d 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -936,7 +936,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
}
if (av_dict_set(&metadata_dict, "timecode", tc, 0) >= 0) {
- buffer_size_t metadata_len;
+ size_t metadata_len;
packed_metadata = av_packet_pack_dictionary(metadata_dict, &metadata_len);
av_dict_free(&metadata_dict);
if (packed_metadata) {
@@ -1435,7 +1435,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))) {
- buffer_size_t size;
+ 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 114c3e1a8c..4c1eb05be4 100644
--- a/libavdevice/decklink_enc.cpp
+++ b/libavdevice/decklink_enc.cpp
@@ -313,7 +313,7 @@ static void construct_cc(AVFormatContext *avctx, struct decklink_ctx *ctx,
uint16_t *cdp_words;
uint16_t len;
uint8_t cc_count;
- buffer_size_t size;
+ size_t size;
int ret, i;
const uint8_t *data = av_packet_get_side_data(pkt, AV_PKT_DATA_A53_CC, &size);
diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
index fdadff3f7f..b26d8b739d 100644
--- a/libavdevice/lavfi.c
+++ b/libavdevice/lavfi.c
@@ -446,7 +446,7 @@ static int lavfi_read_packet(AVFormatContext *avctx, AVPacket *pkt)
frame_metadata = frame->metadata;
if (frame_metadata) {
- buffer_size_t size;
+ size_t size;
uint8_t *metadata = av_packet_pack_dictionary(frame_metadata, &size);
if (!metadata) {
diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
index 8e3292e577..fbe89d472d 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, buffer_size_t size)
+static AVBufferRef *allocate_shm_buffer(void *opaque, size_t size)
{
xcb_connection_t *conn = opaque;
xcb_shm_seg_t segment;
diff --git a/libavfilter/af_ashowinfo.c b/libavfilter/af_ashowinfo.c
index 9046e8d84a..e817ecea37 100644
--- a/libavfilter/af_ashowinfo.c
+++ b/libavfilter/af_ashowinfo.c
@@ -170,7 +170,8 @@ static void dump_audio_service_type(AVFilterContext *ctx, AVFrameSideData *sd)
static void dump_unknown(AVFilterContext *ctx, AVFrameSideData *sd)
{
- av_log(ctx, AV_LOG_INFO, "unknown side data type: %d, size %d bytes", sd->type, sd->size);
+ av_log(ctx, AV_LOG_INFO, "unknown side data type: %d, size "
+ "%"SIZE_SPECIFIER" bytes", sd->type, sd->size);
}
static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c
index 5f67fa170a..9123403c40 100644
--- a/libavfilter/framepool.c
+++ b/libavfilter/framepool.c
@@ -48,7 +48,7 @@ struct FFFramePool {
};
-FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(buffer_size_t size),
+FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t size),
int width,
int height,
enum AVPixelFormat format,
@@ -115,7 +115,7 @@ fail:
return NULL;
}
-FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(buffer_size_t size),
+FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(size_t size),
int channels,
int nb_samples,
enum AVSampleFormat format,
diff --git a/libavfilter/framepool.h b/libavfilter/framepool.h
index 28857a4a16..daab88e4a5 100644
--- a/libavfilter/framepool.h
+++ b/libavfilter/framepool.h
@@ -44,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)(buffer_size_t size),
+FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t size),
int width,
int height,
enum AVPixelFormat format,
@@ -62,7 +62,7 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(buffer_size_t 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)(buffer_size_t size),
+FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(size_t size),
int channels,
int samples,
enum AVSampleFormat format,
diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index ae6f6bb7b1..2529cb2851 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -340,7 +340,8 @@ static void dump_sei_unregistered_metadata(AVFilterContext *ctx, const AVFrameSi
int i;
if (sd->size < uuid_size) {
- av_log(ctx, AV_LOG_ERROR, "invalid data(%d < UUID(%d-bytes))\n", sd->size, uuid_size);
+ av_log(ctx, AV_LOG_ERROR, "invalid data(%"SIZE_SPECIFIER" < "
+ "UUID(%d-bytes))\n", sd->size, uuid_size);
return;
}
@@ -498,7 +499,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
av_log(ctx, AV_LOG_INFO, "pan/scan");
break;
case AV_FRAME_DATA_A53_CC:
- av_log(ctx, AV_LOG_INFO, "A/53 closed captions (%d bytes)", sd->size);
+ av_log(ctx, AV_LOG_INFO, "A/53 closed captions "
+ "(%"SIZE_SPECIFIER" bytes)", sd->size);
break;
case AV_FRAME_DATA_SPHERICAL:
dump_spherical(ctx, frame, sd);
@@ -545,8 +547,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
dump_sei_unregistered_metadata(ctx, sd);
break;
default:
- av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d bytes)\n",
- sd->type, sd->size);
+ av_log(ctx, AV_LOG_WARNING, "unknown side data type %d "
+ "(%"SIZE_SPECIFIER" bytes)\n", sd->type, sd->size);
break;
}
diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
index 52c543e35c..f34c52b780 100644
--- a/libavformat/adtsenc.c
+++ b/libavformat/adtsenc.c
@@ -170,7 +170,7 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
if (!par->extradata_size) {
uint8_t *side_data;
- buffer_size_t side_data_size;
+ size_t side_data_size;
int ret;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
diff --git a/libavformat/apngenc.c b/libavformat/apngenc.c
index 7e86f45143..643bf73300 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;
- buffer_size_t side_data_size;
+ size_t side_data_size;
av_assert0(apng->prev_packet);
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index bb8ddef88d..3834c9869f 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1873,11 +1873,7 @@ 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.
*
@@ -1888,11 +1884,7 @@ 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/concatdec.c b/libavformat/concatdec.c
index 32d4a99010..fb70c21dc2 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -626,7 +626,7 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt)
av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base),
av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base));
if (cat->cur_file->metadata) {
- buffer_size_t metadata_len;
+ size_t metadata_len;
char* packed_metadata = av_packet_pack_dictionary(cat->cur_file->metadata, &metadata_len);
if (!packed_metadata)
return AVERROR(ENOMEM);
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index a73fa60d2a..0ceaa5fdfd 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1806,7 +1806,7 @@ static int update_stream_extradata(AVFormatContext *s, OutputStream *os,
{
AVCodecParameters *par = os->ctx->streams[0]->codecpar;
uint8_t *extradata;
- buffer_size_t extradata_size;
+ size_t extradata_size;
int ret;
if (par->extradata_size)
@@ -2022,7 +2022,7 @@ static int dash_parse_prft(DASHContext *c, AVPacket *pkt)
{
OutputStream *os = &c->streams[pkt->stream_index];
AVProducerReferenceTime *prft;
- buffer_size_t side_data_size;
+ 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/dump.c b/libavformat/dump.c
index 4d6ccd006a..f8ad01102a 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -491,8 +491,8 @@ static void dump_sidedata(void *ctx, const AVStream *st, const char *indent)
dump_s12m_timecode(ctx, st, sd);
break;
default:
- av_log(ctx, AV_LOG_INFO,
- "unknown side data type %d (%d bytes)", sd->type, sd->size);
+ av_log(ctx, AV_LOG_INFO, "unknown side data type %d "
+ "(%"SIZE_SPECIFIER" bytes)", sd->type, sd->size);
break;
}
diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index 57f5c012f7..cdd25b817f 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;
- buffer_size_t streaminfo_size;
+ 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 35bf7ace5e..711b94c5bc 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) {
- buffer_size_t side_size;
+ 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/framecrcenc.c b/libavformat/framecrcenc.c
index 1fbe4aa4ee..4e62049305 100644
--- a/libavformat/framecrcenc.c
+++ b/libavformat/framecrcenc.c
@@ -88,7 +88,7 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
case AV_PKT_DATA_SPHERICAL:
case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:
case AV_PKT_DATA_S12M_TIMECODE:
- for (int j = 0; j < sd->size / 4; j++) {
+ for (size_t j = 0; j < sd->size / 4; j++) {
uint8_t buf[4];
AV_WL32(buf, AV_RB32(sd->data + 4 * j));
side_data_crc = av_adler32_update(side_data_crc, buf, 4);
@@ -119,7 +119,9 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
default:
side_data_crc = av_adler32_update(0, data, sd->size);
}
- av_strlcatf(buf, sizeof(buf), ", %8d, 0x%08"PRIx32, pkt->side_data[i].size, side_data_crc);
+
+ av_strlcatf(buf, sizeof(buf), ", %8"SIZE_SPECIFIER", 0x%08"PRIx32,
+ pkt->side_data[i].size, side_data_crc);
}
}
av_strlcatf(buf, sizeof(buf), "\n");
diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c
index 1e9faf372a..ec4e44ef12 100644
--- a/libavformat/hashenc.c
+++ b/libavformat/hashenc.c
@@ -298,18 +298,19 @@ static int framehash_write_packet(struct AVFormatContext *s, AVPacket *pkt)
avio_write(s->pb, buf, strlen(buf));
if (c->format_version > 1 && pkt->side_data_elems) {
- int i, j;
+ int i;
avio_printf(s->pb, ", S=%d", pkt->side_data_elems);
for (i = 0; i < pkt->side_data_elems; i++) {
av_hash_init(c->hashes[0]);
if (HAVE_BIGENDIAN && pkt->side_data[i].type == AV_PKT_DATA_PALETTE) {
- for (j = 0; j < pkt->side_data[i].size; j += sizeof(uint32_t)) {
+ for (size_t j = 0; j < pkt->side_data[i].size; j += sizeof(uint32_t)) {
uint32_t data = AV_RL32(pkt->side_data[i].data + j);
av_hash_update(c->hashes[0], (uint8_t *)&data, sizeof(uint32_t));
}
} else
av_hash_update(c->hashes[0], pkt->side_data[i].data, pkt->side_data[i].size);
- snprintf(buf, sizeof(buf) - (AV_HASH_MAX_SIZE * 2 + 1), ", %8d, ", pkt->side_data[i].size);
+ snprintf(buf, sizeof(buf) - (AV_HASH_MAX_SIZE * 2 + 1),
+ ", %8"SIZE_SPECIFIER", ", pkt->side_data[i].size);
len = strlen(buf);
av_hash_final_hex(c->hashes[0], buf + len, sizeof(buf) - len);
avio_write(s->pb, buf, strlen(buf));
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index 7b03cb2af1..84ce9ea093 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -383,7 +383,7 @@ int ff_img_read_header(AVFormatContext *s1)
static int add_filename_as_pkt_side_data(char *filename, AVPacket *pkt) {
AVDictionary *d = NULL;
char *packed_metadata = NULL;
- buffer_size_t metadata_len;
+ size_t metadata_len;
int ret;
av_dict_set(&d, "lavf.image2dec.source_path", filename, 0);
diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c
index 5488361bde..80fd2dfe27 100644
--- a/libavformat/latmenc.c
+++ b/libavformat/latmenc.c
@@ -176,7 +176,7 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt)
return ff_raw_write_packet(s, pkt);
else {
uint8_t *side_data;
- buffer_size_t side_data_size;
+ size_t side_data_size;
int ret;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index c3d895f931..5ac4db458b 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2030,7 +2030,7 @@ 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;
- buffer_size_t side_data_size;
+ 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;
@@ -2141,7 +2141,7 @@ 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;
- buffer_size_t id_size, settings_size;
+ size_t id_size, settings_size;
int size, id_size_int, settings_size_int;
const char *id, *settings;
int64_t ts = track->write_dts ? pkt->dts : pkt->pts;
@@ -2214,7 +2214,7 @@ 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;
- buffer_size_t side_data_size;
+ size_t side_data_size;
int ret;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 69477a0abc..06034695e7 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6364,8 +6364,7 @@ static int mov_read_pssh(MOVContext *c, AVIOContext *pb, MOVAtom atom)
uint8_t **key_ids;
AVStream *st;
uint8_t *side_data, *extra_data, *old_side_data;
- size_t side_data_size;
- buffer_size_t old_side_data_size;
+ size_t side_data_size, old_side_data_size;
int ret = 0;
unsigned int version, kid_count, extra_data_size, alloc_size = 0;
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index b15ecbe713..a315377ef6 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1992,7 +1992,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;
- buffer_size_t icc_profile_size;
+ 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);
@@ -3046,7 +3046,7 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov,
int group = 0;
uint32_t *display_matrix = NULL;
- buffer_size_t display_matrix_size;
+ size_t display_matrix_size;
int i;
if (st) {
@@ -4173,7 +4173,7 @@ 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) {
- buffer_size_t size;
+ size_t size;
int *fallback;
fallback = (int*)av_stream_get_side_data(track->st,
AV_PKT_DATA_FALLBACK_TRACK,
@@ -5557,7 +5557,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;
- buffer_size_t prft_size;
+ size_t prft_size;
uint8_t *reformatted_data = NULL;
ret = check_pkt(s, pkt);
@@ -5910,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) {
- buffer_size_t side_size;
+ 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 803148f0c8..6607560086 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;
- buffer_size_t side_data_size;
+ size_t side_data_size;
mp3_xing_add_frame(mp3, pkt);
mp3->audio_size += pkt->size;
@@ -402,7 +402,7 @@ static void mp3_update_xing(AVFormatContext *s)
AVReplayGain *rg;
uint16_t tag_crc;
uint8_t *toc;
- buffer_size_t rg_size;
+ size_t rg_size;
int i;
int64_t old_pos = avio_tell(s->pb);
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index a357f3a6aa..51da325e90 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1681,7 +1681,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;
- buffer_size_t side_data_size;
+ size_t side_data_size;
uint8_t *side_data = NULL;
int stream_id = -1;
@@ -1818,7 +1818,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;
- buffer_size_t side_data_size;
+ size_t side_data_size;
int i, n;
int ctrl_header_size;
int trim_start = 0, trim_end = 0;
diff --git a/libavformat/oggdec.h b/libavformat/oggdec.h
index bf982bfe1c..4cce53de41 100644
--- a/libavformat/oggdec.h
+++ b/libavformat/oggdec.h
@@ -87,7 +87,7 @@ struct ogg_stream {
int start_trimming; ///< set the number of packets to drop from the start
int end_trimming; ///< set the number of packets to drop from the end
uint8_t *new_metadata;
- buffer_size_t new_metadata_size;
+ size_t new_metadata_size;
void *private;
};
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 38e4c65c4e..557128ce53 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) {
- buffer_size_t mb_info_size;
+ 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 13954b8f99..faa8eb8f92 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -856,7 +856,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR(EINVAL);
if (!st->codecpar->extradata_size) {
- buffer_size_t pkt_extradata_size;
+ 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 9bb0ff94c1..93d5ed7ac8 100644
--- a/libavformat/srtenc.c
+++ b/libavformat/srtenc.c
@@ -61,7 +61,7 @@ static int srt_write_packet(AVFormatContext *avf, AVPacket *pkt)
SRTContext *srt = avf->priv_data;
int64_t s = pkt->pts, e, d = pkt->duration;
- buffer_size_t size;
+ size_t size;
int x1 = -1, y1 = -1, x2 = -1, y2 = -1;
const uint8_t *p;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index e36b75081f..7078891dc0 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -5462,7 +5462,7 @@ int ff_generate_avci_extradata(AVStream *st)
}
uint8_t *av_stream_get_side_data(const AVStream *st,
- enum AVPacketSideDataType type, buffer_size_t *size)
+ enum AVPacketSideDataType type, size_t *size)
{
int i;
@@ -5515,7 +5515,7 @@ int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type,
}
uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type,
- buffer_size_t size)
+ size_t size)
{
int ret;
uint8_t *data = av_malloc(size);
@@ -5631,7 +5631,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;
- buffer_size_t size;
+ size_t size;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PALETTE, &size);
if (side_data) {
diff --git a/libavformat/webvttdec.c b/libavformat/webvttdec.c
index 8d2fdfed37..cf060bd011 100644
--- a/libavformat/webvttdec.c
+++ b/libavformat/webvttdec.c
@@ -78,7 +78,7 @@ static int webvtt_read_header(AVFormatContext *s)
int64_t pos;
AVPacket *sub;
const char *p, *identifier, *settings;
- int identifier_len, settings_len;
+ size_t identifier_len, settings_len;
int64_t ts_start, ts_end;
ff_subtitles_read_chunk(s->pb, &cue);
diff --git a/libavformat/webvttenc.c b/libavformat/webvttenc.c
index 2bc86041a7..95f58e2942 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;
- buffer_size_t id_size, settings_size;
+ size_t id_size, settings_size;
int id_size_int, settings_size_int;
uint8_t *id, *settings;
diff --git a/libavutil/buffer.c b/libavutil/buffer.c
index 858633e8c7..b13eeadffb 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, buffer_size_t size,
+AVBufferRef *av_buffer_create(uint8_t *data, 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(buffer_size_t size)
+AVBufferRef *av_buffer_alloc(size_t size)
{
AVBufferRef *ret = NULL;
uint8_t *data = NULL;
@@ -80,7 +80,7 @@ AVBufferRef *av_buffer_alloc(buffer_size_t size)
return ret;
}
-AVBufferRef *av_buffer_allocz(buffer_size_t size)
+AVBufferRef *av_buffer_allocz(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, buffer_size_t size)
+int av_buffer_realloc(AVBufferRef **pbuf, 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(buffer_size_t size, void *opaque,
- AVBufferRef* (*alloc)(void *opaque, buffer_size_t size),
+AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque,
+ AVBufferRef* (*alloc)(void *opaque, size_t size),
void (*pool_free)(void *opaque))
{
AVBufferPool *pool = av_mallocz(sizeof(*pool));
@@ -263,7 +263,7 @@ AVBufferPool *av_buffer_pool_init2(buffer_size_t size, void *opaque,
return pool;
}
-AVBufferPool *av_buffer_pool_init(buffer_size_t size, AVBufferRef* (*alloc)(buffer_size_t size))
+AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size))
{
AVBufferPool *pool = av_mallocz(sizeof(*pool));
if (!pool)
diff --git a/libavutil/buffer.h b/libavutil/buffer.h
index 241a80ed67..63ab87eb72 100644
--- a/libavutil/buffer.h
+++ b/libavutil/buffer.h
@@ -93,11 +93,7 @@ typedef struct AVBufferRef {
/**
* Size of data in bytes.
*/
-#if FF_API_BUFFER_SIZE_T
- int size;
-#else
size_t size;
-#endif
} AVBufferRef;
/**
@@ -105,21 +101,13 @@ 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
@@ -142,11 +130,7 @@ AVBufferRef *av_buffer_allocz(size_t 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);
@@ -214,11 +198,7 @@ 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.
@@ -285,11 +265,7 @@ 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.
@@ -306,13 +282,8 @@ AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t 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 d902772ed3..839dc05f8f 100644
--- a/libavutil/buffer_internal.h
+++ b/libavutil/buffer_internal.h
@@ -33,7 +33,7 @@
struct AVBuffer {
uint8_t *data; /**< data described by this buffer */
- buffer_size_t size; /**< size of data in bytes */
+ size_t size; /**< size of data in bytes */
/**
* number of existing AVBufferRef instances referring to this buffer
@@ -90,10 +90,10 @@ struct AVBufferPool {
*/
atomic_uint refcount;
- buffer_size_t size;
+ size_t size;
void *opaque;
- AVBufferRef* (*alloc)(buffer_size_t size);
- AVBufferRef* (*alloc2)(void *opaque, buffer_size_t size);
+ AVBufferRef* (*alloc)(size_t size);
+ AVBufferRef* (*alloc2)(void *opaque, size_t size);
void (*pool_free)(void *opaque);
};
diff --git a/libavutil/detection_bbox.c b/libavutil/detection_bbox.c
index 0750ffac6a..40711e6aa9 100644
--- a/libavutil/detection_bbox.c
+++ b/libavutil/detection_bbox.c
@@ -54,10 +54,6 @@ AVDetectionBBoxHeader *av_detection_bbox_create_side_data(AVFrame *frame, uint32
header = av_detection_bbox_alloc(nb_bboxes, &size);
if (!header)
return NULL;
- if (size > INT_MAX) {
- av_freep(&header);
- return NULL;
- }
buf = av_buffer_create((uint8_t *)header, size, NULL, NULL, 0);
if (!buf) {
av_freep(&header);
diff --git a/libavutil/frame.c b/libavutil/frame.c
index 5bc8ab36df..2ec59b44b1 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -603,7 +603,7 @@ AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame,
AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
enum AVFrameSideDataType type,
- buffer_size_t size)
+ size_t size)
{
AVFrameSideData *ret;
AVBufferRef *buf = av_buffer_alloc(size);
diff --git a/libavutil/frame.h b/libavutil/frame.h
index 853d4cabec..ff2540a20f 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -209,11 +209,7 @@ 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;
@@ -818,11 +814,7 @@ 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
diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c
index 3773cd9eb8..cfdf2d7fd4 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, buffer_size_t size)
+static AVBufferRef *cuda_pool_alloc(void *opaque, 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 2a3549ebd8..27274ee3fa 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, buffer_size_t size)
+static AVBufferRef *d3d11va_pool_alloc(void *opaque, 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 33b3dc80ff..63b037da4a 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, buffer_size_t size)
+static AVBufferRef *dxva2_pool_alloc(void *opaque, 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 ee814602b2..41fac43229 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, buffer_size_t size)
+static AVBufferRef *opencl_pool_alloc(void *opaque, 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 30b0d81f84..08a6e0ee1c 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, buffer_size_t size)
+static AVBufferRef *qsv_pool_alloc(void *opaque, 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 4b81bd1f67..83e542876d 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, buffer_size_t size)
+static AVBufferRef *vaapi_pool_alloc(void *opaque, size_t size)
{
AVHWFramesContext *hwfc = opaque;
VAAPIFramesContext *ctx = hwfc->internal->priv;
diff --git a/libavutil/hwcontext_vdpau.c b/libavutil/hwcontext_vdpau.c
index a6fd7126f3..5b78e95529 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, buffer_size_t size)
+static AVBufferRef *vdpau_pool_alloc(void *opaque, size_t size)
{
AVHWFramesContext *ctx = opaque;
VDPAUFramesContext *priv = ctx->internal->priv;
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 2e3faaaa1a..48327ad98f 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, buffer_size_t size)
+static AVBufferRef *vulkan_pool_alloc(void *opaque, size_t size)
{
int err;
AVVkFrame *f;
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 854e9cbed2..7cd36ff742 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -292,11 +292,4 @@ void ff_check_pixfmt_descriptors(void);
*/
int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp);
-// 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 b78ff1acec..f67b41c0cb 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -108,9 +108,6 @@
#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_CPU_FLAGS
#define FF_API_CPU_FLAGS (LIBAVUTIL_VERSION_MAJOR < 57)
#endif
diff --git a/libavutil/video_enc_params.c b/libavutil/video_enc_params.c
index 635176ab91..b9cdafddbb 100644
--- a/libavutil/video_enc_params.c
+++ b/libavutil/video_enc_params.c
@@ -63,10 +63,6 @@ av_video_enc_params_create_side_data(AVFrame *frame, enum AVVideoEncParamsType t
par = av_video_enc_params_alloc(type, nb_blocks, &size);
if (!par)
return NULL;
- if (size > INT_MAX) {
- av_free(par);
- return NULL;
- }
buf = av_buffer_create((uint8_t *)par, size, NULL, NULL, 0);
if (!buf) {
av_freep(&par);