History

avutil/buffer: Switch AVBuffer API to size_t

Announced in 14040a1d913794d9a3fd6406a6d8c2f0e37e0062.

Andreas Rheinhardt committed 5 years ago

Commit ef6a9e51 parent 985c0da66 files · +110 −206Browse files

Unified · Split

66 files
  1. fftools/ffprobe.c +1 −1
  2. libavcodec/aacdec_template.c +2 −2
  3. libavcodec/adxdec.c +1 −1
  4. libavcodec/audiotoolboxdec.c +1 −1
  5. libavcodec/avpacket.c +6 −22
  6. libavcodec/cbs_bsf.c +1 −1
  7. libavcodec/decode.c +7 −6
  8. libavcodec/h264_metadata_bsf.c +1 −1
  9. libavcodec/h264dec.c +1 −1
  10. libavcodec/hevcdec.c +1 −1
  11. libavcodec/libvpxdec.c +1 −1
  12. libavcodec/mpeg12enc.c +2 −2
  13. libavcodec/mscc.c +3 −2
  14. libavcodec/nvdec.c +2 −2
  15. libavcodec/packet.h +0 −24
  16. libavcodec/srtdec.c +1 −1
  17. libavcodec/vaapi_encode.c +1 −1
  18. libavdevice/decklink_dec.cpp +2 −2
  19. libavdevice/decklink_enc.cpp +1 −1
  20. libavdevice/lavfi.c +1 −1
  21. libavdevice/xcbgrab.c +1 −1
  22. libavfilter/af_ashowinfo.c +2 −1
  23. libavfilter/framepool.c +2 −2
  24. libavfilter/framepool.h +2 −2
  25. libavfilter/vf_showinfo.c +6 −4
  26. libavformat/adtsenc.c +1 −1
  27. libavformat/apngenc.c +1 −1
  28. libavformat/avformat.h +0 −8
  29. libavformat/concatdec.c +1 −1
  30. libavformat/dashenc.c +2 −2
  31. libavformat/dump.c +2 −2
  32. libavformat/flacenc.c +1 −1
  33. libavformat/flvenc.c +1 −1
  34. libavformat/framecrcenc.c +4 −2
  35. libavformat/hashenc.c +4 −3
  36. libavformat/img2dec.c +1 −1
  37. libavformat/latmenc.c +1 −1
  38. libavformat/matroskaenc.c +3 −3
  39. libavformat/mov.c +1 −2
  40. libavformat/movenc.c +5 −5
  41. libavformat/mp3enc.c +2 −2
  42. libavformat/mpegtsenc.c +2 −2
  43. libavformat/oggdec.h +1 −1
  44. libavformat/rtpenc.c +1 −1
  45. libavformat/segment.c +1 −1
  46. libavformat/srtenc.c +1 −1
  47. libavformat/utils.c +3 −3
  48. libavformat/webvttdec.c +1 −1
  49. libavformat/webvttenc.c +1 −1
  50. libavutil/buffer.c +7 −7
  51. libavutil/buffer.h +0 −29
  52. libavutil/buffer_internal.h +4 −4
  53. libavutil/detection_bbox.c +0 −4
  54. libavutil/frame.c +1 −1
  55. libavutil/frame.h +0 −8
  56. libavutil/hwcontext_cuda.c +1 −1
  57. libavutil/hwcontext_d3d11va.c +1 −1
  58. libavutil/hwcontext_dxva2.c +1 −1
  59. libavutil/hwcontext_opencl.c +1 −1
  60. libavutil/hwcontext_qsv.c +1 −1
  61. libavutil/hwcontext_vaapi.c +1 −1
  62. libavutil/hwcontext_vdpau.c +1 −1
  63. libavutil/hwcontext_vulkan.c +1 −1
  64. libavutil/internal.h +0 −7
  65. libavutil/version.h +0 −3
  66. libavutil/video_enc_params.c +0 −4
fftools/ffprobe.c+1−1
@@ -2158,7 +2158,7 @@ static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int p · 2157 unmodified lines
21582158 pkt->flags & AV_PKT_FLAG_DISCARD ? 'D' : '_');
21592159
21602160 if (pkt->side_data_elems) {
2161− int size;
2161+ size_t size;
21622162 const uint8_t *side_metadata;
21632163
21642164 side_metadata = av_packet_get_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA, &size);
libavcodec/aacdec_template.c+2−2
@@ -3437,11 +3437,11 @@ static int aac_decode_frame(AVCodecContext *avctx, void *data, · 3436 unmodified lines
34373437 int buf_consumed;
34383438 int buf_offset;
34393439 int err;
3440− buffer_size_t new_extradata_size;
3440+ size_t new_extradata_size;
34413441 const uint8_t *new_extradata = av_packet_get_side_data(avpkt,
34423442 AV_PKT_DATA_NEW_EXTRADATA,
34433443 &new_extradata_size);
3444− buffer_size_t jp_dualmono_size;
3444+ size_t jp_dualmono_size;
34453445 const uint8_t *jp_dualmono = av_packet_get_side_data(avpkt,
34463446 AV_PKT_DATA_JP_DUALMONO,
34473447 &jp_dualmono_size);
libavcodec/adxdec.c+1−1
@@ -103,7 +103,7 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data, · 102 unmodified lines
103103 const uint8_t *buf = avpkt->data;
104104 const uint8_t *buf_end = buf + avpkt->size;
105105 int num_blocks, ch, ret;
106− buffer_size_t new_extradata_size;
106+ size_t new_extradata_size;
107107 uint8_t *new_extradata;
108108
109109 new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,
libavcodec/audiotoolboxdec.c+1−1
@@ -484,7 +484,7 @@ static int ffat_decode(AVCodecContext *avctx, void *data, · 483 unmodified lines
484484 if (avctx->codec_id == AV_CODEC_ID_AAC) {
485485 if (!at->extradata_size) {
486486 uint8_t *side_data;
487− buffer_size_t side_data_size;
487+ size_t side_data_size;
488488
489489 side_data = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,
490490 &side_data_size);
libavcodec/avpacket.c+6−22
@@ -218,16 +218,12 @@ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, · 217 unmodified lines
218218
219219
220220 uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
221− buffer_size_t size)
221+ size_t size)
222222 {
223223 int ret;
224224 uint8_t *data;
225225
226−#if FF_API_BUFFER_SIZE_T
227− if ((unsigned)size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
228−#else
229226 if (size > SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
230−#endif
231227 return NULL;
232228 data = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
233229 if (!data)
@@ -243,7 +239,7 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, · 9 unmodified lines
243239 }
244240
245241 uint8_t *av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
246− buffer_size_t *size)
242+ size_t *size)
247243 {
248244 int i;
249245
@@ -297,11 +293,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type) · 47 unmodified lines
297293 return NULL;
298294 }
299295
300−#if FF_API_BUFFER_SIZE_T
301−uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size)
302−#else
303296 uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size)
304−#endif
305297 {
306298 uint8_t *data = NULL;
307299 *size = 0;
@@ -320,11 +312,7 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size) · 12 unmodified lines
320312
321313 if (pass)
322314 memcpy(data + total_length, str, len);
323−#if FF_API_BUFFER_SIZE_T
324− else if (len > INT_MAX - total_length)
325−#else
326315 else if (len > SIZE_MAX - total_length)
327−#endif
328316 return NULL;
329317 total_length += len;
330318 }
@@ -340,12 +328,8 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size) · 9 unmodified lines
340328 return data;
341329 }
342330
343−#if FF_API_BUFFER_SIZE_T
344−int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict)
345−#else
346331 int av_packet_unpack_dictionary(const uint8_t *data, size_t size,
347332 AVDictionary **dict)
348−#endif
349333 {
350334 const uint8_t *end;
351335 int ret;
@@ -372,7 +356,7 @@ int av_packet_unpack_dictionary(const uint8_t *data, size_t size, · 20 unmodified lines
372356 }
373357
374358 int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
375− buffer_size_t size)
359+ size_t size)
376360 {
377361 int i;
378362
@@ -402,7 +386,7 @@ int av_packet_copy_props(AVPacket *dst, const AVPacket *src) · 23 unmodified lines
402386 dst->side_data_elems = 0;
403387 for (i = 0; i < src->side_data_elems; i++) {
404388 enum AVPacketSideDataType type = src->side_data[i].type;
405− buffer_size_t size = src->side_data[i].size;
389+ size_t size = src->side_data[i].size;
406390 uint8_t *src_data = src->side_data[i].data;
407391 uint8_t *dst_data = av_packet_new_side_data(dst, type, size);
408392
@@ -599,7 +583,7 @@ void avpriv_packet_list_free(PacketList **pkt_buf, PacketList **pkt_buf_end) · 190 unmodified lines
599583 int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type)
600584 {
601585 uint8_t *side_data;
602− buffer_size_t side_data_size;
586+ size_t side_data_size;
603587 int i;
604588
605589 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) · 19 unmodified lines
625609 {
626610 AVProducerReferenceTime *prft;
627611 uint8_t *side_data;
628− buffer_size_t side_data_size;
612+ size_t side_data_size;
629613
630614 side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PRFT, &side_data_size);
631615 if (!side_data) {
libavcodec/cbs_bsf.c+1−1
@@ -24,7 +24,7 @@ static int cbs_bsf_update_side_data(AVBSFContext *bsf, AVPacket *pkt) · 23 unmodified lines
2424 CBSBSFContext *ctx = bsf->priv_data;
2525 CodedBitstreamFragment *frag = &ctx->fragment;
2626 uint8_t *side_data;
27− buffer_size_t side_data_size;
27+ size_t side_data_size;
2828 int err;
2929
3030 side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
libavcodec/decode.c+7−6
@@ -67,7 +67,7 @@ typedef struct FramePool { · 66 unmodified lines
6767 static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt)
6868 {
6969 int ret;
70− buffer_size_t size;
70+ size_t size;
7171 const uint8_t *data;
7272 uint32_t flags;
7373 int64_t val;
@@ -344,7 +344,7 @@ static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame, · 270 unmodified lines
344344 got_frame = 0;
345345 } else if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {
346346 uint8_t *side;
347− buffer_size_t side_size;
347+ size_t side_size;
348348 uint32_t discard_padding = 0;
349349 uint8_t skip_reason = 0;
350350 uint8_t discard_reason = 0;
@@ -1463,7 +1463,7 @@ int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags · 1112 unmodified lines
14631463
14641464 static int add_metadata_from_side_data(const AVPacket *avpkt, AVFrame *frame)
14651465 {
1466− buffer_size_t size;
1466+ size_t size;
14671467 const uint8_t *side_metadata;
14681468
14691469 AVDictionary **frame_md = &frame->metadata;
@@ -1502,7 +1502,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame) · 32 unmodified lines
15021502 frame->pkt_size = pkt->size;
15031503
15041504 for (int i = 0; i < FF_ARRAY_ELEMS(sd); i++) {
1505− buffer_size_t size;
1505+ size_t size;
15061506 uint8_t *packet_sd = av_packet_get_side_data(pkt, sd[i].packet, &size);
15071507 if (packet_sd) {
15081508 AVFrameSideData *frame_sd = av_frame_new_side_data(frame,
@@ -1841,14 +1841,15 @@ FF_ENABLE_DEPRECATION_WARNINGS · 332 unmodified lines
18411841
18421842 int ff_copy_palette(void *dst, const AVPacket *src, void *logctx)
18431843 {
1844− buffer_size_t size;
1844+ size_t size;
18451845 const void *pal = av_packet_get_side_data(src, AV_PKT_DATA_PALETTE, &size);
18461846
18471847 if (pal && size == AVPALETTE_SIZE) {
18481848 memcpy(dst, pal, AVPALETTE_SIZE);
18491849 return 1;
18501850 } else if (pal) {
1851− av_log(logctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
1851+ av_log(logctx, AV_LOG_ERROR,
1852+ "Palette size %"SIZE_SPECIFIER" is wrong\n", size);
18521853 }
18531854 return 0;
18541855 }
libavcodec/h264_metadata_bsf.c+1−1
@@ -371,7 +371,7 @@ static int h264_metadata_handle_display_orientation(AVBSFContext *bsf, · 370 unmodified lines
371371 H264RawSEIDisplayOrientation *disp =
372372 &ctx->display_orientation_payload;
373373 uint8_t *data;
374− buffer_size_t size;
374+ size_t size;
375375 int write = 0;
376376
377377 data = av_packet_get_side_data(pkt, AV_PKT_DATA_DISPLAYMATRIX, &size);
libavcodec/h264dec.c+1−1
@@ -975,7 +975,7 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data, · 974 unmodified lines
975975 return send_next_delayed_frame(h, pict, got_frame, 0);
976976
977977 if (av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, NULL)) {
978− buffer_size_t side_size;
978+ size_t side_size;
979979 uint8_t *side = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);
980980 ff_h264_decode_extradata(side, side_size,
981981 &h->ps, &h->is_avc, &h->nal_length_size,
libavcodec/hevcdec.c+1−1
@@ -3303,7 +3303,7 @@ static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output, · 3302 unmodified lines
33033303 AVPacket *avpkt)
33043304 {
33053305 int ret;
3306− buffer_size_t new_extradata_size;
3306+ size_t new_extradata_size;
33073307 uint8_t *new_extradata;
33083308 HEVCContext *s = avctx->priv_data;
33093309
libavcodec/libvpxdec.c+1−1
@@ -221,7 +221,7 @@ static int vpx_decode(AVCodecContext *avctx, · 220 unmodified lines
221221 struct vpx_image *img, *img_alpha;
222222 int ret;
223223 uint8_t *side_data = NULL;
224− buffer_size_t side_data_size;
224+ size_t side_data_size;
225225
226226 ret = decode_frame(avctx, &ctx->decoder, avpkt->data, avpkt->size);
227227 if (ret)
libavcodec/mpeg12enc.c+2−2
@@ -575,8 +575,8 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number) · 574 unmodified lines
575575 put_bits(&s->pb, 8, 0xff); // marker_bits
576576 } else {
577577 av_log(s->avctx, AV_LOG_WARNING,
578− "Warning Closed Caption size (%d) can not exceed 93 bytes "
579− "and must be a multiple of 3\n", side_data->size);
578+ "Closed Caption size (%"SIZE_SPECIFIER") can not exceed "
579+ "93 bytes and must be a multiple of 3\n", side_data->size);
580580 }
581581 }
582582 }
libavcodec/mscc.c+3−2
@@ -152,7 +152,7 @@ static int decode_frame(AVCodecContext *avctx, · 151 unmodified lines
152152 }
153153
154154 if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
155− buffer_size_t size;
155+ size_t size;
156156 const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
157157
158158 if (pal && size == AVPALETTE_SIZE) {
@@ -160,7 +160,8 @@ static int decode_frame(AVCodecContext *avctx, · 1 unmodified line
160160 for (j = 0; j < 256; j++)
161161 s->pal[j] = 0xFF000000 | AV_RL32(pal + j * 4);
162162 } else if (pal) {
163− av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
163+ av_log(avctx, AV_LOG_ERROR,
164+ "Palette size %"SIZE_SPECIFIER" is wrong\n", size);
164165 }
165166 memcpy(frame->data[1], s->pal, AVPALETTE_SIZE);
166167 }
libavcodec/nvdec.c+2−2
@@ -242,7 +242,7 @@ fail: · 241 unmodified lines
242242 return ret;
243243 }
244244
245−static AVBufferRef *nvdec_decoder_frame_alloc(void *opaque, buffer_size_t size)
245+static AVBufferRef *nvdec_decoder_frame_alloc(void *opaque, size_t size)
246246 {
247247 NVDECFramePool *pool = opaque;
248248 AVBufferRef *ret;
@@ -283,7 +283,7 @@ static void nvdec_free_dummy(struct AVHWFramesContext *ctx) · 34 unmodified lines
283283 av_buffer_pool_uninit(&ctx->pool);
284284 }
285285
286−static AVBufferRef *nvdec_alloc_dummy(buffer_size_t size)
286+static AVBufferRef *nvdec_alloc_dummy(size_t size)
287287 {
288288 return av_buffer_create(NULL, 0, NULL, NULL, 0);
289289 }
libavcodec/packet.h+0−24
@@ -305,11 +305,7 @@ enum AVPacketSideDataType { · 304 unmodified lines
305305
306306 typedef struct AVPacketSideData {
307307 uint8_t *data;
308−#if FF_API_BUFFER_SIZE_T
309− int size;
310−#else
311308 size_t size;
312−#endif
313309 enum AVPacketSideDataType type;
314310 } AVPacketSideData;
315311
@@ -528,11 +524,7 @@ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size); · 212 unmodified lines
528524 * @return pointer to fresh allocated data or NULL otherwise
529525 */
530526 uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
531−#if FF_API_BUFFER_SIZE_T
532− int size);
533−#else
534527 size_t size);
535−#endif
536528
537529 /**
538530 * Wrap an existing array as a packet side data.
@@ -559,11 +551,7 @@ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, · 20 unmodified lines
559551 * @return 0 on success, < 0 on failure
560552 */
561553 int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
562−#if FF_API_BUFFER_SIZE_T
563− int size);
564−#else
565554 size_t size);
566−#endif
567555
568556 /**
569557 * Get side information from packet.
@@ -575,11 +563,7 @@ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, · 5 unmodified lines
575563 * @return pointer to data if present or NULL otherwise
576564 */
577565 uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
578−#if FF_API_BUFFER_SIZE_T
579− int *size);
580−#else
581566 size_t *size);
582−#endif
583567
584568 const char *av_packet_side_data_name(enum AVPacketSideDataType type);
585569
@@ -590,11 +574,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type); · 4 unmodified lines
590574 * @param size pointer to store the size of the returned data
591575 * @return pointer to data if successful, NULL otherwise
592576 */
593−#if FF_API_BUFFER_SIZE_T
594−uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size);
595−#else
596577 uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size);
597−#endif
598578 /**
599579 * Unpack a dictionary from side_data.
600580 *
@@ -603,12 +583,8 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size); · 2 unmodified lines
603583 * @param dict the metadata storage dictionary
604584 * @return 0 on success, < 0 on failure
605585 */
606−#if FF_API_BUFFER_SIZE_T
607−int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict);
608−#else
609586 int av_packet_unpack_dictionary(const uint8_t *data, size_t size,
610587 AVDictionary **dict);
611−#endif
612588
613589 /**
614590 * Convenience function to free all the side data stored.
libavcodec/srtdec.c+1−1
@@ -59,7 +59,7 @@ static int srt_decode_frame(AVCodecContext *avctx, · 58 unmodified lines
5959 AVBPrint buffer;
6060 int x1 = -1, y1 = -1, x2 = -1, y2 = -1;
6161 int ret;
62− buffer_size_t size;
62+ size_t size;
6363 const uint8_t *p = av_packet_get_side_data(avpkt, AV_PKT_DATA_SUBTITLE_POSITION, &size);
6464 FFASSDecoderContext *s = avctx->priv_data;
6565
libavcodec/vaapi_encode.c+1−1
@@ -2235,7 +2235,7 @@ static void vaapi_encode_free_output_buffer(void *opaque, · 2234 unmodified lines
22352235 }
22362236
22372237 static AVBufferRef *vaapi_encode_alloc_output_buffer(void *opaque,
2238− buffer_size_t size)
2238+ size_t size)
22392239 {
22402240 AVCodecContext *avctx = opaque;
22412241 VAAPIEncodeContext *ctx = avctx->priv_data;
libavdevice/decklink_dec.cpp+2−2
@@ -936,7 +936,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived( · 935 unmodified lines
936936 }
937937
938938 if (av_dict_set(&metadata_dict, "timecode", tc, 0) >= 0) {
939− buffer_size_t metadata_len;
939+ size_t metadata_len;
940940 packed_metadata = av_packet_pack_dictionary(metadata_dict, &metadata_len);
941941 av_dict_free(&metadata_dict);
942942 if (packed_metadata) {
@@ -1435,7 +1435,7 @@ int ff_decklink_read_packet(AVFormatContext *avctx, AVPacket *pkt) · 492 unmodified lines
14351435 avpacket_queue_get(&ctx->queue, pkt, 1);
14361436
14371437 if (ctx->tc_format && !(av_dict_get(ctx->video_st->metadata, "timecode", NULL, 0))) {
1438− buffer_size_t size;
1438+ size_t size;
14391439 const uint8_t *side_metadata = av_packet_get_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA, &size);
14401440 if (side_metadata) {
14411441 if (av_packet_unpack_dictionary(side_metadata, size, &ctx->video_st->metadata) < 0)
libavdevice/decklink_enc.cpp+1−1
@@ -313,7 +313,7 @@ static void construct_cc(AVFormatContext *avctx, struct decklink_ctx *ctx, · 312 unmodified lines
313313 uint16_t *cdp_words;
314314 uint16_t len;
315315 uint8_t cc_count;
316− buffer_size_t size;
316+ size_t size;
317317 int ret, i;
318318
319319 const uint8_t *data = av_packet_get_side_data(pkt, AV_PKT_DATA_A53_CC, &size);
libavdevice/lavfi.c+1−1
@@ -446,7 +446,7 @@ static int lavfi_read_packet(AVFormatContext *avctx, AVPacket *pkt) · 445 unmodified lines
446446
447447 frame_metadata = frame->metadata;
448448 if (frame_metadata) {
449− buffer_size_t size;
449+ size_t size;
450450 uint8_t *metadata = av_packet_pack_dictionary(frame_metadata, &size);
451451
452452 if (!metadata) {
libavdevice/xcbgrab.c+1−1
@@ -236,7 +236,7 @@ static void free_shm_buffer(void *opaque, uint8_t *data) · 235 unmodified lines
236236 shmdt(data);
237237 }
238238
239−static AVBufferRef *allocate_shm_buffer(void *opaque, buffer_size_t size)
239+static AVBufferRef *allocate_shm_buffer(void *opaque, size_t size)
240240 {
241241 xcb_connection_t *conn = opaque;
242242 xcb_shm_seg_t segment;
libavfilter/af_ashowinfo.c+2−1
@@ -170,7 +170,8 @@ static void dump_audio_service_type(AVFilterContext *ctx, AVFrameSideData *sd) · 169 unmodified lines
170170
171171 static void dump_unknown(AVFilterContext *ctx, AVFrameSideData *sd)
172172 {
173− av_log(ctx, AV_LOG_INFO, "unknown side data type: %d, size %d bytes", sd->type, sd->size);
173+ av_log(ctx, AV_LOG_INFO, "unknown side data type: %d, size "
174+ "%"SIZE_SPECIFIER" bytes", sd->type, sd->size);
174175 }
175176
176177 static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
libavfilter/framepool.c+2−2
@@ -48,7 +48,7 @@ struct FFFramePool { · 47 unmodified lines
4848
4949 };
5050
51−FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(buffer_size_t size),
51+FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t size),
5252 int width,
5353 int height,
5454 enum AVPixelFormat format,
@@ -115,7 +115,7 @@ fail: · 60 unmodified lines
115115 return NULL;
116116 }
117117
118−FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(buffer_size_t size),
118+FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(size_t size),
119119 int channels,
120120 int nb_samples,
121121 enum AVSampleFormat format,
libavfilter/framepool.h+2−2
@@ -44,7 +44,7 @@ typedef struct FFFramePool FFFramePool; · 43 unmodified lines
4444 * @param align buffers alignement of each frame in this pool
4545 * @return newly created video frame pool on success, NULL on error.
4646 */
47−FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(buffer_size_t size),
47+FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t size),
4848 int width,
4949 int height,
5050 enum AVPixelFormat format,
@@ -62,7 +62,7 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(buffer_size_t size), · 11 unmodified lines
6262 * @param align buffers alignement of each frame in this pool
6363 * @return newly created audio frame pool on success, NULL on error.
6464 */
65−FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(buffer_size_t size),
65+FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(size_t size),
6666 int channels,
6767 int samples,
6868 enum AVSampleFormat format,
libavfilter/vf_showinfo.c+6−4
@@ -340,7 +340,8 @@ static void dump_sei_unregistered_metadata(AVFilterContext *ctx, const AVFrameSi · 339 unmodified lines
340340 int i;
341341
342342 if (sd->size < uuid_size) {
343− av_log(ctx, AV_LOG_ERROR, "invalid data(%d < UUID(%d-bytes))\n", sd->size, uuid_size);
343+ av_log(ctx, AV_LOG_ERROR, "invalid data(%"SIZE_SPECIFIER" < "
344+ "UUID(%d-bytes))\n", sd->size, uuid_size);
344345 return;
345346 }
346347
@@ -498,7 +499,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 151 unmodified lines
498499 av_log(ctx, AV_LOG_INFO, "pan/scan");
499500 break;
500501 case AV_FRAME_DATA_A53_CC:
501− av_log(ctx, AV_LOG_INFO, "A/53 closed captions (%d bytes)", sd->size);
502+ av_log(ctx, AV_LOG_INFO, "A/53 closed captions "
503+ "(%"SIZE_SPECIFIER" bytes)", sd->size);
502504 break;
503505 case AV_FRAME_DATA_SPHERICAL:
504506 dump_spherical(ctx, frame, sd);
@@ -545,8 +547,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 40 unmodified lines
545547 dump_sei_unregistered_metadata(ctx, sd);
546548 break;
547549 default:
548− av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d bytes)\n",
549− sd->type, sd->size);
550+ av_log(ctx, AV_LOG_WARNING, "unknown side data type %d "
551+ "(%"SIZE_SPECIFIER" bytes)\n", sd->type, sd->size);
550552 break;
551553 }
552554
libavformat/adtsenc.c+1−1
@@ -170,7 +170,7 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) · 169 unmodified lines
170170 return 0;
171171 if (!par->extradata_size) {
172172 uint8_t *side_data;
173− buffer_size_t side_data_size;
173+ size_t side_data_size;
174174 int ret;
175175
176176 side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
libavformat/apngenc.c+1−1
@@ -119,7 +119,7 @@ static int flush_packet(AVFormatContext *format_context, AVPacket *packet) · 118 unmodified lines
119119 AVIOContext *io_context = format_context->pb;
120120 AVStream *codec_stream = format_context->streams[0];
121121 uint8_t *side_data = NULL;
122− buffer_size_t side_data_size;
122+ size_t side_data_size;
123123
124124 av_assert0(apng->prev_packet);
125125
libavformat/avformat.h+0−8
@@ -1873,11 +1873,7 @@ int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type, · 1872 unmodified lines
18731873 * @return pointer to fresh allocated data or NULL otherwise
18741874 */
18751875 uint8_t *av_stream_new_side_data(AVStream *stream,
1876−#if FF_API_BUFFER_SIZE_T
1877− enum AVPacketSideDataType type, int size);
1878−#else
18791876 enum AVPacketSideDataType type, size_t size);
1880−#endif
18811877 /**
18821878 * Get side information from stream.
18831879 *
@@ -1888,11 +1884,7 @@ uint8_t *av_stream_new_side_data(AVStream *stream, · 4 unmodified lines
18881884 * @return pointer to data if present or NULL otherwise
18891885 */
18901886 uint8_t *av_stream_get_side_data(const AVStream *stream,
1891−#if FF_API_BUFFER_SIZE_T
1892− enum AVPacketSideDataType type, int *size);
1893−#else
18941887 enum AVPacketSideDataType type, size_t *size);
1895−#endif
18961888
18971889 AVProgram *av_new_program(AVFormatContext *s, int id);
18981890
libavformat/concatdec.c+1−1
@@ -626,7 +626,7 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt) · 625 unmodified lines
626626 av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base),
627627 av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base));
628628 if (cat->cur_file->metadata) {
629− buffer_size_t metadata_len;
629+ size_t metadata_len;
630630 char* packed_metadata = av_packet_pack_dictionary(cat->cur_file->metadata, &metadata_len);
631631 if (!packed_metadata)
632632 return AVERROR(ENOMEM);
libavformat/dashenc.c+2−2
@@ -1806,7 +1806,7 @@ static int update_stream_extradata(AVFormatContext *s, OutputStream *os, · 1805 unmodified lines
18061806 {
18071807 AVCodecParameters *par = os->ctx->streams[0]->codecpar;
18081808 uint8_t *extradata;
1809− buffer_size_t extradata_size;
1809+ size_t extradata_size;
18101810 int ret;
18111811
18121812 if (par->extradata_size)
@@ -2022,7 +2022,7 @@ static int dash_parse_prft(DASHContext *c, AVPacket *pkt) · 209 unmodified lines
20222022 {
20232023 OutputStream *os = &c->streams[pkt->stream_index];
20242024 AVProducerReferenceTime *prft;
2025− buffer_size_t side_data_size;
2025+ size_t side_data_size;
20262026
20272027 prft = (AVProducerReferenceTime *)av_packet_get_side_data(pkt, AV_PKT_DATA_PRFT, &side_data_size);
20282028 if (!prft || side_data_size != sizeof(AVProducerReferenceTime) || (prft->flags && prft->flags != 24)) {
libavformat/dump.c+2−2
@@ -491,8 +491,8 @@ static void dump_sidedata(void *ctx, const AVStream *st, const char *indent) · 490 unmodified lines
491491 dump_s12m_timecode(ctx, st, sd);
492492 break;
493493 default:
494− av_log(ctx, AV_LOG_INFO,
495− "unknown side data type %d (%d bytes)", sd->type, sd->size);
494+ av_log(ctx, AV_LOG_INFO, "unknown side data type %d "
495+ "(%"SIZE_SPECIFIER" bytes)", sd->type, sd->size);
496496 break;
497497 }
498498
libavformat/flacenc.c+1−1
@@ -280,7 +280,7 @@ static int flac_write_audio_packet(struct AVFormatContext *s, AVPacket *pkt) · 279 unmodified lines
280280 {
281281 FlacMuxerContext *c = s->priv_data;
282282 uint8_t *streaminfo;
283− buffer_size_t streaminfo_size;
283+ size_t streaminfo_size;
284284
285285 /* check for updated streaminfo */
286286 streaminfo = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
libavformat/flvenc.c+1−1
@@ -902,7 +902,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) · 901 unmodified lines
902902
903903 if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264
904904 || par->codec_id == AV_CODEC_ID_MPEG4) {
905− buffer_size_t side_size;
905+ size_t side_size;
906906 uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);
907907 if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) {
908908 ret = ff_alloc_extradata(par, side_size);
libavformat/framecrcenc.c+4−2
@@ -88,7 +88,7 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt) · 87 unmodified lines
8888 case AV_PKT_DATA_SPHERICAL:
8989 case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:
9090 case AV_PKT_DATA_S12M_TIMECODE:
91− for (int j = 0; j < sd->size / 4; j++) {
91+ for (size_t j = 0; j < sd->size / 4; j++) {
9292 uint8_t buf[4];
9393 AV_WL32(buf, AV_RB32(sd->data + 4 * j));
9494 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) · 24 unmodified lines
119119 default:
120120 side_data_crc = av_adler32_update(0, data, sd->size);
121121 }
122− av_strlcatf(buf, sizeof(buf), ", %8d, 0x%08"PRIx32, pkt->side_data[i].size, side_data_crc);
122+
123+ av_strlcatf(buf, sizeof(buf), ", %8"SIZE_SPECIFIER", 0x%08"PRIx32,
124+ pkt->side_data[i].size, side_data_crc);
123125 }
124126 }
125127 av_strlcatf(buf, sizeof(buf), "\n");
libavformat/hashenc.c+4−3
@@ -298,18 +298,19 @@ static int framehash_write_packet(struct AVFormatContext *s, AVPacket *pkt) · 297 unmodified lines
298298 avio_write(s->pb, buf, strlen(buf));
299299
300300 if (c->format_version > 1 && pkt->side_data_elems) {
301− int i, j;
301+ int i;
302302 avio_printf(s->pb, ", S=%d", pkt->side_data_elems);
303303 for (i = 0; i < pkt->side_data_elems; i++) {
304304 av_hash_init(c->hashes[0]);
305305 if (HAVE_BIGENDIAN && pkt->side_data[i].type == AV_PKT_DATA_PALETTE) {
306− for (j = 0; j < pkt->side_data[i].size; j += sizeof(uint32_t)) {
306+ for (size_t j = 0; j < pkt->side_data[i].size; j += sizeof(uint32_t)) {
307307 uint32_t data = AV_RL32(pkt->side_data[i].data + j);
308308 av_hash_update(c->hashes[0], (uint8_t *)&data, sizeof(uint32_t));
309309 }
310310 } else
311311 av_hash_update(c->hashes[0], pkt->side_data[i].data, pkt->side_data[i].size);
312− snprintf(buf, sizeof(buf) - (AV_HASH_MAX_SIZE * 2 + 1), ", %8d, ", pkt->side_data[i].size);
312+ snprintf(buf, sizeof(buf) - (AV_HASH_MAX_SIZE * 2 + 1),
313+ ", %8"SIZE_SPECIFIER", ", pkt->side_data[i].size);
313314 len = strlen(buf);
314315 av_hash_final_hex(c->hashes[0], buf + len, sizeof(buf) - len);
315316 avio_write(s->pb, buf, strlen(buf));
libavformat/img2dec.c+1−1
@@ -383,7 +383,7 @@ int ff_img_read_header(AVFormatContext *s1) · 382 unmodified lines
383383 static int add_filename_as_pkt_side_data(char *filename, AVPacket *pkt) {
384384 AVDictionary *d = NULL;
385385 char *packed_metadata = NULL;
386− buffer_size_t metadata_len;
386+ size_t metadata_len;
387387 int ret;
388388
389389 av_dict_set(&d, "lavf.image2dec.source_path", filename, 0);
libavformat/latmenc.c+1−1
@@ -176,7 +176,7 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt) · 175 unmodified lines
176176 return ff_raw_write_packet(s, pkt);
177177 else {
178178 uint8_t *side_data;
179− buffer_size_t side_data_size;
179+ size_t side_data_size;
180180 int ret;
181181
182182 side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
libavformat/matroskaenc.c+3−3
@@ -2030,7 +2030,7 @@ static int mkv_write_block(AVFormatContext *s, AVIOContext *pb, · 2029 unmodified lines
20302030 AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar;
20312031 mkv_track *track = &mkv->tracks[pkt->stream_index];
20322032 uint8_t *data = NULL, *side_data = NULL;
2033− buffer_size_t side_data_size;
2033+ size_t side_data_size;
20342034 int err = 0, offset = 0, size = pkt->size;
20352035 int64_t ts = track->write_dts ? pkt->dts : pkt->pts;
20362036 uint64_t additional_id;
@@ -2141,7 +2141,7 @@ static int mkv_write_vtt_blocks(AVFormatContext *s, AVIOContext *pb, const AVPac · 104 unmodified lines
21412141 MatroskaMuxContext *mkv = s->priv_data;
21422142 mkv_track *track = &mkv->tracks[pkt->stream_index];
21432143 ebml_master blockgroup;
2144− buffer_size_t id_size, settings_size;
2144+ size_t id_size, settings_size;
21452145 int size, id_size_int, settings_size_int;
21462146 const char *id, *settings;
21472147 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) · 66 unmodified lines
22142214 mkv_track *track = &mkv->tracks[pkt->stream_index];
22152215 AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar;
22162216 uint8_t *side_data;
2217− buffer_size_t side_data_size;
2217+ size_t side_data_size;
22182218 int ret;
22192219
22202220 side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
libavformat/mov.c+1−2
@@ -6364,8 +6364,7 @@ static int mov_read_pssh(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 6363 unmodified lines
63646364 uint8_t **key_ids;
63656365 AVStream *st;
63666366 uint8_t *side_data, *extra_data, *old_side_data;
6367− size_t side_data_size;
6368− buffer_size_t old_side_data_size;
6367+ size_t side_data_size, old_side_data_size;
63696368 int ret = 0;
63706369 unsigned int version, kid_count, extra_data_size, alloc_size = 0;
63716370
libavformat/movenc.c+5−5
@@ -1992,7 +1992,7 @@ static int mov_write_colr_tag(AVIOContext *pb, MOVTrack *track, int prefer_icc) · 1991 unmodified lines
19921992 // Ref (MP4): ISO/IEC 14496-12:2012
19931993
19941994 const uint8_t *icc_profile;
1995− buffer_size_t icc_profile_size;
1995+ size_t icc_profile_size;
19961996
19971997 if (prefer_icc) {
19981998 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, · 1047 unmodified lines
30463046 int group = 0;
30473047
30483048 uint32_t *display_matrix = NULL;
3049− buffer_size_t display_matrix_size;
3049+ size_t display_matrix_size;
30503050 int i;
30513051
30523052 if (st) {
@@ -4173,7 +4173,7 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, · 1120 unmodified lines
41734173 track->tref_tag = MKTAG('h','i','n','t');
41744174 track->tref_id = mov->tracks[track->src_track].track_id;
41754175 } else if (track->par->codec_type == AVMEDIA_TYPE_AUDIO) {
4176− buffer_size_t size;
4176+ size_t size;
41774177 int *fallback;
41784178 fallback = (int*)av_stream_get_side_data(track->st,
41794179 AV_PKT_DATA_FALLBACK_TRACK,
@@ -5557,7 +5557,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) · 1377 unmodified lines
55575557 AVProducerReferenceTime *prft;
55585558 unsigned int samples_in_chunk = 0;
55595559 int size = pkt->size, ret = 0, offset = 0;
5560− buffer_size_t prft_size;
5560+ size_t prft_size;
55615561 uint8_t *reformatted_data = NULL;
55625562
55635563 ret = check_pkt(s, pkt);
@@ -5910,7 +5910,7 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt) · 346 unmodified lines
59105910 trk->par->codec_id == AV_CODEC_ID_AAC ||
59115911 trk->par->codec_id == AV_CODEC_ID_AV1 ||
59125912 trk->par->codec_id == AV_CODEC_ID_FLAC) {
5913− buffer_size_t side_size;
5913+ size_t side_size;
59145914 uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);
59155915 if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) {
59165916 void *newextra = av_mallocz(side_size + AV_INPUT_BUFFER_PADDING_SIZE);
libavformat/mp3enc.c+2−2
@@ -355,7 +355,7 @@ static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt) · 354 unmodified lines
355355
356356 if (mp3->xing_offset) {
357357 uint8_t *side_data = NULL;
358− buffer_size_t side_data_size;
358+ size_t side_data_size;
359359
360360 mp3_xing_add_frame(mp3, pkt);
361361 mp3->audio_size += pkt->size;
@@ -402,7 +402,7 @@ static void mp3_update_xing(AVFormatContext *s) · 40 unmodified lines
402402 AVReplayGain *rg;
403403 uint16_t tag_crc;
404404 uint8_t *toc;
405− buffer_size_t rg_size;
405+ size_t rg_size;
406406 int i;
407407 int64_t old_pos = avio_tell(s->pb);
408408
libavformat/mpegtsenc.c+2−2
@@ -1681,7 +1681,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) · 1680 unmodified lines
16811681 const int64_t max_audio_delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE) / 2;
16821682 int64_t dts = pkt->dts, pts = pkt->pts;
16831683 int opus_samples = 0;
1684− buffer_size_t side_data_size;
1684+ size_t side_data_size;
16851685 uint8_t *side_data = NULL;
16861686 int stream_id = -1;
16871687
@@ -1818,7 +1818,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) · 130 unmodified lines
18181818 /* Add Opus control header */
18191819 if ((AV_RB16(pkt->data) >> 5) != 0x3ff) {
18201820 uint8_t *side_data;
1821− buffer_size_t side_data_size;
1821+ size_t side_data_size;
18221822 int i, n;
18231823 int ctrl_header_size;
18241824 int trim_start = 0, trim_end = 0;
libavformat/oggdec.h+1−1
@@ -87,7 +87,7 @@ struct ogg_stream { · 86 unmodified lines
8787 int start_trimming; ///< set the number of packets to drop from the start
8888 int end_trimming; ///< set the number of packets to drop from the end
8989 uint8_t *new_metadata;
90− buffer_size_t new_metadata_size;
90+ size_t new_metadata_size;
9191 void *private;
9292 };
9393
libavformat/rtpenc.c+1−1
@@ -589,7 +589,7 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt) · 588 unmodified lines
589589 break;
590590 case AV_CODEC_ID_H263:
591591 if (s->flags & FF_RTP_FLAG_RFC2190) {
592− buffer_size_t mb_info_size;
592+ size_t mb_info_size;
593593 const uint8_t *mb_info =
594594 av_packet_get_side_data(pkt, AV_PKT_DATA_H263_MB_INFO,
595595 &mb_info_size);
libavformat/segment.c+1−1
@@ -856,7 +856,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt) · 855 unmodified lines
856856 return AVERROR(EINVAL);
857857
858858 if (!st->codecpar->extradata_size) {
859− buffer_size_t pkt_extradata_size;
859+ size_t pkt_extradata_size;
860860 uint8_t *pkt_extradata = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &pkt_extradata_size);
861861 if (pkt_extradata && pkt_extradata_size > 0) {
862862 ret = ff_alloc_extradata(st->codecpar, pkt_extradata_size);
libavformat/srtenc.c+1−1
@@ -61,7 +61,7 @@ static int srt_write_packet(AVFormatContext *avf, AVPacket *pkt) · 60 unmodified lines
6161 SRTContext *srt = avf->priv_data;
6262
6363 int64_t s = pkt->pts, e, d = pkt->duration;
64− buffer_size_t size;
64+ size_t size;
6565 int x1 = -1, y1 = -1, x2 = -1, y2 = -1;
6666 const uint8_t *p;
6767
libavformat/utils.c+3−3
@@ -5462,7 +5462,7 @@ int ff_generate_avci_extradata(AVStream *st) · 5461 unmodified lines
54625462 }
54635463
54645464 uint8_t *av_stream_get_side_data(const AVStream *st,
5465− enum AVPacketSideDataType type, buffer_size_t *size)
5465+ enum AVPacketSideDataType type, size_t *size)
54665466 {
54675467 int i;
54685468
@@ -5515,7 +5515,7 @@ int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type, · 46 unmodified lines
55155515 }
55165516
55175517 uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type,
5518− buffer_size_t size)
5518+ size_t size)
55195519 {
55205520 int ret;
55215521 uint8_t *data = av_malloc(size);
@@ -5631,7 +5631,7 @@ int ff_standardize_creation_time(AVFormatContext *s) · 109 unmodified lines
56315631 int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, uint32_t *palette)
56325632 {
56335633 uint8_t *side_data;
5634− buffer_size_t size;
5634+ size_t size;
56355635
56365636 side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PALETTE, &size);
56375637 if (side_data) {
libavformat/webvttdec.c+1−1
@@ -78,7 +78,7 @@ static int webvtt_read_header(AVFormatContext *s) · 77 unmodified lines
7878 int64_t pos;
7979 AVPacket *sub;
8080 const char *p, *identifier, *settings;
81− int identifier_len, settings_len;
81+ size_t identifier_len, settings_len;
8282 int64_t ts_start, ts_end;
8383
8484 ff_subtitles_read_chunk(s->pb, &cue);
libavformat/webvttenc.c+1−1
@@ -64,7 +64,7 @@ static int webvtt_write_header(AVFormatContext *ctx) · 63 unmodified lines
6464 static int webvtt_write_packet(AVFormatContext *ctx, AVPacket *pkt)
6565 {
6666 AVIOContext *pb = ctx->pb;
67− buffer_size_t id_size, settings_size;
67+ size_t id_size, settings_size;
6868 int id_size_int, settings_size_int;
6969 uint8_t *id, *settings;
7070
libavutil/buffer.c+7−7
@@ -26,7 +26,7 @@ · 25 unmodified lines
2626 #include "mem.h"
2727 #include "thread.h"
2828
29−AVBufferRef *av_buffer_create(uint8_t *data, buffer_size_t size,
29+AVBufferRef *av_buffer_create(uint8_t *data, size_t size,
3030 void (*free)(void *opaque, uint8_t *data),
3131 void *opaque, int flags)
3232 {
@@ -64,7 +64,7 @@ void av_buffer_default_free(void *opaque, uint8_t *data) · 31 unmodified lines
6464 av_free(data);
6565 }
6666
67−AVBufferRef *av_buffer_alloc(buffer_size_t size)
67+AVBufferRef *av_buffer_alloc(size_t size)
6868 {
6969 AVBufferRef *ret = NULL;
7070 uint8_t *data = NULL;
@@ -80,7 +80,7 @@ AVBufferRef *av_buffer_alloc(buffer_size_t size) · 9 unmodified lines
8080 return ret;
8181 }
8282
83−AVBufferRef *av_buffer_allocz(buffer_size_t size)
83+AVBufferRef *av_buffer_allocz(size_t size)
8484 {
8585 AVBufferRef *ret = av_buffer_alloc(size);
8686 if (!ret)
@@ -166,7 +166,7 @@ int av_buffer_make_writable(AVBufferRef **pbuf) · 79 unmodified lines
166166 return 0;
167167 }
168168
169−int av_buffer_realloc(AVBufferRef **pbuf, buffer_size_t size)
169+int av_buffer_realloc(AVBufferRef **pbuf, size_t size)
170170 {
171171 AVBufferRef *buf = *pbuf;
172172 uint8_t *tmp;
@@ -242,8 +242,8 @@ int av_buffer_replace(AVBufferRef **pdst, AVBufferRef *src) · 69 unmodified lines
242242 return 0;
243243 }
244244
245−AVBufferPool *av_buffer_pool_init2(buffer_size_t size, void *opaque,
246− AVBufferRef* (*alloc)(void *opaque, buffer_size_t size),
245+AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque,
246+ AVBufferRef* (*alloc)(void *opaque, size_t size),
247247 void (*pool_free)(void *opaque))
248248 {
249249 AVBufferPool *pool = av_mallocz(sizeof(*pool));
@@ -263,7 +263,7 @@ AVBufferPool *av_buffer_pool_init2(buffer_size_t size, void *opaque, · 13 unmodified lines
263263 return pool;
264264 }
265265
266−AVBufferPool *av_buffer_pool_init(buffer_size_t size, AVBufferRef* (*alloc)(buffer_size_t size))
266+AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size))
267267 {
268268 AVBufferPool *pool = av_mallocz(sizeof(*pool));
269269 if (!pool)
libavutil/buffer.h+0−29
@@ -93,11 +93,7 @@ typedef struct AVBufferRef { · 92 unmodified lines
9393 /**
9494 * Size of data in bytes.
9595 */
96−#if FF_API_BUFFER_SIZE_T
97− int size;
98−#else
9996 size_t size;
100−#endif
10197 } AVBufferRef;
10298
10399 /**
@@ -105,21 +101,13 @@ typedef struct AVBufferRef { · 1 unmodified line
105101 *
106102 * @return an AVBufferRef of given size or NULL when out of memory
107103 */
108−#if FF_API_BUFFER_SIZE_T
109−AVBufferRef *av_buffer_alloc(int size);
110−#else
111104 AVBufferRef *av_buffer_alloc(size_t size);
112−#endif
113105
114106 /**
115107 * Same as av_buffer_alloc(), except the returned buffer will be initialized
116108 * to zero.
117109 */
118−#if FF_API_BUFFER_SIZE_T
119−AVBufferRef *av_buffer_allocz(int size);
120−#else
121110 AVBufferRef *av_buffer_allocz(size_t size);
122−#endif
123111
124112 /**
125113 * Always treat the buffer as read-only, even when it has only one
@@ -142,11 +130,7 @@ AVBufferRef *av_buffer_allocz(size_t size); · 16 unmodified lines
142130 *
143131 * @return an AVBufferRef referring to data on success, NULL on failure.
144132 */
145−#if FF_API_BUFFER_SIZE_T
146−AVBufferRef *av_buffer_create(uint8_t *data, int size,
147−#else
148133 AVBufferRef *av_buffer_create(uint8_t *data, size_t size,
149−#endif
150134 void (*free)(void *opaque, uint8_t *data),
151135 void *opaque, int flags);
152136
@@ -214,11 +198,7 @@ int av_buffer_make_writable(AVBufferRef **buf); · 61 unmodified lines
214198 * reference to it (i.e. the one passed to this function). In all other cases
215199 * a new buffer is allocated and the data is copied.
216200 */
217−#if FF_API_BUFFER_SIZE_T
218−int av_buffer_realloc(AVBufferRef **buf, int size);
219−#else
220201 int av_buffer_realloc(AVBufferRef **buf, size_t size);
221−#endif
222202
223203 /**
224204 * Ensure dst refers to the same data as src.
@@ -285,11 +265,7 @@ typedef struct AVBufferPool AVBufferPool; · 60 unmodified lines
285265 * (av_buffer_alloc()).
286266 * @return newly created buffer pool on success, NULL on error.
287267 */
288−#if FF_API_BUFFER_SIZE_T
289−AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size));
290−#else
291268 AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size));
292−#endif
293269
294270 /**
295271 * 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 · 10 unmodified lines
306282 * data. May be NULL.
307283 * @return newly created buffer pool on success, NULL on error.
308284 */
309−#if FF_API_BUFFER_SIZE_T
310−AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
311− AVBufferRef* (*alloc)(void *opaque, int size),
312−#else
313285 AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque,
314286 AVBufferRef* (*alloc)(void *opaque, size_t size),
315−#endif
316287 void (*pool_free)(void *opaque));
317288
318289 /**
libavutil/buffer_internal.h+4−4
@@ -33,7 +33,7 @@ · 32 unmodified lines
3333
3434 struct AVBuffer {
3535 uint8_t *data; /**< data described by this buffer */
36− buffer_size_t size; /**< size of data in bytes */
36+ size_t size; /**< size of data in bytes */
3737
3838 /**
3939 * number of existing AVBufferRef instances referring to this buffer
@@ -90,10 +90,10 @@ struct AVBufferPool { · 50 unmodified lines
9090 */
9191 atomic_uint refcount;
9292
93− buffer_size_t size;
93+ size_t size;
9494 void *opaque;
95− AVBufferRef* (*alloc)(buffer_size_t size);
96− AVBufferRef* (*alloc2)(void *opaque, buffer_size_t size);
95+ AVBufferRef* (*alloc)(size_t size);
96+ AVBufferRef* (*alloc2)(void *opaque, size_t size);
9797 void (*pool_free)(void *opaque);
9898 };
9999
libavutil/detection_bbox.c+0−4
@@ -54,10 +54,6 @@ AVDetectionBBoxHeader *av_detection_bbox_create_side_data(AVFrame *frame, uint32 · 53 unmodified lines
5454 header = av_detection_bbox_alloc(nb_bboxes, &size);
5555 if (!header)
5656 return NULL;
57− if (size > INT_MAX) {
58− av_freep(&header);
59− return NULL;
60− }
6157 buf = av_buffer_create((uint8_t *)header, size, NULL, NULL, 0);
6258 if (!buf) {
6359 av_freep(&header);
libavutil/frame.c+1−1
@@ -603,7 +603,7 @@ AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame, · 602 unmodified lines
603603
604604 AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
605605 enum AVFrameSideDataType type,
606− buffer_size_t size)
606+ size_t size)
607607 {
608608 AVFrameSideData *ret;
609609 AVBufferRef *buf = av_buffer_alloc(size);
libavutil/frame.h+0−8
@@ -209,11 +209,7 @@ enum AVActiveFormatDescription { · 208 unmodified lines
209209 typedef struct AVFrameSideData {
210210 enum AVFrameSideDataType type;
211211 uint8_t *data;
212−#if FF_API_BUFFER_SIZE_T
213− int size;
214−#else
215212 size_t size;
216−#endif
217213 AVDictionary *metadata;
218214 AVBufferRef *buf;
219215 } AVFrameSideData;
@@ -818,11 +814,7 @@ AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane); · 598 unmodified lines
818814 */
819815 AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
820816 enum AVFrameSideDataType type,
821−#if FF_API_BUFFER_SIZE_T
822− int size);
823−#else
824817 size_t size);
825−#endif
826818
827819 /**
828820 * Add a new side data to a frame from an existing AVBufferRef
libavutil/hwcontext_cuda.c+1−1
@@ -93,7 +93,7 @@ static void cuda_buffer_free(void *opaque, uint8_t *data) · 92 unmodified lines
9393 CHECK_CU(cu->cuCtxPopCurrent(&dummy));
9494 }
9595
96−static AVBufferRef *cuda_pool_alloc(void *opaque, buffer_size_t size)
96+static AVBufferRef *cuda_pool_alloc(void *opaque, size_t size)
9797 {
9898 AVHWFramesContext *ctx = opaque;
9999 AVHWDeviceContext *device_ctx = ctx->device_ctx;
libavutil/hwcontext_d3d11va.c+1−1
@@ -202,7 +202,7 @@ static AVBufferRef *d3d11va_alloc_single(AVHWFramesContext *ctx) · 201 unmodified lines
202202 return wrap_texture_buf(tex, 0);
203203 }
204204
205−static AVBufferRef *d3d11va_pool_alloc(void *opaque, buffer_size_t size)
205+static AVBufferRef *d3d11va_pool_alloc(void *opaque, size_t size)
206206 {
207207 AVHWFramesContext *ctx = (AVHWFramesContext*)opaque;
208208 D3D11VAFramesContext *s = ctx->internal->priv;
libavutil/hwcontext_dxva2.c+1−1
@@ -124,7 +124,7 @@ static void dxva2_pool_release_dummy(void *opaque, uint8_t *data) · 123 unmodified lines
124124 // released in dxva2_frames_uninit()
125125 }
126126
127−static AVBufferRef *dxva2_pool_alloc(void *opaque, buffer_size_t size)
127+static AVBufferRef *dxva2_pool_alloc(void *opaque, size_t size)
128128 {
129129 AVHWFramesContext *ctx = (AVHWFramesContext*)opaque;
130130 DXVA2FramesContext *s = ctx->internal->priv;
libavutil/hwcontext_opencl.c+1−1
@@ -1617,7 +1617,7 @@ static void opencl_pool_free(void *opaque, uint8_t *data) · 1616 unmodified lines
16171617 av_free(desc);
16181618 }
16191619
1620−static AVBufferRef *opencl_pool_alloc(void *opaque, buffer_size_t size)
1620+static AVBufferRef *opencl_pool_alloc(void *opaque, size_t size)
16211621 {
16221622 AVHWFramesContext *hwfc = opaque;
16231623 AVOpenCLDeviceContext *hwctx = hwfc->device_ctx->hwctx;
libavutil/hwcontext_qsv.c+1−1
@@ -194,7 +194,7 @@ static void qsv_pool_release_dummy(void *opaque, uint8_t *data) · 193 unmodified lines
194194 {
195195 }
196196
197−static AVBufferRef *qsv_pool_alloc(void *opaque, buffer_size_t size)
197+static AVBufferRef *qsv_pool_alloc(void *opaque, size_t size)
198198 {
199199 AVHWFramesContext *ctx = (AVHWFramesContext*)opaque;
200200 QSVFramesContext *s = ctx->internal->priv;
libavutil/hwcontext_vaapi.c+1−1
@@ -464,7 +464,7 @@ static void vaapi_buffer_free(void *opaque, uint8_t *data) · 463 unmodified lines
464464 }
465465 }
466466
467−static AVBufferRef *vaapi_pool_alloc(void *opaque, buffer_size_t size)
467+static AVBufferRef *vaapi_pool_alloc(void *opaque, size_t size)
468468 {
469469 AVHWFramesContext *hwfc = opaque;
470470 VAAPIFramesContext *ctx = hwfc->internal->priv;
libavutil/hwcontext_vdpau.c+1−1
@@ -225,7 +225,7 @@ static void vdpau_buffer_free(void *opaque, uint8_t *data) · 224 unmodified lines
225225 device_priv->surf_destroy(surf);
226226 }
227227
228−static AVBufferRef *vdpau_pool_alloc(void *opaque, buffer_size_t size)
228+static AVBufferRef *vdpau_pool_alloc(void *opaque, size_t size)
229229 {
230230 AVHWFramesContext *ctx = opaque;
231231 VDPAUFramesContext *priv = ctx->internal->priv;
libavutil/hwcontext_vulkan.c+1−1
@@ -1693,7 +1693,7 @@ static void try_export_flags(AVHWFramesContext *hwfc, · 1692 unmodified lines
16931693 }
16941694 }
16951695
1696−static AVBufferRef *vulkan_pool_alloc(void *opaque, buffer_size_t size)
1696+static AVBufferRef *vulkan_pool_alloc(void *opaque, size_t size)
16971697 {
16981698 int err;
16991699 AVVkFrame *f;
libavutil/internal.h+0−7
@@ -292,11 +292,4 @@ void ff_check_pixfmt_descriptors(void); · 291 unmodified lines
292292 */
293293 int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp);
294294
295−// Temporary typedef to simplify porting all AVBufferRef users to size_t
296−#if FF_API_BUFFER_SIZE_T
297−typedef int buffer_size_t;
298−#else
299−typedef size_t buffer_size_t;
300−#endif
301−
302295 #endif /* AVUTIL_INTERNAL_H */
libavutil/version.h+0−3
@@ -108,9 +108,6 @@ · 107 unmodified lines
108108 #ifndef FF_API_CHILD_CLASS_NEXT
109109 #define FF_API_CHILD_CLASS_NEXT (LIBAVUTIL_VERSION_MAJOR < 57)
110110 #endif
111−#ifndef FF_API_BUFFER_SIZE_T
112−#define FF_API_BUFFER_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 57)
113−#endif
114111 #ifndef FF_API_CPU_FLAGS
115112 #define FF_API_CPU_FLAGS (LIBAVUTIL_VERSION_MAJOR < 57)
116113 #endif
libavutil/video_enc_params.c+0−4
@@ -63,10 +63,6 @@ av_video_enc_params_create_side_data(AVFrame *frame, enum AVVideoEncParamsType t · 62 unmodified lines
6363 par = av_video_enc_params_alloc(type, nb_blocks, &size);
6464 if (!par)
6565 return NULL;
66− if (size > INT_MAX) {
67− av_free(par);
68− return NULL;
69− }
7066 buf = av_buffer_create((uint8_t *)par, size, NULL, NULL, 0);
7167 if (!buf) {
7268 av_freep(&par);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t