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
2158 pkt->flags & AV_PKT_FLAG_DISCARD ? 'D' : '_');2158 pkt->flags & AV_PKT_FLAG_DISCARD ? 'D' : '_');
2159 2159
2160 if (pkt->side_data_elems) {2160 if (pkt->side_data_elems) {
2161 int size;2161 size_t size;
2162 const uint8_t *side_metadata;2162 const uint8_t *side_metadata;
2163 2163
2164 side_metadata = av_packet_get_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA, &size);2164 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
3437 int buf_consumed;3437 int buf_consumed;
3438 int buf_offset;3438 int buf_offset;
3439 int err;3439 int err;
3440 buffer_size_t new_extradata_size;3440 size_t new_extradata_size;
3441 const uint8_t *new_extradata = av_packet_get_side_data(avpkt,3441 const uint8_t *new_extradata = av_packet_get_side_data(avpkt,
3442 AV_PKT_DATA_NEW_EXTRADATA,3442 AV_PKT_DATA_NEW_EXTRADATA,
3443 &new_extradata_size);3443 &new_extradata_size);
3444 buffer_size_t jp_dualmono_size;3444 size_t jp_dualmono_size;
3445 const uint8_t *jp_dualmono = av_packet_get_side_data(avpkt,3445 const uint8_t *jp_dualmono = av_packet_get_side_data(avpkt,
3446 AV_PKT_DATA_JP_DUALMONO,3446 AV_PKT_DATA_JP_DUALMONO,
3447 &jp_dualmono_size);3447 &jp_dualmono_size);
libavcodec/adxdec.c+1−1
@@ -103,7 +103,7 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data, · 102 unmodified lines
103 const uint8_t *buf = avpkt->data;103 const uint8_t *buf = avpkt->data;
104 const uint8_t *buf_end = buf + avpkt->size;104 const uint8_t *buf_end = buf + avpkt->size;
105 int num_blocks, ch, ret;105 int num_blocks, ch, ret;
106 buffer_size_t new_extradata_size;106 size_t new_extradata_size;
107 uint8_t *new_extradata;107 uint8_t *new_extradata;
108 108
109 new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,109 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
484 if (avctx->codec_id == AV_CODEC_ID_AAC) {484 if (avctx->codec_id == AV_CODEC_ID_AAC) {
485 if (!at->extradata_size) {485 if (!at->extradata_size) {
486 uint8_t *side_data;486 uint8_t *side_data;
487 buffer_size_t side_data_size;487 size_t side_data_size;
488 488
489 side_data = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,489 side_data = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,
490 &side_data_size);490 &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
218 218
219 219
220uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,220uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
221 buffer_size_t size)221 size_t size)
222{222{
223 int ret;223 int ret;
224 uint8_t *data;224 uint8_t *data;
225 225
226#if FF_API_BUFFER_SIZE_T
227 if ((unsigned)size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
228#else
229 if (size > SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE)226 if (size > SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
230#endif
231 return NULL;227 return NULL;
232 data = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);228 data = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
233 if (!data)229 if (!data)
@@ -243,7 +239,7 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, · 9 unmodified lines
243}239}
244 240
245uint8_t *av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,241uint8_t *av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
246 buffer_size_t *size)242 size_t *size)
247{243{
248 int i;244 int i;
249 245
@@ -297,11 +293,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type) · 47 unmodified lines
297 return NULL;293 return NULL;
298}294}
299 295
300#if FF_API_BUFFER_SIZE_T
301uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size)
302#else
303uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size)296uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size)
304#endif
305{297{
306 uint8_t *data = NULL;298 uint8_t *data = NULL;
307 *size = 0;299 *size = 0;
@@ -320,11 +312,7 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size) · 12 unmodified lines
320 312
321 if (pass)313 if (pass)
322 memcpy(data + total_length, str, len);314 memcpy(data + total_length, str, len);
323#if FF_API_BUFFER_SIZE_T
324 else if (len > INT_MAX - total_length)
325#else
326 else if (len > SIZE_MAX - total_length)315 else if (len > SIZE_MAX - total_length)
327#endif
328 return NULL;316 return NULL;
329 total_length += len;317 total_length += len;
330 }318 }
@@ -340,12 +328,8 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size) · 9 unmodified lines
340 return data;328 return data;
341}329}
342 330
343#if FF_API_BUFFER_SIZE_T
344int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict)
345#else
346int av_packet_unpack_dictionary(const uint8_t *data, size_t size,331int av_packet_unpack_dictionary(const uint8_t *data, size_t size,
347 AVDictionary **dict)332 AVDictionary **dict)
348#endif
349{333{
350 const uint8_t *end;334 const uint8_t *end;
351 int ret;335 int ret;
@@ -372,7 +356,7 @@ int av_packet_unpack_dictionary(const uint8_t *data, size_t size, · 20 unmodified lines
372}356}
373 357
374int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,358int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
375 buffer_size_t size)359 size_t size)
376{360{
377 int i;361 int i;
378 362
@@ -402,7 +386,7 @@ int av_packet_copy_props(AVPacket *dst, const AVPacket *src) · 23 unmodified lines
402 dst->side_data_elems = 0;386 dst->side_data_elems = 0;
403 for (i = 0; i < src->side_data_elems; i++) {387 for (i = 0; i < src->side_data_elems; i++) {
404 enum AVPacketSideDataType type = src->side_data[i].type;388 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;
406 uint8_t *src_data = src->side_data[i].data;390 uint8_t *src_data = src->side_data[i].data;
407 uint8_t *dst_data = av_packet_new_side_data(dst, type, size);391 uint8_t *dst_data = av_packet_new_side_data(dst, type, size);
408 392
@@ -599,7 +583,7 @@ void avpriv_packet_list_free(PacketList **pkt_buf, PacketList **pkt_buf_end) · 190 unmodified lines
599int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type)583int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type)
600{584{
601 uint8_t *side_data;585 uint8_t *side_data;
602 buffer_size_t side_data_size;586 size_t side_data_size;
603 int i;587 int i;
604 588
605 side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_QUALITY_STATS, &side_data_size);589 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
625{609{
626 AVProducerReferenceTime *prft;610 AVProducerReferenceTime *prft;
627 uint8_t *side_data;611 uint8_t *side_data;
628 buffer_size_t side_data_size;612 size_t side_data_size;
629 613
630 side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PRFT, &side_data_size);614 side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PRFT, &side_data_size);
631 if (!side_data) {615 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
24 CBSBSFContext *ctx = bsf->priv_data;24 CBSBSFContext *ctx = bsf->priv_data;
25 CodedBitstreamFragment *frag = &ctx->fragment;25 CodedBitstreamFragment *frag = &ctx->fragment;
26 uint8_t *side_data;26 uint8_t *side_data;
27 buffer_size_t side_data_size;27 size_t side_data_size;
28 int err;28 int err;
29 29
30 side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,30 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
67static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt)67static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt)
68{68{
69 int ret;69 int ret;
70 buffer_size_t size;70 size_t size;
71 const uint8_t *data;71 const uint8_t *data;
72 uint32_t flags;72 uint32_t flags;
73 int64_t val;73 int64_t val;
@@ -344,7 +344,7 @@ static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame, · 270 unmodified lines
344 got_frame = 0;344 got_frame = 0;
345 } else if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {345 } else if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {
346 uint8_t *side;346 uint8_t *side;
347 buffer_size_t side_size;347 size_t side_size;
348 uint32_t discard_padding = 0;348 uint32_t discard_padding = 0;
349 uint8_t skip_reason = 0;349 uint8_t skip_reason = 0;
350 uint8_t discard_reason = 0;350 uint8_t discard_reason = 0;
@@ -1463,7 +1463,7 @@ int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags · 1112 unmodified lines
1463 1463
1464static int add_metadata_from_side_data(const AVPacket *avpkt, AVFrame *frame)1464static int add_metadata_from_side_data(const AVPacket *avpkt, AVFrame *frame)
1465{1465{
1466 buffer_size_t size;1466 size_t size;
1467 const uint8_t *side_metadata;1467 const uint8_t *side_metadata;
1468 1468
1469 AVDictionary **frame_md = &frame->metadata;1469 AVDictionary **frame_md = &frame->metadata;
@@ -1502,7 +1502,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame) · 32 unmodified lines
1502 frame->pkt_size = pkt->size;1502 frame->pkt_size = pkt->size;
1503 1503
1504 for (int i = 0; i < FF_ARRAY_ELEMS(sd); i++) {1504 for (int i = 0; i < FF_ARRAY_ELEMS(sd); i++) {
1505 buffer_size_t size;1505 size_t size;
1506 uint8_t *packet_sd = av_packet_get_side_data(pkt, sd[i].packet, &size);1506 uint8_t *packet_sd = av_packet_get_side_data(pkt, sd[i].packet, &size);
1507 if (packet_sd) {1507 if (packet_sd) {
1508 AVFrameSideData *frame_sd = av_frame_new_side_data(frame,1508 AVFrameSideData *frame_sd = av_frame_new_side_data(frame,
@@ -1841,14 +1841,15 @@ FF_ENABLE_DEPRECATION_WARNINGS · 332 unmodified lines
1841 1841
1842int ff_copy_palette(void *dst, const AVPacket *src, void *logctx)1842int ff_copy_palette(void *dst, const AVPacket *src, void *logctx)
1843{1843{
1844 buffer_size_t size;1844 size_t size;
1845 const void *pal = av_packet_get_side_data(src, AV_PKT_DATA_PALETTE, &size);1845 const void *pal = av_packet_get_side_data(src, AV_PKT_DATA_PALETTE, &size);
1846 1846
1847 if (pal && size == AVPALETTE_SIZE) {1847 if (pal && size == AVPALETTE_SIZE) {
1848 memcpy(dst, pal, AVPALETTE_SIZE);1848 memcpy(dst, pal, AVPALETTE_SIZE);
1849 return 1;1849 return 1;
1850 } else if (pal) {1850 } 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);
1852 }1853 }
1853 return 0;1854 return 0;
1854}1855}
libavcodec/h264_metadata_bsf.c+1−1
@@ -371,7 +371,7 @@ static int h264_metadata_handle_display_orientation(AVBSFContext *bsf, · 370 unmodified lines
371 H264RawSEIDisplayOrientation *disp =371 H264RawSEIDisplayOrientation *disp =
372 &ctx->display_orientation_payload;372 &ctx->display_orientation_payload;
373 uint8_t *data;373 uint8_t *data;
374 buffer_size_t size;374 size_t size;
375 int write = 0;375 int write = 0;
376 376
377 data = av_packet_get_side_data(pkt, AV_PKT_DATA_DISPLAYMATRIX, &size);377 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
975 return send_next_delayed_frame(h, pict, got_frame, 0);975 return send_next_delayed_frame(h, pict, got_frame, 0);
976 976
977 if (av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, NULL)) {977 if (av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, NULL)) {
978 buffer_size_t side_size;978 size_t side_size;
979 uint8_t *side = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);979 uint8_t *side = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);
980 ff_h264_decode_extradata(side, side_size,980 ff_h264_decode_extradata(side, side_size,
981 &h->ps, &h->is_avc, &h->nal_length_size,981 &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
3303 AVPacket *avpkt)3303 AVPacket *avpkt)
3304{3304{
3305 int ret;3305 int ret;
3306 buffer_size_t new_extradata_size;3306 size_t new_extradata_size;
3307 uint8_t *new_extradata;3307 uint8_t *new_extradata;
3308 HEVCContext *s = avctx->priv_data;3308 HEVCContext *s = avctx->priv_data;
3309 3309
libavcodec/libvpxdec.c+1−1
@@ -221,7 +221,7 @@ static int vpx_decode(AVCodecContext *avctx, · 220 unmodified lines
221 struct vpx_image *img, *img_alpha;221 struct vpx_image *img, *img_alpha;
222 int ret;222 int ret;
223 uint8_t *side_data = NULL;223 uint8_t *side_data = NULL;
224 buffer_size_t side_data_size;224 size_t side_data_size;
225 225
226 ret = decode_frame(avctx, &ctx->decoder, avpkt->data, avpkt->size);226 ret = decode_frame(avctx, &ctx->decoder, avpkt->data, avpkt->size);
227 if (ret)227 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
575 put_bits(&s->pb, 8, 0xff); // marker_bits575 put_bits(&s->pb, 8, 0xff); // marker_bits
576 } else {576 } else {
577 av_log(s->avctx, AV_LOG_WARNING,577 av_log(s->avctx, AV_LOG_WARNING,
578 "Warning Closed Caption size (%d) can not exceed 93 bytes "578 "Closed Caption size (%"SIZE_SPECIFIER") can not exceed "
579 "and must be a multiple of 3\n", side_data->size);579 "93 bytes and must be a multiple of 3\n", side_data->size);
580 }580 }
581 }581 }
582 }582 }
libavcodec/mscc.c+3−2
@@ -152,7 +152,7 @@ static int decode_frame(AVCodecContext *avctx, · 151 unmodified lines
152 }152 }
153 153
154 if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {154 if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
155 buffer_size_t size;155 size_t size;
156 const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);156 const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
157 157
158 if (pal && size == AVPALETTE_SIZE) {158 if (pal && size == AVPALETTE_SIZE) {
@@ -160,7 +160,8 @@ static int decode_frame(AVCodecContext *avctx, · 1 unmodified line
160 for (j = 0; j < 256; j++)160 for (j = 0; j < 256; j++)
161 s->pal[j] = 0xFF000000 | AV_RL32(pal + j * 4);161 s->pal[j] = 0xFF000000 | AV_RL32(pal + j * 4);
162 } else if (pal) {162 } 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);
164 }165 }
165 memcpy(frame->data[1], s->pal, AVPALETTE_SIZE);166 memcpy(frame->data[1], s->pal, AVPALETTE_SIZE);
166 }167 }
libavcodec/nvdec.c+2−2
@@ -242,7 +242,7 @@ fail: · 241 unmodified lines
242 return ret;242 return ret;
243}243}
244 244
245static AVBufferRef *nvdec_decoder_frame_alloc(void *opaque, buffer_size_t size)245static AVBufferRef *nvdec_decoder_frame_alloc(void *opaque, size_t size)
246{246{
247 NVDECFramePool *pool = opaque;247 NVDECFramePool *pool = opaque;
248 AVBufferRef *ret;248 AVBufferRef *ret;
@@ -283,7 +283,7 @@ static void nvdec_free_dummy(struct AVHWFramesContext *ctx) · 34 unmodified lines
283 av_buffer_pool_uninit(&ctx->pool);283 av_buffer_pool_uninit(&ctx->pool);
284}284}
285 285
286static AVBufferRef *nvdec_alloc_dummy(buffer_size_t size)286static AVBufferRef *nvdec_alloc_dummy(size_t size)
287{287{
288 return av_buffer_create(NULL, 0, NULL, NULL, 0);288 return av_buffer_create(NULL, 0, NULL, NULL, 0);
289}289}
libavcodec/packet.h+0−24
@@ -305,11 +305,7 @@ enum AVPacketSideDataType { · 304 unmodified lines
305 305
306typedef struct AVPacketSideData {306typedef struct AVPacketSideData {
307 uint8_t *data;307 uint8_t *data;
308#if FF_API_BUFFER_SIZE_T
309 int size;
310#else
311 size_t size;308 size_t size;
312#endif
313 enum AVPacketSideDataType type;309 enum AVPacketSideDataType type;
314} AVPacketSideData;310} AVPacketSideData;
315 311
@@ -528,11 +524,7 @@ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size); · 212 unmodified lines
528 * @return pointer to fresh allocated data or NULL otherwise524 * @return pointer to fresh allocated data or NULL otherwise
529 */525 */
530uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,526uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
531#if FF_API_BUFFER_SIZE_T
532 int size);
533#else
534 size_t size);527 size_t size);
535#endif
536 528
537/**529/**
538 * Wrap an existing array as a packet side data.530 * 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
559 * @return 0 on success, < 0 on failure551 * @return 0 on success, < 0 on failure
560 */552 */
561int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,553int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
562#if FF_API_BUFFER_SIZE_T
563 int size);
564#else
565 size_t size);554 size_t size);
566#endif
567 555
568/**556/**
569 * Get side information from packet.557 * Get side information from packet.
@@ -575,11 +563,7 @@ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, · 5 unmodified lines
575 * @return pointer to data if present or NULL otherwise563 * @return pointer to data if present or NULL otherwise
576 */564 */
577uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,565uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
578#if FF_API_BUFFER_SIZE_T
579 int *size);
580#else
581 size_t *size);566 size_t *size);
582#endif
583 567
584const char *av_packet_side_data_name(enum AVPacketSideDataType type);568const char *av_packet_side_data_name(enum AVPacketSideDataType type);
585 569
@@ -590,11 +574,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type); · 4 unmodified lines
590 * @param size pointer to store the size of the returned data574 * @param size pointer to store the size of the returned data
591 * @return pointer to data if successful, NULL otherwise575 * @return pointer to data if successful, NULL otherwise
592 */576 */
593#if FF_API_BUFFER_SIZE_T
594uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size);
595#else
596uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size);577uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size);
597#endif
598/**578/**
599 * Unpack a dictionary from side_data.579 * Unpack a dictionary from side_data.
600 *580 *
@@ -603,12 +583,8 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size); · 2 unmodified lines
603 * @param dict the metadata storage dictionary583 * @param dict the metadata storage dictionary
604 * @return 0 on success, < 0 on failure584 * @return 0 on success, < 0 on failure
605 */585 */
606#if FF_API_BUFFER_SIZE_T
607int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict);
608#else
609int av_packet_unpack_dictionary(const uint8_t *data, size_t size,586int av_packet_unpack_dictionary(const uint8_t *data, size_t size,
610 AVDictionary **dict);587 AVDictionary **dict);
611#endif
612 588
613/**589/**
614 * Convenience function to free all the side data stored.590 * 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
59 AVBPrint buffer;59 AVBPrint buffer;
60 int x1 = -1, y1 = -1, x2 = -1, y2 = -1;60 int x1 = -1, y1 = -1, x2 = -1, y2 = -1;
61 int ret;61 int ret;
62 buffer_size_t size;62 size_t size;
63 const uint8_t *p = av_packet_get_side_data(avpkt, AV_PKT_DATA_SUBTITLE_POSITION, &size);63 const uint8_t *p = av_packet_get_side_data(avpkt, AV_PKT_DATA_SUBTITLE_POSITION, &size);
64 FFASSDecoderContext *s = avctx->priv_data;64 FFASSDecoderContext *s = avctx->priv_data;
65 65
libavcodec/vaapi_encode.c+1−1
@@ -2235,7 +2235,7 @@ static void vaapi_encode_free_output_buffer(void *opaque, · 2234 unmodified lines
2235}2235}
2236 2236
2237static AVBufferRef *vaapi_encode_alloc_output_buffer(void *opaque,2237static AVBufferRef *vaapi_encode_alloc_output_buffer(void *opaque,
2238 buffer_size_t size)2238 size_t size)
2239{2239{
2240 AVCodecContext *avctx = opaque;2240 AVCodecContext *avctx = opaque;
2241 VAAPIEncodeContext *ctx = avctx->priv_data;2241 VAAPIEncodeContext *ctx = avctx->priv_data;
libavdevice/decklink_dec.cpp+2−2
@@ -936,7 +936,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived( · 935 unmodified lines
936 }936 }
937 937
938 if (av_dict_set(&metadata_dict, "timecode", tc, 0) >= 0) {938 if (av_dict_set(&metadata_dict, "timecode", tc, 0) >= 0) {
939 buffer_size_t metadata_len;939 size_t metadata_len;
940 packed_metadata = av_packet_pack_dictionary(metadata_dict, &metadata_len);940 packed_metadata = av_packet_pack_dictionary(metadata_dict, &metadata_len);
941 av_dict_free(&metadata_dict);941 av_dict_free(&metadata_dict);
942 if (packed_metadata) {942 if (packed_metadata) {
@@ -1435,7 +1435,7 @@ int ff_decklink_read_packet(AVFormatContext *avctx, AVPacket *pkt) · 492 unmodified lines
1435 avpacket_queue_get(&ctx->queue, pkt, 1);1435 avpacket_queue_get(&ctx->queue, pkt, 1);
1436 1436
1437 if (ctx->tc_format && !(av_dict_get(ctx->video_st->metadata, "timecode", NULL, 0))) {1437 if (ctx->tc_format && !(av_dict_get(ctx->video_st->metadata, "timecode", NULL, 0))) {
1438 buffer_size_t size;1438 size_t size;
1439 const uint8_t *side_metadata = av_packet_get_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA, &size);1439 const uint8_t *side_metadata = av_packet_get_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA, &size);
1440 if (side_metadata) {1440 if (side_metadata) {
1441 if (av_packet_unpack_dictionary(side_metadata, size, &ctx->video_st->metadata) < 0)1441 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
313 uint16_t *cdp_words;313 uint16_t *cdp_words;
314 uint16_t len;314 uint16_t len;
315 uint8_t cc_count;315 uint8_t cc_count;
316 buffer_size_t size;316 size_t size;
317 int ret, i;317 int ret, i;
318 318
319 const uint8_t *data = av_packet_get_side_data(pkt, AV_PKT_DATA_A53_CC, &size);319 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
446 446
447 frame_metadata = frame->metadata;447 frame_metadata = frame->metadata;
448 if (frame_metadata) {448 if (frame_metadata) {
449 buffer_size_t size;449 size_t size;
450 uint8_t *metadata = av_packet_pack_dictionary(frame_metadata, &size);450 uint8_t *metadata = av_packet_pack_dictionary(frame_metadata, &size);
451 451
452 if (!metadata) {452 if (!metadata) {
libavdevice/xcbgrab.c+1−1
@@ -236,7 +236,7 @@ static void free_shm_buffer(void *opaque, uint8_t *data) · 235 unmodified lines
236 shmdt(data);236 shmdt(data);
237}237}
238 238
239static AVBufferRef *allocate_shm_buffer(void *opaque, buffer_size_t size)239static AVBufferRef *allocate_shm_buffer(void *opaque, size_t size)
240{240{
241 xcb_connection_t *conn = opaque;241 xcb_connection_t *conn = opaque;
242 xcb_shm_seg_t segment;242 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
170 170
171static void dump_unknown(AVFilterContext *ctx, AVFrameSideData *sd)171static void dump_unknown(AVFilterContext *ctx, AVFrameSideData *sd)
172{172{
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);
174}175}
175 176
176static int filter_frame(AVFilterLink *inlink, AVFrame *buf)177static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
libavfilter/framepool.c+2−2
@@ -48,7 +48,7 @@ struct FFFramePool { · 47 unmodified lines
48 48
49};49};
50 50
51FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(buffer_size_t size),51FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t size),
52 int width,52 int width,
53 int height,53 int height,
54 enum AVPixelFormat format,54 enum AVPixelFormat format,
@@ -115,7 +115,7 @@ fail: · 60 unmodified lines
115 return NULL;115 return NULL;
116}116}
117 117
118FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(buffer_size_t size),118FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(size_t size),
119 int channels,119 int channels,
120 int nb_samples,120 int nb_samples,
121 enum AVSampleFormat format,121 enum AVSampleFormat format,
libavfilter/framepool.h+2−2
@@ -44,7 +44,7 @@ typedef struct FFFramePool FFFramePool; · 43 unmodified lines
44 * @param align buffers alignement of each frame in this pool44 * @param align buffers alignement of each frame in this pool
45 * @return newly created video frame pool on success, NULL on error.45 * @return newly created video frame pool on success, NULL on error.
46 */46 */
47FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(buffer_size_t size),47FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t size),
48 int width,48 int width,
49 int height,49 int height,
50 enum AVPixelFormat format,50 enum AVPixelFormat format,
@@ -62,7 +62,7 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(buffer_size_t size), · 11 unmodified lines
62 * @param align buffers alignement of each frame in this pool62 * @param align buffers alignement of each frame in this pool
63 * @return newly created audio frame pool on success, NULL on error.63 * @return newly created audio frame pool on success, NULL on error.
64 */64 */
65FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(buffer_size_t size),65FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(size_t size),
66 int channels,66 int channels,
67 int samples,67 int samples,
68 enum AVSampleFormat format,68 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
340 int i;340 int i;
341 341
342 if (sd->size < uuid_size) {342 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);
344 return;345 return;
345 }346 }
346 347
@@ -498,7 +499,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 151 unmodified lines
498 av_log(ctx, AV_LOG_INFO, "pan/scan");499 av_log(ctx, AV_LOG_INFO, "pan/scan");
499 break;500 break;
500 case AV_FRAME_DATA_A53_CC:501 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);
502 break;504 break;
503 case AV_FRAME_DATA_SPHERICAL:505 case AV_FRAME_DATA_SPHERICAL:
504 dump_spherical(ctx, frame, sd);506 dump_spherical(ctx, frame, sd);
@@ -545,8 +547,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 40 unmodified lines
545 dump_sei_unregistered_metadata(ctx, sd);547 dump_sei_unregistered_metadata(ctx, sd);
546 break;548 break;
547 default:549 default:
548 av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d bytes)\n",550 av_log(ctx, AV_LOG_WARNING, "unknown side data type %d "
549 sd->type, sd->size);551 "(%"SIZE_SPECIFIER" bytes)\n", sd->type, sd->size);
550 break;552 break;
551 }553 }
552 554
libavformat/adtsenc.c+1−1
@@ -170,7 +170,7 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) · 169 unmodified lines
170 return 0;170 return 0;
171 if (!par->extradata_size) {171 if (!par->extradata_size) {
172 uint8_t *side_data;172 uint8_t *side_data;
173 buffer_size_t side_data_size;173 size_t side_data_size;
174 int ret;174 int ret;
175 175
176 side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,176 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
119 AVIOContext *io_context = format_context->pb;119 AVIOContext *io_context = format_context->pb;
120 AVStream *codec_stream = format_context->streams[0];120 AVStream *codec_stream = format_context->streams[0];
121 uint8_t *side_data = NULL;121 uint8_t *side_data = NULL;
122 buffer_size_t side_data_size;122 size_t side_data_size;
123 123
124 av_assert0(apng->prev_packet);124 av_assert0(apng->prev_packet);
125 125
libavformat/avformat.h+0−8
@@ -1873,11 +1873,7 @@ int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type, · 1872 unmodified lines
1873 * @return pointer to fresh allocated data or NULL otherwise1873 * @return pointer to fresh allocated data or NULL otherwise
1874 */1874 */
1875uint8_t *av_stream_new_side_data(AVStream *stream,1875uint8_t *av_stream_new_side_data(AVStream *stream,
1876#if FF_API_BUFFER_SIZE_T
1877 enum AVPacketSideDataType type, int size);
1878#else
1879 enum AVPacketSideDataType type, size_t size);1876 enum AVPacketSideDataType type, size_t size);
1880#endif
1881/**1877/**
1882 * Get side information from stream.1878 * Get side information from stream.
1883 *1879 *
@@ -1888,11 +1884,7 @@ uint8_t *av_stream_new_side_data(AVStream *stream, · 4 unmodified lines
1888 * @return pointer to data if present or NULL otherwise1884 * @return pointer to data if present or NULL otherwise
1889 */1885 */
1890uint8_t *av_stream_get_side_data(const AVStream *stream,1886uint8_t *av_stream_get_side_data(const AVStream *stream,
1891#if FF_API_BUFFER_SIZE_T
1892 enum AVPacketSideDataType type, int *size);
1893#else
1894 enum AVPacketSideDataType type, size_t *size);1887 enum AVPacketSideDataType type, size_t *size);
1895#endif
1896 1888
1897AVProgram *av_new_program(AVFormatContext *s, int id);1889AVProgram *av_new_program(AVFormatContext *s, int id);
1898 1890
libavformat/concatdec.c+1−1
@@ -626,7 +626,7 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt) · 625 unmodified lines
626 av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base),626 av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base),
627 av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base));627 av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base));
628 if (cat->cur_file->metadata) {628 if (cat->cur_file->metadata) {
629 buffer_size_t metadata_len;629 size_t metadata_len;
630 char* packed_metadata = av_packet_pack_dictionary(cat->cur_file->metadata, &metadata_len);630 char* packed_metadata = av_packet_pack_dictionary(cat->cur_file->metadata, &metadata_len);
631 if (!packed_metadata)631 if (!packed_metadata)
632 return AVERROR(ENOMEM);632 return AVERROR(ENOMEM);
libavformat/dashenc.c+2−2
@@ -1806,7 +1806,7 @@ static int update_stream_extradata(AVFormatContext *s, OutputStream *os, · 1805 unmodified lines
1806{1806{
1807 AVCodecParameters *par = os->ctx->streams[0]->codecpar;1807 AVCodecParameters *par = os->ctx->streams[0]->codecpar;
1808 uint8_t *extradata;1808 uint8_t *extradata;
1809 buffer_size_t extradata_size;1809 size_t extradata_size;
1810 int ret;1810 int ret;
1811 1811
1812 if (par->extradata_size)1812 if (par->extradata_size)
@@ -2022,7 +2022,7 @@ static int dash_parse_prft(DASHContext *c, AVPacket *pkt) · 209 unmodified lines
2022{2022{
2023 OutputStream *os = &c->streams[pkt->stream_index];2023 OutputStream *os = &c->streams[pkt->stream_index];
2024 AVProducerReferenceTime *prft;2024 AVProducerReferenceTime *prft;
2025 buffer_size_t side_data_size;2025 size_t side_data_size;
2026 2026
2027 prft = (AVProducerReferenceTime *)av_packet_get_side_data(pkt, AV_PKT_DATA_PRFT, &side_data_size);2027 prft = (AVProducerReferenceTime *)av_packet_get_side_data(pkt, AV_PKT_DATA_PRFT, &side_data_size);
2028 if (!prft || side_data_size != sizeof(AVProducerReferenceTime) || (prft->flags && prft->flags != 24)) {2028 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
491 dump_s12m_timecode(ctx, st, sd);491 dump_s12m_timecode(ctx, st, sd);
492 break;492 break;
493 default:493 default:
494 av_log(ctx, AV_LOG_INFO,494 av_log(ctx, AV_LOG_INFO, "unknown side data type %d "
495 "unknown side data type %d (%d bytes)", sd->type, sd->size);495 "(%"SIZE_SPECIFIER" bytes)", sd->type, sd->size);
496 break;496 break;
497 }497 }
498 498
libavformat/flacenc.c+1−1
@@ -280,7 +280,7 @@ static int flac_write_audio_packet(struct AVFormatContext *s, AVPacket *pkt) · 279 unmodified lines
280{280{
281 FlacMuxerContext *c = s->priv_data;281 FlacMuxerContext *c = s->priv_data;
282 uint8_t *streaminfo;282 uint8_t *streaminfo;
283 buffer_size_t streaminfo_size;283 size_t streaminfo_size;
284 284
285 /* check for updated streaminfo */285 /* check for updated streaminfo */
286 streaminfo = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,286 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
902 902
903 if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264903 if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264
904 || par->codec_id == AV_CODEC_ID_MPEG4) {904 || par->codec_id == AV_CODEC_ID_MPEG4) {
905 buffer_size_t side_size;905 size_t side_size;
906 uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);906 uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);
907 if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) {907 if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) {
908 ret = ff_alloc_extradata(par, side_size);908 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
88 case AV_PKT_DATA_SPHERICAL:88 case AV_PKT_DATA_SPHERICAL:
89 case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:89 case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:
90 case AV_PKT_DATA_S12M_TIMECODE:90 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++) {
92 uint8_t buf[4];92 uint8_t buf[4];
93 AV_WL32(buf, AV_RB32(sd->data + 4 * j));93 AV_WL32(buf, AV_RB32(sd->data + 4 * j));
94 side_data_crc = av_adler32_update(side_data_crc, buf, 4);94 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
119 default:119 default:
120 side_data_crc = av_adler32_update(0, data, sd->size);120 side_data_crc = av_adler32_update(0, data, sd->size);
121 }121 }
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);
123 }125 }
124 }126 }
125 av_strlcatf(buf, sizeof(buf), "\n");127 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
298 avio_write(s->pb, buf, strlen(buf));298 avio_write(s->pb, buf, strlen(buf));
299 299
300 if (c->format_version > 1 && pkt->side_data_elems) {300 if (c->format_version > 1 && pkt->side_data_elems) {
301 int i, j;301 int i;
302 avio_printf(s->pb, ", S=%d", pkt->side_data_elems);302 avio_printf(s->pb, ", S=%d", pkt->side_data_elems);
303 for (i = 0; i < pkt->side_data_elems; i++) {303 for (i = 0; i < pkt->side_data_elems; i++) {
304 av_hash_init(c->hashes[0]);304 av_hash_init(c->hashes[0]);
305 if (HAVE_BIGENDIAN && pkt->side_data[i].type == AV_PKT_DATA_PALETTE) {305 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)) {
307 uint32_t data = AV_RL32(pkt->side_data[i].data + j);307 uint32_t data = AV_RL32(pkt->side_data[i].data + j);
308 av_hash_update(c->hashes[0], (uint8_t *)&data, sizeof(uint32_t));308 av_hash_update(c->hashes[0], (uint8_t *)&data, sizeof(uint32_t));
309 }309 }
310 } else310 } else
311 av_hash_update(c->hashes[0], pkt->side_data[i].data, pkt->side_data[i].size);311 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);
313 len = strlen(buf);314 len = strlen(buf);
314 av_hash_final_hex(c->hashes[0], buf + len, sizeof(buf) - len);315 av_hash_final_hex(c->hashes[0], buf + len, sizeof(buf) - len);
315 avio_write(s->pb, buf, strlen(buf));316 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
383static int add_filename_as_pkt_side_data(char *filename, AVPacket *pkt) {383static int add_filename_as_pkt_side_data(char *filename, AVPacket *pkt) {
384 AVDictionary *d = NULL;384 AVDictionary *d = NULL;
385 char *packed_metadata = NULL;385 char *packed_metadata = NULL;
386 buffer_size_t metadata_len;386 size_t metadata_len;
387 int ret;387 int ret;
388 388
389 av_dict_set(&d, "lavf.image2dec.source_path", filename, 0);389 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
176 return ff_raw_write_packet(s, pkt);176 return ff_raw_write_packet(s, pkt);
177 else {177 else {
178 uint8_t *side_data;178 uint8_t *side_data;
179 buffer_size_t side_data_size;179 size_t side_data_size;
180 int ret;180 int ret;
181 181
182 side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,182 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
2030 AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar;2030 AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar;
2031 mkv_track *track = &mkv->tracks[pkt->stream_index];2031 mkv_track *track = &mkv->tracks[pkt->stream_index];
2032 uint8_t *data = NULL, *side_data = NULL;2032 uint8_t *data = NULL, *side_data = NULL;
2033 buffer_size_t side_data_size;2033 size_t side_data_size;
2034 int err = 0, offset = 0, size = pkt->size;2034 int err = 0, offset = 0, size = pkt->size;
2035 int64_t ts = track->write_dts ? pkt->dts : pkt->pts;2035 int64_t ts = track->write_dts ? pkt->dts : pkt->pts;
2036 uint64_t additional_id;2036 uint64_t additional_id;
@@ -2141,7 +2141,7 @@ static int mkv_write_vtt_blocks(AVFormatContext *s, AVIOContext *pb, const AVPac · 104 unmodified lines
2141 MatroskaMuxContext *mkv = s->priv_data;2141 MatroskaMuxContext *mkv = s->priv_data;
2142 mkv_track *track = &mkv->tracks[pkt->stream_index];2142 mkv_track *track = &mkv->tracks[pkt->stream_index];
2143 ebml_master blockgroup;2143 ebml_master blockgroup;
2144 buffer_size_t id_size, settings_size;2144 size_t id_size, settings_size;
2145 int size, id_size_int, settings_size_int;2145 int size, id_size_int, settings_size_int;
2146 const char *id, *settings;2146 const char *id, *settings;
2147 int64_t ts = track->write_dts ? pkt->dts : pkt->pts;2147 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
2214 mkv_track *track = &mkv->tracks[pkt->stream_index];2214 mkv_track *track = &mkv->tracks[pkt->stream_index];
2215 AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar;2215 AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar;
2216 uint8_t *side_data;2216 uint8_t *side_data;
2217 buffer_size_t side_data_size;2217 size_t side_data_size;
2218 int ret;2218 int ret;
2219 2219
2220 side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,2220 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
6364 uint8_t **key_ids;6364 uint8_t **key_ids;
6365 AVStream *st;6365 AVStream *st;
6366 uint8_t *side_data, *extra_data, *old_side_data;6366 uint8_t *side_data, *extra_data, *old_side_data;
6367 size_t side_data_size;6367 size_t side_data_size, old_side_data_size;
6368 buffer_size_t old_side_data_size;
6369 int ret = 0;6368 int ret = 0;
6370 unsigned int version, kid_count, extra_data_size, alloc_size = 0;6369 unsigned int version, kid_count, extra_data_size, alloc_size = 0;
6371 6370
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
1992 // Ref (MP4): ISO/IEC 14496-12:20121992 // Ref (MP4): ISO/IEC 14496-12:2012
1993 1993
1994 const uint8_t *icc_profile;1994 const uint8_t *icc_profile;
1995 buffer_size_t icc_profile_size;1995 size_t icc_profile_size;
1996 1996
1997 if (prefer_icc) {1997 if (prefer_icc) {
1998 icc_profile = av_stream_get_side_data(track->st, AV_PKT_DATA_ICC_PROFILE, &icc_profile_size);1998 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
3046 int group = 0;3046 int group = 0;
3047 3047
3048 uint32_t *display_matrix = NULL;3048 uint32_t *display_matrix = NULL;
3049 buffer_size_t display_matrix_size;3049 size_t display_matrix_size;
3050 int i;3050 int i;
3051 3051
3052 if (st) {3052 if (st) {
@@ -4173,7 +4173,7 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, · 1120 unmodified lines
4173 track->tref_tag = MKTAG('h','i','n','t');4173 track->tref_tag = MKTAG('h','i','n','t');
4174 track->tref_id = mov->tracks[track->src_track].track_id;4174 track->tref_id = mov->tracks[track->src_track].track_id;
4175 } else if (track->par->codec_type == AVMEDIA_TYPE_AUDIO) {4175 } else if (track->par->codec_type == AVMEDIA_TYPE_AUDIO) {
4176 buffer_size_t size;4176 size_t size;
4177 int *fallback;4177 int *fallback;
4178 fallback = (int*)av_stream_get_side_data(track->st,4178 fallback = (int*)av_stream_get_side_data(track->st,
4179 AV_PKT_DATA_FALLBACK_TRACK,4179 AV_PKT_DATA_FALLBACK_TRACK,
@@ -5557,7 +5557,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) · 1377 unmodified lines
5557 AVProducerReferenceTime *prft;5557 AVProducerReferenceTime *prft;
5558 unsigned int samples_in_chunk = 0;5558 unsigned int samples_in_chunk = 0;
5559 int size = pkt->size, ret = 0, offset = 0;5559 int size = pkt->size, ret = 0, offset = 0;
5560 buffer_size_t prft_size;5560 size_t prft_size;
5561 uint8_t *reformatted_data = NULL;5561 uint8_t *reformatted_data = NULL;
5562 5562
5563 ret = check_pkt(s, pkt);5563 ret = check_pkt(s, pkt);
@@ -5910,7 +5910,7 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt) · 346 unmodified lines
5910 trk->par->codec_id == AV_CODEC_ID_AAC ||5910 trk->par->codec_id == AV_CODEC_ID_AAC ||
5911 trk->par->codec_id == AV_CODEC_ID_AV1 ||5911 trk->par->codec_id == AV_CODEC_ID_AV1 ||
5912 trk->par->codec_id == AV_CODEC_ID_FLAC) {5912 trk->par->codec_id == AV_CODEC_ID_FLAC) {
5913 buffer_size_t side_size;5913 size_t side_size;
5914 uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);5914 uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);
5915 if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) {5915 if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) {
5916 void *newextra = av_mallocz(side_size + AV_INPUT_BUFFER_PADDING_SIZE);5916 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
355 355
356 if (mp3->xing_offset) {356 if (mp3->xing_offset) {
357 uint8_t *side_data = NULL;357 uint8_t *side_data = NULL;
358 buffer_size_t side_data_size;358 size_t side_data_size;
359 359
360 mp3_xing_add_frame(mp3, pkt);360 mp3_xing_add_frame(mp3, pkt);
361 mp3->audio_size += pkt->size;361 mp3->audio_size += pkt->size;
@@ -402,7 +402,7 @@ static void mp3_update_xing(AVFormatContext *s) · 40 unmodified lines
402 AVReplayGain *rg;402 AVReplayGain *rg;
403 uint16_t tag_crc;403 uint16_t tag_crc;
404 uint8_t *toc;404 uint8_t *toc;
405 buffer_size_t rg_size;405 size_t rg_size;
406 int i;406 int i;
407 int64_t old_pos = avio_tell(s->pb);407 int64_t old_pos = avio_tell(s->pb);
408 408
libavformat/mpegtsenc.c+2−2
@@ -1681,7 +1681,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) · 1680 unmodified lines
1681 const int64_t max_audio_delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE) / 2;1681 const int64_t max_audio_delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE) / 2;
1682 int64_t dts = pkt->dts, pts = pkt->pts;1682 int64_t dts = pkt->dts, pts = pkt->pts;
1683 int opus_samples = 0;1683 int opus_samples = 0;
1684 buffer_size_t side_data_size;1684 size_t side_data_size;
1685 uint8_t *side_data = NULL;1685 uint8_t *side_data = NULL;
1686 int stream_id = -1;1686 int stream_id = -1;
1687 1687
@@ -1818,7 +1818,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) · 130 unmodified lines
1818 /* Add Opus control header */1818 /* Add Opus control header */
1819 if ((AV_RB16(pkt->data) >> 5) != 0x3ff) {1819 if ((AV_RB16(pkt->data) >> 5) != 0x3ff) {
1820 uint8_t *side_data;1820 uint8_t *side_data;
1821 buffer_size_t side_data_size;1821 size_t side_data_size;
1822 int i, n;1822 int i, n;
1823 int ctrl_header_size;1823 int ctrl_header_size;
1824 int trim_start = 0, trim_end = 0;1824 int trim_start = 0, trim_end = 0;
libavformat/oggdec.h+1−1
@@ -87,7 +87,7 @@ struct ogg_stream { · 86 unmodified lines
87 int start_trimming; ///< set the number of packets to drop from the start87 int start_trimming; ///< set the number of packets to drop from the start
88 int end_trimming; ///< set the number of packets to drop from the end88 int end_trimming; ///< set the number of packets to drop from the end
89 uint8_t *new_metadata;89 uint8_t *new_metadata;
90 buffer_size_t new_metadata_size;90 size_t new_metadata_size;
91 void *private;91 void *private;
92};92};
93 93
libavformat/rtpenc.c+1−1
@@ -589,7 +589,7 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt) · 588 unmodified lines
589 break;589 break;
590 case AV_CODEC_ID_H263:590 case AV_CODEC_ID_H263:
591 if (s->flags & FF_RTP_FLAG_RFC2190) {591 if (s->flags & FF_RTP_FLAG_RFC2190) {
592 buffer_size_t mb_info_size;592 size_t mb_info_size;
593 const uint8_t *mb_info =593 const uint8_t *mb_info =
594 av_packet_get_side_data(pkt, AV_PKT_DATA_H263_MB_INFO,594 av_packet_get_side_data(pkt, AV_PKT_DATA_H263_MB_INFO,
595 &mb_info_size);595 &mb_info_size);
libavformat/segment.c+1−1
@@ -856,7 +856,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt) · 855 unmodified lines
856 return AVERROR(EINVAL);856 return AVERROR(EINVAL);
857 857
858 if (!st->codecpar->extradata_size) {858 if (!st->codecpar->extradata_size) {
859 buffer_size_t pkt_extradata_size;859 size_t pkt_extradata_size;
860 uint8_t *pkt_extradata = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &pkt_extradata_size);860 uint8_t *pkt_extradata = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &pkt_extradata_size);
861 if (pkt_extradata && pkt_extradata_size > 0) {861 if (pkt_extradata && pkt_extradata_size > 0) {
862 ret = ff_alloc_extradata(st->codecpar, pkt_extradata_size);862 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
61 SRTContext *srt = avf->priv_data;61 SRTContext *srt = avf->priv_data;
62 62
63 int64_t s = pkt->pts, e, d = pkt->duration;63 int64_t s = pkt->pts, e, d = pkt->duration;
64 buffer_size_t size;64 size_t size;
65 int x1 = -1, y1 = -1, x2 = -1, y2 = -1;65 int x1 = -1, y1 = -1, x2 = -1, y2 = -1;
66 const uint8_t *p;66 const uint8_t *p;
67 67
libavformat/utils.c+3−3
@@ -5462,7 +5462,7 @@ int ff_generate_avci_extradata(AVStream *st) · 5461 unmodified lines
5462}5462}
5463 5463
5464uint8_t *av_stream_get_side_data(const AVStream *st,5464uint8_t *av_stream_get_side_data(const AVStream *st,
5465 enum AVPacketSideDataType type, buffer_size_t *size)5465 enum AVPacketSideDataType type, size_t *size)
5466{5466{
5467 int i;5467 int i;
5468 5468
@@ -5515,7 +5515,7 @@ int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type, · 46 unmodified lines
5515}5515}
5516 5516
5517uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type,5517uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type,
5518 buffer_size_t size)5518 size_t size)
5519{5519{
5520 int ret;5520 int ret;
5521 uint8_t *data = av_malloc(size);5521 uint8_t *data = av_malloc(size);
@@ -5631,7 +5631,7 @@ int ff_standardize_creation_time(AVFormatContext *s) · 109 unmodified lines
5631int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, uint32_t *palette)5631int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, uint32_t *palette)
5632{5632{
5633 uint8_t *side_data;5633 uint8_t *side_data;
5634 buffer_size_t size;5634 size_t size;
5635 5635
5636 side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PALETTE, &size);5636 side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PALETTE, &size);
5637 if (side_data) {5637 if (side_data) {
libavformat/webvttdec.c+1−1
@@ -78,7 +78,7 @@ static int webvtt_read_header(AVFormatContext *s) · 77 unmodified lines
78 int64_t pos;78 int64_t pos;
79 AVPacket *sub;79 AVPacket *sub;
80 const char *p, *identifier, *settings;80 const char *p, *identifier, *settings;
81 int identifier_len, settings_len;81 size_t identifier_len, settings_len;
82 int64_t ts_start, ts_end;82 int64_t ts_start, ts_end;
83 83
84 ff_subtitles_read_chunk(s->pb, &cue);84 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
64static int webvtt_write_packet(AVFormatContext *ctx, AVPacket *pkt)64static int webvtt_write_packet(AVFormatContext *ctx, AVPacket *pkt)
65{65{
66 AVIOContext *pb = ctx->pb;66 AVIOContext *pb = ctx->pb;
67 buffer_size_t id_size, settings_size;67 size_t id_size, settings_size;
68 int id_size_int, settings_size_int;68 int id_size_int, settings_size_int;
69 uint8_t *id, *settings;69 uint8_t *id, *settings;
70 70
libavutil/buffer.c+7−7
@@ -26,7 +26,7 @@ · 25 unmodified lines
26#include "mem.h"26#include "mem.h"
27#include "thread.h"27#include "thread.h"
28 28
29AVBufferRef *av_buffer_create(uint8_t *data, buffer_size_t size,29AVBufferRef *av_buffer_create(uint8_t *data, size_t size,
30 void (*free)(void *opaque, uint8_t *data),30 void (*free)(void *opaque, uint8_t *data),
31 void *opaque, int flags)31 void *opaque, int flags)
32{32{
@@ -64,7 +64,7 @@ void av_buffer_default_free(void *opaque, uint8_t *data) · 31 unmodified lines
64 av_free(data);64 av_free(data);
65}65}
66 66
67AVBufferRef *av_buffer_alloc(buffer_size_t size)67AVBufferRef *av_buffer_alloc(size_t size)
68{68{
69 AVBufferRef *ret = NULL;69 AVBufferRef *ret = NULL;
70 uint8_t *data = NULL;70 uint8_t *data = NULL;
@@ -80,7 +80,7 @@ AVBufferRef *av_buffer_alloc(buffer_size_t size) · 9 unmodified lines
80 return ret;80 return ret;
81}81}
82 82
83AVBufferRef *av_buffer_allocz(buffer_size_t size)83AVBufferRef *av_buffer_allocz(size_t size)
84{84{
85 AVBufferRef *ret = av_buffer_alloc(size);85 AVBufferRef *ret = av_buffer_alloc(size);
86 if (!ret)86 if (!ret)
@@ -166,7 +166,7 @@ int av_buffer_make_writable(AVBufferRef **pbuf) · 79 unmodified lines
166 return 0;166 return 0;
167}167}
168 168
169int av_buffer_realloc(AVBufferRef **pbuf, buffer_size_t size)169int av_buffer_realloc(AVBufferRef **pbuf, size_t size)
170{170{
171 AVBufferRef *buf = *pbuf;171 AVBufferRef *buf = *pbuf;
172 uint8_t *tmp;172 uint8_t *tmp;
@@ -242,8 +242,8 @@ int av_buffer_replace(AVBufferRef **pdst, AVBufferRef *src) · 69 unmodified lines
242 return 0;242 return 0;
243}243}
244 244
245AVBufferPool *av_buffer_pool_init2(buffer_size_t size, void *opaque,245AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque,
246 AVBufferRef* (*alloc)(void *opaque, buffer_size_t size),246 AVBufferRef* (*alloc)(void *opaque, size_t size),
247 void (*pool_free)(void *opaque))247 void (*pool_free)(void *opaque))
248{248{
249 AVBufferPool *pool = av_mallocz(sizeof(*pool));249 AVBufferPool *pool = av_mallocz(sizeof(*pool));
@@ -263,7 +263,7 @@ AVBufferPool *av_buffer_pool_init2(buffer_size_t size, void *opaque, · 13 unmodified lines
263 return pool;263 return pool;
264}264}
265 265
266AVBufferPool *av_buffer_pool_init(buffer_size_t size, AVBufferRef* (*alloc)(buffer_size_t size))266AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size))
267{267{
268 AVBufferPool *pool = av_mallocz(sizeof(*pool));268 AVBufferPool *pool = av_mallocz(sizeof(*pool));
269 if (!pool)269 if (!pool)
libavutil/buffer.h+0−29
@@ -93,11 +93,7 @@ typedef struct AVBufferRef { · 92 unmodified lines
93 /**93 /**
94 * Size of data in bytes.94 * Size of data in bytes.
95 */95 */
96#if FF_API_BUFFER_SIZE_T
97 int size;
98#else
99 size_t size;96 size_t size;
100#endif
101} AVBufferRef;97} AVBufferRef;
102 98
103/**99/**
@@ -105,21 +101,13 @@ typedef struct AVBufferRef { · 1 unmodified line
105 *101 *
106 * @return an AVBufferRef of given size or NULL when out of memory102 * @return an AVBufferRef of given size or NULL when out of memory
107 */103 */
108#if FF_API_BUFFER_SIZE_T
109AVBufferRef *av_buffer_alloc(int size);
110#else
111AVBufferRef *av_buffer_alloc(size_t size);104AVBufferRef *av_buffer_alloc(size_t size);
112#endif
113 105
114/**106/**
115 * Same as av_buffer_alloc(), except the returned buffer will be initialized107 * Same as av_buffer_alloc(), except the returned buffer will be initialized
116 * to zero.108 * to zero.
117 */109 */
118#if FF_API_BUFFER_SIZE_T
119AVBufferRef *av_buffer_allocz(int size);
120#else
121AVBufferRef *av_buffer_allocz(size_t size);110AVBufferRef *av_buffer_allocz(size_t size);
122#endif
123 111
124/**112/**
125 * Always treat the buffer as read-only, even when it has only one113 * 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
142 *130 *
143 * @return an AVBufferRef referring to data on success, NULL on failure.131 * @return an AVBufferRef referring to data on success, NULL on failure.
144 */132 */
145#if FF_API_BUFFER_SIZE_T
146AVBufferRef *av_buffer_create(uint8_t *data, int size,
147#else
148AVBufferRef *av_buffer_create(uint8_t *data, size_t size,133AVBufferRef *av_buffer_create(uint8_t *data, size_t size,
149#endif
150 void (*free)(void *opaque, uint8_t *data),134 void (*free)(void *opaque, uint8_t *data),
151 void *opaque, int flags);135 void *opaque, int flags);
152 136
@@ -214,11 +198,7 @@ int av_buffer_make_writable(AVBufferRef **buf); · 61 unmodified lines
214 * reference to it (i.e. the one passed to this function). In all other cases198 * reference to it (i.e. the one passed to this function). In all other cases
215 * a new buffer is allocated and the data is copied.199 * a new buffer is allocated and the data is copied.
216 */200 */
217#if FF_API_BUFFER_SIZE_T
218int av_buffer_realloc(AVBufferRef **buf, int size);
219#else
220int av_buffer_realloc(AVBufferRef **buf, size_t size);201int av_buffer_realloc(AVBufferRef **buf, size_t size);
221#endif
222 202
223/**203/**
224 * Ensure dst refers to the same data as src.204 * Ensure dst refers to the same data as src.
@@ -285,11 +265,7 @@ typedef struct AVBufferPool AVBufferPool; · 60 unmodified lines
285 * (av_buffer_alloc()).265 * (av_buffer_alloc()).
286 * @return newly created buffer pool on success, NULL on error.266 * @return newly created buffer pool on success, NULL on error.
287 */267 */
288#if FF_API_BUFFER_SIZE_T
289AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size));
290#else
291AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size));268AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size));
292#endif
293 269
294/**270/**
295 * Allocate and initialize a buffer pool with a more complex allocator.271 * 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
306 * data. May be NULL.282 * data. May be NULL.
307 * @return newly created buffer pool on success, NULL on error.283 * @return newly created buffer pool on success, NULL on error.
308 */284 */
309#if FF_API_BUFFER_SIZE_T
310AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
311 AVBufferRef* (*alloc)(void *opaque, int size),
312#else
313AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque,285AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque,
314 AVBufferRef* (*alloc)(void *opaque, size_t size),286 AVBufferRef* (*alloc)(void *opaque, size_t size),
315#endif
316 void (*pool_free)(void *opaque));287 void (*pool_free)(void *opaque));
317 288
318/**289/**
libavutil/buffer_internal.h+4−4
@@ -33,7 +33,7 @@ · 32 unmodified lines
33 33
34struct AVBuffer {34struct AVBuffer {
35 uint8_t *data; /**< data described by this buffer */35 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 */
37 37
38 /**38 /**
39 * number of existing AVBufferRef instances referring to this buffer39 * number of existing AVBufferRef instances referring to this buffer
@@ -90,10 +90,10 @@ struct AVBufferPool { · 50 unmodified lines
90 */90 */
91 atomic_uint refcount;91 atomic_uint refcount;
92 92
93 buffer_size_t size;93 size_t size;
94 void *opaque;94 void *opaque;
95 AVBufferRef* (*alloc)(buffer_size_t size);95 AVBufferRef* (*alloc)(size_t size);
96 AVBufferRef* (*alloc2)(void *opaque, buffer_size_t size);96 AVBufferRef* (*alloc2)(void *opaque, size_t size);
97 void (*pool_free)(void *opaque);97 void (*pool_free)(void *opaque);
98};98};
99 99
libavutil/detection_bbox.c+0−4
@@ -54,10 +54,6 @@ AVDetectionBBoxHeader *av_detection_bbox_create_side_data(AVFrame *frame, uint32 · 53 unmodified lines
54 header = av_detection_bbox_alloc(nb_bboxes, &size);54 header = av_detection_bbox_alloc(nb_bboxes, &size);
55 if (!header)55 if (!header)
56 return NULL;56 return NULL;
57 if (size > INT_MAX) {
58 av_freep(&header);
59 return NULL;
60 }
61 buf = av_buffer_create((uint8_t *)header, size, NULL, NULL, 0);57 buf = av_buffer_create((uint8_t *)header, size, NULL, NULL, 0);
62 if (!buf) {58 if (!buf) {
63 av_freep(&header);59 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
603 603
604AVFrameSideData *av_frame_new_side_data(AVFrame *frame,604AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
605 enum AVFrameSideDataType type,605 enum AVFrameSideDataType type,
606 buffer_size_t size)606 size_t size)
607{607{
608 AVFrameSideData *ret;608 AVFrameSideData *ret;
609 AVBufferRef *buf = av_buffer_alloc(size);609 AVBufferRef *buf = av_buffer_alloc(size);
libavutil/frame.h+0−8
@@ -209,11 +209,7 @@ enum AVActiveFormatDescription { · 208 unmodified lines
209typedef struct AVFrameSideData {209typedef struct AVFrameSideData {
210 enum AVFrameSideDataType type;210 enum AVFrameSideDataType type;
211 uint8_t *data;211 uint8_t *data;
212#if FF_API_BUFFER_SIZE_T
213 int size;
214#else
215 size_t size;212 size_t size;
216#endif
217 AVDictionary *metadata;213 AVDictionary *metadata;
218 AVBufferRef *buf;214 AVBufferRef *buf;
219} AVFrameSideData;215} AVFrameSideData;
@@ -818,11 +814,7 @@ AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane); · 598 unmodified lines
818 */814 */
819AVFrameSideData *av_frame_new_side_data(AVFrame *frame,815AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
820 enum AVFrameSideDataType type,816 enum AVFrameSideDataType type,
821#if FF_API_BUFFER_SIZE_T
822 int size);
823#else
824 size_t size);817 size_t size);
825#endif
826 818
827/**819/**
828 * Add a new side data to a frame from an existing AVBufferRef820 * 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
93 CHECK_CU(cu->cuCtxPopCurrent(&dummy));93 CHECK_CU(cu->cuCtxPopCurrent(&dummy));
94}94}
95 95
96static AVBufferRef *cuda_pool_alloc(void *opaque, buffer_size_t size)96static AVBufferRef *cuda_pool_alloc(void *opaque, size_t size)
97{97{
98 AVHWFramesContext *ctx = opaque;98 AVHWFramesContext *ctx = opaque;
99 AVHWDeviceContext *device_ctx = ctx->device_ctx;99 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
202 return wrap_texture_buf(tex, 0);202 return wrap_texture_buf(tex, 0);
203}203}
204 204
205static AVBufferRef *d3d11va_pool_alloc(void *opaque, buffer_size_t size)205static AVBufferRef *d3d11va_pool_alloc(void *opaque, size_t size)
206{206{
207 AVHWFramesContext *ctx = (AVHWFramesContext*)opaque;207 AVHWFramesContext *ctx = (AVHWFramesContext*)opaque;
208 D3D11VAFramesContext *s = ctx->internal->priv;208 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
124 // released in dxva2_frames_uninit()124 // released in dxva2_frames_uninit()
125}125}
126 126
127static AVBufferRef *dxva2_pool_alloc(void *opaque, buffer_size_t size)127static AVBufferRef *dxva2_pool_alloc(void *opaque, size_t size)
128{128{
129 AVHWFramesContext *ctx = (AVHWFramesContext*)opaque;129 AVHWFramesContext *ctx = (AVHWFramesContext*)opaque;
130 DXVA2FramesContext *s = ctx->internal->priv;130 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
1617 av_free(desc);1617 av_free(desc);
1618}1618}
1619 1619
1620static AVBufferRef *opencl_pool_alloc(void *opaque, buffer_size_t size)1620static AVBufferRef *opencl_pool_alloc(void *opaque, size_t size)
1621{1621{
1622 AVHWFramesContext *hwfc = opaque;1622 AVHWFramesContext *hwfc = opaque;
1623 AVOpenCLDeviceContext *hwctx = hwfc->device_ctx->hwctx;1623 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
194{194{
195}195}
196 196
197static AVBufferRef *qsv_pool_alloc(void *opaque, buffer_size_t size)197static AVBufferRef *qsv_pool_alloc(void *opaque, size_t size)
198{198{
199 AVHWFramesContext *ctx = (AVHWFramesContext*)opaque;199 AVHWFramesContext *ctx = (AVHWFramesContext*)opaque;
200 QSVFramesContext *s = ctx->internal->priv;200 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
464 }464 }
465}465}
466 466
467static AVBufferRef *vaapi_pool_alloc(void *opaque, buffer_size_t size)467static AVBufferRef *vaapi_pool_alloc(void *opaque, size_t size)
468{468{
469 AVHWFramesContext *hwfc = opaque;469 AVHWFramesContext *hwfc = opaque;
470 VAAPIFramesContext *ctx = hwfc->internal->priv;470 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
225 device_priv->surf_destroy(surf);225 device_priv->surf_destroy(surf);
226}226}
227 227
228static AVBufferRef *vdpau_pool_alloc(void *opaque, buffer_size_t size)228static AVBufferRef *vdpau_pool_alloc(void *opaque, size_t size)
229{229{
230 AVHWFramesContext *ctx = opaque;230 AVHWFramesContext *ctx = opaque;
231 VDPAUFramesContext *priv = ctx->internal->priv;231 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
1693 }1693 }
1694}1694}
1695 1695
1696static AVBufferRef *vulkan_pool_alloc(void *opaque, buffer_size_t size)1696static AVBufferRef *vulkan_pool_alloc(void *opaque, size_t size)
1697{1697{
1698 int err;1698 int err;
1699 AVVkFrame *f;1699 AVVkFrame *f;
libavutil/internal.h+0−7
@@ -292,11 +292,4 @@ void ff_check_pixfmt_descriptors(void); · 291 unmodified lines
292 */292 */
293int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp);293int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp);
294 294
295// Temporary typedef to simplify porting all AVBufferRef users to size_t
296#if FF_API_BUFFER_SIZE_T
297typedef int buffer_size_t;
298#else
299typedef size_t buffer_size_t;
300#endif
301
302#endif /* AVUTIL_INTERNAL_H */295#endif /* AVUTIL_INTERNAL_H */
libavutil/version.h+0−3
@@ -108,9 +108,6 @@ · 107 unmodified lines
108#ifndef FF_API_CHILD_CLASS_NEXT108#ifndef FF_API_CHILD_CLASS_NEXT
109#define FF_API_CHILD_CLASS_NEXT (LIBAVUTIL_VERSION_MAJOR < 57)109#define FF_API_CHILD_CLASS_NEXT (LIBAVUTIL_VERSION_MAJOR < 57)
110#endif110#endif
111#ifndef FF_API_BUFFER_SIZE_T
112#define FF_API_BUFFER_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 57)
113#endif
114#ifndef FF_API_CPU_FLAGS111#ifndef FF_API_CPU_FLAGS
115#define FF_API_CPU_FLAGS (LIBAVUTIL_VERSION_MAJOR < 57)112#define FF_API_CPU_FLAGS (LIBAVUTIL_VERSION_MAJOR < 57)
116#endif113#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
63 par = av_video_enc_params_alloc(type, nb_blocks, &size);63 par = av_video_enc_params_alloc(type, nb_blocks, &size);
64 if (!par)64 if (!par)
65 return NULL;65 return NULL;
66 if (size > INT_MAX) {
67 av_free(par);
68 return NULL;
69 }
70 buf = av_buffer_create((uint8_t *)par, size, NULL, NULL, 0);66 buf = av_buffer_create((uint8_t *)par, size, NULL, NULL, 0);
71 if (!buf) {67 if (!buf) {
72 av_freep(&par);68 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