avutil/buffer: Switch AVBuffer API to size_t

Announced in 14040a1d91.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
pull/362/head
Andreas Rheinhardt 4 years ago committed by James Almer
parent 985c0dac67
commit ef6a9e5e31
  1. 2
      fftools/ffprobe.c
  2. 4
      libavcodec/aacdec_template.c
  3. 2
      libavcodec/adxdec.c
  4. 2
      libavcodec/audiotoolboxdec.c
  5. 28
      libavcodec/avpacket.c
  6. 2
      libavcodec/cbs_bsf.c
  7. 13
      libavcodec/decode.c
  8. 2
      libavcodec/h264_metadata_bsf.c
  9. 2
      libavcodec/h264dec.c
  10. 2
      libavcodec/hevcdec.c
  11. 2
      libavcodec/libvpxdec.c
  12. 4
      libavcodec/mpeg12enc.c
  13. 5
      libavcodec/mscc.c
  14. 4
      libavcodec/nvdec.c
  15. 24
      libavcodec/packet.h
  16. 2
      libavcodec/srtdec.c
  17. 2
      libavcodec/vaapi_encode.c
  18. 4
      libavdevice/decklink_dec.cpp
  19. 2
      libavdevice/decklink_enc.cpp
  20. 2
      libavdevice/lavfi.c
  21. 2
      libavdevice/xcbgrab.c
  22. 3
      libavfilter/af_ashowinfo.c
  23. 4
      libavfilter/framepool.c
  24. 4
      libavfilter/framepool.h
  25. 10
      libavfilter/vf_showinfo.c
  26. 2
      libavformat/adtsenc.c
  27. 2
      libavformat/apngenc.c
  28. 8
      libavformat/avformat.h
  29. 2
      libavformat/concatdec.c
  30. 4
      libavformat/dashenc.c
  31. 4
      libavformat/dump.c
  32. 2
      libavformat/flacenc.c
  33. 2
      libavformat/flvenc.c
  34. 6
      libavformat/framecrcenc.c
  35. 7
      libavformat/hashenc.c
  36. 2
      libavformat/img2dec.c
  37. 2
      libavformat/latmenc.c
  38. 6
      libavformat/matroskaenc.c
  39. 3
      libavformat/mov.c
  40. 10
      libavformat/movenc.c
  41. 4
      libavformat/mp3enc.c
  42. 4
      libavformat/mpegtsenc.c
  43. 2
      libavformat/oggdec.h
  44. 2
      libavformat/rtpenc.c
  45. 2
      libavformat/segment.c
  46. 2
      libavformat/srtenc.c
  47. 6
      libavformat/utils.c
  48. 2
      libavformat/webvttdec.c
  49. 2
      libavformat/webvttenc.c
  50. 14
      libavutil/buffer.c
  51. 29
      libavutil/buffer.h
  52. 8
      libavutil/buffer_internal.h
  53. 4
      libavutil/detection_bbox.c
  54. 2
      libavutil/frame.c
  55. 8
      libavutil/frame.h
  56. 2
      libavutil/hwcontext_cuda.c
  57. 2
      libavutil/hwcontext_d3d11va.c
  58. 2
      libavutil/hwcontext_dxva2.c
  59. 2
      libavutil/hwcontext_opencl.c
  60. 2
      libavutil/hwcontext_qsv.c
  61. 2
      libavutil/hwcontext_vaapi.c
  62. 2
      libavutil/hwcontext_vdpau.c
  63. 2
      libavutil/hwcontext_vulkan.c
  64. 7
      libavutil/internal.h
  65. 3
      libavutil/version.h
  66. 4
      libavutil/video_enc_params.c

@ -2158,7 +2158,7 @@ static void show_packet(WriterContext *w, InputFile *ifile, AVPacket *pkt, int p
pkt->flags & AV_PKT_FLAG_DISCARD ? 'D' : '_');
if (pkt->side_data_elems) {
int size;
size_t size;
const uint8_t *side_metadata;
side_metadata = av_packet_get_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA, &size);

@ -3437,11 +3437,11 @@ static int aac_decode_frame(AVCodecContext *avctx, void *data,
int buf_consumed;
int buf_offset;
int err;
buffer_size_t new_extradata_size;
size_t new_extradata_size;
const uint8_t *new_extradata = av_packet_get_side_data(avpkt,
AV_PKT_DATA_NEW_EXTRADATA,
&new_extradata_size);
buffer_size_t jp_dualmono_size;
size_t jp_dualmono_size;
const uint8_t *jp_dualmono = av_packet_get_side_data(avpkt,
AV_PKT_DATA_JP_DUALMONO,
&jp_dualmono_size);

@ -103,7 +103,7 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data,
const uint8_t *buf = avpkt->data;
const uint8_t *buf_end = buf + avpkt->size;
int num_blocks, ch, ret;
buffer_size_t new_extradata_size;
size_t new_extradata_size;
uint8_t *new_extradata;
new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,

@ -484,7 +484,7 @@ static int ffat_decode(AVCodecContext *avctx, void *data,
if (avctx->codec_id == AV_CODEC_ID_AAC) {
if (!at->extradata_size) {
uint8_t *side_data;
buffer_size_t side_data_size;
size_t side_data_size;
side_data = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,
&side_data_size);

@ -218,16 +218,12 @@ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
buffer_size_t size)
size_t size)
{
int ret;
uint8_t *data;
#if FF_API_BUFFER_SIZE_T
if ((unsigned)size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
#else
if (size > SIZE_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
#endif
return NULL;
data = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!data)
@ -243,7 +239,7 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
}
uint8_t *av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
buffer_size_t *size)
size_t *size)
{
int i;
@ -297,11 +293,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type)
return NULL;
}
#if FF_API_BUFFER_SIZE_T
uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size)
#else
uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size)
#endif
{
uint8_t *data = NULL;
*size = 0;
@ -320,11 +312,7 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size)
if (pass)
memcpy(data + total_length, str, len);
#if FF_API_BUFFER_SIZE_T
else if (len > INT_MAX - total_length)
#else
else if (len > SIZE_MAX - total_length)
#endif
return NULL;
total_length += len;
}
@ -340,12 +328,8 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size)
return data;
}
#if FF_API_BUFFER_SIZE_T
int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict)
#else
int av_packet_unpack_dictionary(const uint8_t *data, size_t size,
AVDictionary **dict)
#endif
{
const uint8_t *end;
int ret;
@ -372,7 +356,7 @@ int av_packet_unpack_dictionary(const uint8_t *data, size_t size,
}
int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
buffer_size_t size)
size_t size)
{
int i;
@ -402,7 +386,7 @@ int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
dst->side_data_elems = 0;
for (i = 0; i < src->side_data_elems; i++) {
enum AVPacketSideDataType type = src->side_data[i].type;
buffer_size_t size = src->side_data[i].size;
size_t size = src->side_data[i].size;
uint8_t *src_data = src->side_data[i].data;
uint8_t *dst_data = av_packet_new_side_data(dst, type, size);
@ -599,7 +583,7 @@ void avpriv_packet_list_free(PacketList **pkt_buf, PacketList **pkt_buf_end)
int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type)
{
uint8_t *side_data;
buffer_size_t side_data_size;
size_t side_data_size;
int i;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_QUALITY_STATS, &side_data_size);
@ -625,7 +609,7 @@ int ff_side_data_set_prft(AVPacket *pkt, int64_t timestamp)
{
AVProducerReferenceTime *prft;
uint8_t *side_data;
buffer_size_t side_data_size;
size_t side_data_size;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PRFT, &side_data_size);
if (!side_data) {

@ -24,7 +24,7 @@ static int cbs_bsf_update_side_data(AVBSFContext *bsf, AVPacket *pkt)
CBSBSFContext *ctx = bsf->priv_data;
CodedBitstreamFragment *frag = &ctx->fragment;
uint8_t *side_data;
buffer_size_t side_data_size;
size_t side_data_size;
int err;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,

@ -67,7 +67,7 @@ typedef struct FramePool {
static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt)
{
int ret;
buffer_size_t size;
size_t size;
const uint8_t *data;
uint32_t flags;
int64_t val;
@ -344,7 +344,7 @@ static inline int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame,
got_frame = 0;
} else if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {
uint8_t *side;
buffer_size_t side_size;
size_t side_size;
uint32_t discard_padding = 0;
uint8_t skip_reason = 0;
uint8_t discard_reason = 0;
@ -1463,7 +1463,7 @@ int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags
static int add_metadata_from_side_data(const AVPacket *avpkt, AVFrame *frame)
{
buffer_size_t size;
size_t size;
const uint8_t *side_metadata;
AVDictionary **frame_md = &frame->metadata;
@ -1502,7 +1502,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
frame->pkt_size = pkt->size;
for (int i = 0; i < FF_ARRAY_ELEMS(sd); i++) {
buffer_size_t size;
size_t size;
uint8_t *packet_sd = av_packet_get_side_data(pkt, sd[i].packet, &size);
if (packet_sd) {
AVFrameSideData *frame_sd = av_frame_new_side_data(frame,
@ -1841,14 +1841,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
int ff_copy_palette(void *dst, const AVPacket *src, void *logctx)
{
buffer_size_t size;
size_t size;
const void *pal = av_packet_get_side_data(src, AV_PKT_DATA_PALETTE, &size);
if (pal && size == AVPALETTE_SIZE) {
memcpy(dst, pal, AVPALETTE_SIZE);
return 1;
} else if (pal) {
av_log(logctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
av_log(logctx, AV_LOG_ERROR,
"Palette size %"SIZE_SPECIFIER" is wrong\n", size);
}
return 0;
}

@ -371,7 +371,7 @@ static int h264_metadata_handle_display_orientation(AVBSFContext *bsf,
H264RawSEIDisplayOrientation *disp =
&ctx->display_orientation_payload;
uint8_t *data;
buffer_size_t size;
size_t size;
int write = 0;
data = av_packet_get_side_data(pkt, AV_PKT_DATA_DISPLAYMATRIX, &size);

@ -975,7 +975,7 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data,
return send_next_delayed_frame(h, pict, got_frame, 0);
if (av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, NULL)) {
buffer_size_t side_size;
size_t side_size;
uint8_t *side = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);
ff_h264_decode_extradata(side, side_size,
&h->ps, &h->is_avc, &h->nal_length_size,

@ -3303,7 +3303,7 @@ static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output,
AVPacket *avpkt)
{
int ret;
buffer_size_t new_extradata_size;
size_t new_extradata_size;
uint8_t *new_extradata;
HEVCContext *s = avctx->priv_data;

@ -221,7 +221,7 @@ static int vpx_decode(AVCodecContext *avctx,
struct vpx_image *img, *img_alpha;
int ret;
uint8_t *side_data = NULL;
buffer_size_t side_data_size;
size_t side_data_size;
ret = decode_frame(avctx, &ctx->decoder, avpkt->data, avpkt->size);
if (ret)

@ -575,8 +575,8 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
put_bits(&s->pb, 8, 0xff); // marker_bits
} else {
av_log(s->avctx, AV_LOG_WARNING,
"Warning Closed Caption size (%d) can not exceed 93 bytes "
"and must be a multiple of 3\n", side_data->size);
"Closed Caption size (%"SIZE_SPECIFIER") can not exceed "
"93 bytes and must be a multiple of 3\n", side_data->size);
}
}
}

@ -152,7 +152,7 @@ static int decode_frame(AVCodecContext *avctx,
}
if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
buffer_size_t size;
size_t size;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
if (pal && size == AVPALETTE_SIZE) {
@ -160,7 +160,8 @@ static int decode_frame(AVCodecContext *avctx,
for (j = 0; j < 256; j++)
s->pal[j] = 0xFF000000 | AV_RL32(pal + j * 4);
} else if (pal) {
av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
av_log(avctx, AV_LOG_ERROR,
"Palette size %"SIZE_SPECIFIER" is wrong\n", size);
}
memcpy(frame->data[1], s->pal, AVPALETTE_SIZE);
}

@ -242,7 +242,7 @@ fail:
return ret;
}
static AVBufferRef *nvdec_decoder_frame_alloc(void *opaque, buffer_size_t size)
static AVBufferRef *nvdec_decoder_frame_alloc(void *opaque, size_t size)
{
NVDECFramePool *pool = opaque;
AVBufferRef *ret;
@ -283,7 +283,7 @@ static void nvdec_free_dummy(struct AVHWFramesContext *ctx)
av_buffer_pool_uninit(&ctx->pool);
}
static AVBufferRef *nvdec_alloc_dummy(buffer_size_t size)
static AVBufferRef *nvdec_alloc_dummy(size_t size)
{
return av_buffer_create(NULL, 0, NULL, NULL, 0);
}

@ -305,11 +305,7 @@ enum AVPacketSideDataType {
typedef struct AVPacketSideData {
uint8_t *data;
#if FF_API_BUFFER_SIZE_T
int size;
#else
size_t size;
#endif
enum AVPacketSideDataType type;
} AVPacketSideData;
@ -528,11 +524,7 @@ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size);
* @return pointer to fresh allocated data or NULL otherwise
*/
uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
#if FF_API_BUFFER_SIZE_T
int size);
#else
size_t size);
#endif
/**
* Wrap an existing array as a packet side data.
@ -559,11 +551,7 @@ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
* @return 0 on success, < 0 on failure
*/
int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
#if FF_API_BUFFER_SIZE_T
int size);
#else
size_t size);
#endif
/**
* Get side information from packet.
@ -575,11 +563,7 @@ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
* @return pointer to data if present or NULL otherwise
*/
uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
#if FF_API_BUFFER_SIZE_T
int *size);
#else
size_t *size);
#endif
const char *av_packet_side_data_name(enum AVPacketSideDataType type);
@ -590,11 +574,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type);
* @param size pointer to store the size of the returned data
* @return pointer to data if successful, NULL otherwise
*/
#if FF_API_BUFFER_SIZE_T
uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size);
#else
uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size);
#endif
/**
* Unpack a dictionary from side_data.
*
@ -603,12 +583,8 @@ uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size);
* @param dict the metadata storage dictionary
* @return 0 on success, < 0 on failure
*/
#if FF_API_BUFFER_SIZE_T
int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict);
#else
int av_packet_unpack_dictionary(const uint8_t *data, size_t size,
AVDictionary **dict);
#endif
/**
* Convenience function to free all the side data stored.

@ -59,7 +59,7 @@ static int srt_decode_frame(AVCodecContext *avctx,
AVBPrint buffer;
int x1 = -1, y1 = -1, x2 = -1, y2 = -1;
int ret;
buffer_size_t size;
size_t size;
const uint8_t *p = av_packet_get_side_data(avpkt, AV_PKT_DATA_SUBTITLE_POSITION, &size);
FFASSDecoderContext *s = avctx->priv_data;

@ -2235,7 +2235,7 @@ static void vaapi_encode_free_output_buffer(void *opaque,
}
static AVBufferRef *vaapi_encode_alloc_output_buffer(void *opaque,
buffer_size_t size)
size_t size)
{
AVCodecContext *avctx = opaque;
VAAPIEncodeContext *ctx = avctx->priv_data;

@ -936,7 +936,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
}
if (av_dict_set(&metadata_dict, "timecode", tc, 0) >= 0) {
buffer_size_t metadata_len;
size_t metadata_len;
packed_metadata = av_packet_pack_dictionary(metadata_dict, &metadata_len);
av_dict_free(&metadata_dict);
if (packed_metadata) {
@ -1435,7 +1435,7 @@ int ff_decklink_read_packet(AVFormatContext *avctx, AVPacket *pkt)
avpacket_queue_get(&ctx->queue, pkt, 1);
if (ctx->tc_format && !(av_dict_get(ctx->video_st->metadata, "timecode", NULL, 0))) {
buffer_size_t size;
size_t size;
const uint8_t *side_metadata = av_packet_get_side_data(pkt, AV_PKT_DATA_STRINGS_METADATA, &size);
if (side_metadata) {
if (av_packet_unpack_dictionary(side_metadata, size, &ctx->video_st->metadata) < 0)

@ -313,7 +313,7 @@ static void construct_cc(AVFormatContext *avctx, struct decklink_ctx *ctx,
uint16_t *cdp_words;
uint16_t len;
uint8_t cc_count;
buffer_size_t size;
size_t size;
int ret, i;
const uint8_t *data = av_packet_get_side_data(pkt, AV_PKT_DATA_A53_CC, &size);

@ -446,7 +446,7 @@ static int lavfi_read_packet(AVFormatContext *avctx, AVPacket *pkt)
frame_metadata = frame->metadata;
if (frame_metadata) {
buffer_size_t size;
size_t size;
uint8_t *metadata = av_packet_pack_dictionary(frame_metadata, &size);
if (!metadata) {

@ -236,7 +236,7 @@ static void free_shm_buffer(void *opaque, uint8_t *data)
shmdt(data);
}
static AVBufferRef *allocate_shm_buffer(void *opaque, buffer_size_t size)
static AVBufferRef *allocate_shm_buffer(void *opaque, size_t size)
{
xcb_connection_t *conn = opaque;
xcb_shm_seg_t segment;

@ -170,7 +170,8 @@ static void dump_audio_service_type(AVFilterContext *ctx, AVFrameSideData *sd)
static void dump_unknown(AVFilterContext *ctx, AVFrameSideData *sd)
{
av_log(ctx, AV_LOG_INFO, "unknown side data type: %d, size %d bytes", sd->type, sd->size);
av_log(ctx, AV_LOG_INFO, "unknown side data type: %d, size "
"%"SIZE_SPECIFIER" bytes", sd->type, sd->size);
}
static int filter_frame(AVFilterLink *inlink, AVFrame *buf)

@ -48,7 +48,7 @@ struct FFFramePool {
};
FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(buffer_size_t size),
FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t size),
int width,
int height,
enum AVPixelFormat format,
@ -115,7 +115,7 @@ fail:
return NULL;
}
FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(buffer_size_t size),
FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(size_t size),
int channels,
int nb_samples,
enum AVSampleFormat format,

@ -44,7 +44,7 @@ typedef struct FFFramePool FFFramePool;
* @param align buffers alignement of each frame in this pool
* @return newly created video frame pool on success, NULL on error.
*/
FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(buffer_size_t size),
FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t size),
int width,
int height,
enum AVPixelFormat format,
@ -62,7 +62,7 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(buffer_size_t size),
* @param align buffers alignement of each frame in this pool
* @return newly created audio frame pool on success, NULL on error.
*/
FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(buffer_size_t size),
FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(size_t size),
int channels,
int samples,
enum AVSampleFormat format,

@ -340,7 +340,8 @@ static void dump_sei_unregistered_metadata(AVFilterContext *ctx, const AVFrameSi
int i;
if (sd->size < uuid_size) {
av_log(ctx, AV_LOG_ERROR, "invalid data(%d < UUID(%d-bytes))\n", sd->size, uuid_size);
av_log(ctx, AV_LOG_ERROR, "invalid data(%"SIZE_SPECIFIER" < "
"UUID(%d-bytes))\n", sd->size, uuid_size);
return;
}
@ -498,7 +499,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
av_log(ctx, AV_LOG_INFO, "pan/scan");
break;
case AV_FRAME_DATA_A53_CC:
av_log(ctx, AV_LOG_INFO, "A/53 closed captions (%d bytes)", sd->size);
av_log(ctx, AV_LOG_INFO, "A/53 closed captions "
"(%"SIZE_SPECIFIER" bytes)", sd->size);
break;
case AV_FRAME_DATA_SPHERICAL:
dump_spherical(ctx, frame, sd);
@ -545,8 +547,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
dump_sei_unregistered_metadata(ctx, sd);
break;
default:
av_log(ctx, AV_LOG_WARNING, "unknown side data type %d (%d bytes)\n",
sd->type, sd->size);
av_log(ctx, AV_LOG_WARNING, "unknown side data type %d "
"(%"SIZE_SPECIFIER" bytes)\n", sd->type, sd->size);
break;
}

@ -170,7 +170,7 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
if (!par->extradata_size) {
uint8_t *side_data;
buffer_size_t side_data_size;
size_t side_data_size;
int ret;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,

@ -119,7 +119,7 @@ static int flush_packet(AVFormatContext *format_context, AVPacket *packet)
AVIOContext *io_context = format_context->pb;
AVStream *codec_stream = format_context->streams[0];
uint8_t *side_data = NULL;
buffer_size_t side_data_size;
size_t side_data_size;
av_assert0(apng->prev_packet);

@ -1873,11 +1873,7 @@ int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type,
* @return pointer to fresh allocated data or NULL otherwise
*/
uint8_t *av_stream_new_side_data(AVStream *stream,
#if FF_API_BUFFER_SIZE_T
enum AVPacketSideDataType type, int size);
#else
enum AVPacketSideDataType type, size_t size);
#endif
/**
* Get side information from stream.
*
@ -1888,11 +1884,7 @@ uint8_t *av_stream_new_side_data(AVStream *stream,
* @return pointer to data if present or NULL otherwise
*/
uint8_t *av_stream_get_side_data(const AVStream *stream,
#if FF_API_BUFFER_SIZE_T
enum AVPacketSideDataType type, int *size);
#else
enum AVPacketSideDataType type, size_t *size);
#endif
AVProgram *av_new_program(AVFormatContext *s, int id);

@ -626,7 +626,7 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt)
av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base),
av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base));
if (cat->cur_file->metadata) {
buffer_size_t metadata_len;
size_t metadata_len;
char* packed_metadata = av_packet_pack_dictionary(cat->cur_file->metadata, &metadata_len);
if (!packed_metadata)
return AVERROR(ENOMEM);

@ -1806,7 +1806,7 @@ static int update_stream_extradata(AVFormatContext *s, OutputStream *os,
{
AVCodecParameters *par = os->ctx->streams[0]->codecpar;
uint8_t *extradata;
buffer_size_t extradata_size;
size_t extradata_size;
int ret;
if (par->extradata_size)
@ -2022,7 +2022,7 @@ static int dash_parse_prft(DASHContext *c, AVPacket *pkt)
{
OutputStream *os = &c->streams[pkt->stream_index];
AVProducerReferenceTime *prft;
buffer_size_t side_data_size;
size_t side_data_size;
prft = (AVProducerReferenceTime *)av_packet_get_side_data(pkt, AV_PKT_DATA_PRFT, &side_data_size);
if (!prft || side_data_size != sizeof(AVProducerReferenceTime) || (prft->flags && prft->flags != 24)) {

@ -491,8 +491,8 @@ static void dump_sidedata(void *ctx, const AVStream *st, const char *indent)
dump_s12m_timecode(ctx, st, sd);
break;
default:
av_log(ctx, AV_LOG_INFO,
"unknown side data type %d (%d bytes)", sd->type, sd->size);
av_log(ctx, AV_LOG_INFO, "unknown side data type %d "
"(%"SIZE_SPECIFIER" bytes)", sd->type, sd->size);
break;
}

@ -280,7 +280,7 @@ static int flac_write_audio_packet(struct AVFormatContext *s, AVPacket *pkt)
{
FlacMuxerContext *c = s->priv_data;
uint8_t *streaminfo;
buffer_size_t streaminfo_size;
size_t streaminfo_size;
/* check for updated streaminfo */
streaminfo = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,

@ -902,7 +902,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264
|| par->codec_id == AV_CODEC_ID_MPEG4) {
buffer_size_t side_size;
size_t side_size;
uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);
if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) {
ret = ff_alloc_extradata(par, side_size);

@ -88,7 +88,7 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
case AV_PKT_DATA_SPHERICAL:
case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:
case AV_PKT_DATA_S12M_TIMECODE:
for (int j = 0; j < sd->size / 4; j++) {
for (size_t j = 0; j < sd->size / 4; j++) {
uint8_t buf[4];
AV_WL32(buf, AV_RB32(sd->data + 4 * j));
side_data_crc = av_adler32_update(side_data_crc, buf, 4);
@ -119,7 +119,9 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
default:
side_data_crc = av_adler32_update(0, data, sd->size);
}
av_strlcatf(buf, sizeof(buf), ", %8d, 0x%08"PRIx32, pkt->side_data[i].size, side_data_crc);
av_strlcatf(buf, sizeof(buf), ", %8"SIZE_SPECIFIER", 0x%08"PRIx32,
pkt->side_data[i].size, side_data_crc);
}
}
av_strlcatf(buf, sizeof(buf), "\n");

@ -298,18 +298,19 @@ static int framehash_write_packet(struct AVFormatContext *s, AVPacket *pkt)
avio_write(s->pb, buf, strlen(buf));
if (c->format_version > 1 && pkt->side_data_elems) {
int i, j;
int i;
avio_printf(s->pb, ", S=%d", pkt->side_data_elems);
for (i = 0; i < pkt->side_data_elems; i++) {
av_hash_init(c->hashes[0]);
if (HAVE_BIGENDIAN && pkt->side_data[i].type == AV_PKT_DATA_PALETTE) {
for (j = 0; j < pkt->side_data[i].size; j += sizeof(uint32_t)) {
for (size_t j = 0; j < pkt->side_data[i].size; j += sizeof(uint32_t)) {
uint32_t data = AV_RL32(pkt->side_data[i].data + j);
av_hash_update(c->hashes[0], (uint8_t *)&data, sizeof(uint32_t));
}
} else
av_hash_update(c->hashes[0], pkt->side_data[i].data, pkt->side_data[i].size);
snprintf(buf, sizeof(buf) - (AV_HASH_MAX_SIZE * 2 + 1), ", %8d, ", pkt->side_data[i].size);
snprintf(buf, sizeof(buf) - (AV_HASH_MAX_SIZE * 2 + 1),
", %8"SIZE_SPECIFIER", ", pkt->side_data[i].size);
len = strlen(buf);
av_hash_final_hex(c->hashes[0], buf + len, sizeof(buf) - len);
avio_write(s->pb, buf, strlen(buf));

@ -383,7 +383,7 @@ int ff_img_read_header(AVFormatContext *s1)
static int add_filename_as_pkt_side_data(char *filename, AVPacket *pkt) {
AVDictionary *d = NULL;
char *packed_metadata = NULL;
buffer_size_t metadata_len;
size_t metadata_len;
int ret;
av_dict_set(&d, "lavf.image2dec.source_path", filename, 0);

@ -176,7 +176,7 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt)
return ff_raw_write_packet(s, pkt);
else {
uint8_t *side_data;
buffer_size_t side_data_size;
size_t side_data_size;
int ret;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,

@ -2030,7 +2030,7 @@ static int mkv_write_block(AVFormatContext *s, AVIOContext *pb,
AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar;
mkv_track *track = &mkv->tracks[pkt->stream_index];
uint8_t *data = NULL, *side_data = NULL;
buffer_size_t side_data_size;
size_t side_data_size;
int err = 0, offset = 0, size = pkt->size;
int64_t ts = track->write_dts ? pkt->dts : pkt->pts;
uint64_t additional_id;
@ -2141,7 +2141,7 @@ static int mkv_write_vtt_blocks(AVFormatContext *s, AVIOContext *pb, const AVPac
MatroskaMuxContext *mkv = s->priv_data;
mkv_track *track = &mkv->tracks[pkt->stream_index];
ebml_master blockgroup;
buffer_size_t id_size, settings_size;
size_t id_size, settings_size;
int size, id_size_int, settings_size_int;
const char *id, *settings;
int64_t ts = track->write_dts ? pkt->dts : pkt->pts;
@ -2214,7 +2214,7 @@ static int mkv_check_new_extra_data(AVFormatContext *s, const AVPacket *pkt)
mkv_track *track = &mkv->tracks[pkt->stream_index];
AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar;
uint8_t *side_data;
buffer_size_t side_data_size;
size_t side_data_size;
int ret;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,

@ -6364,8 +6364,7 @@ static int mov_read_pssh(MOVContext *c, AVIOContext *pb, MOVAtom atom)
uint8_t **key_ids;
AVStream *st;
uint8_t *side_data, *extra_data, *old_side_data;
size_t side_data_size;
buffer_size_t old_side_data_size;
size_t side_data_size, old_side_data_size;
int ret = 0;
unsigned int version, kid_count, extra_data_size, alloc_size = 0;

@ -1992,7 +1992,7 @@ static int mov_write_colr_tag(AVIOContext *pb, MOVTrack *track, int prefer_icc)
// Ref (MP4): ISO/IEC 14496-12:2012
const uint8_t *icc_profile;
buffer_size_t icc_profile_size;
size_t icc_profile_size;
if (prefer_icc) {
icc_profile = av_stream_get_side_data(track->st, AV_PKT_DATA_ICC_PROFILE, &icc_profile_size);
@ -3046,7 +3046,7 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov,
int group = 0;
uint32_t *display_matrix = NULL;
buffer_size_t display_matrix_size;
size_t display_matrix_size;
int i;
if (st) {
@ -4173,7 +4173,7 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov,
track->tref_tag = MKTAG('h','i','n','t');
track->tref_id = mov->tracks[track->src_track].track_id;
} else if (track->par->codec_type == AVMEDIA_TYPE_AUDIO) {
buffer_size_t size;
size_t size;
int *fallback;
fallback = (int*)av_stream_get_side_data(track->st,
AV_PKT_DATA_FALLBACK_TRACK,
@ -5557,7 +5557,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
AVProducerReferenceTime *prft;
unsigned int samples_in_chunk = 0;
int size = pkt->size, ret = 0, offset = 0;
buffer_size_t prft_size;
size_t prft_size;
uint8_t *reformatted_data = NULL;
ret = check_pkt(s, pkt);
@ -5910,7 +5910,7 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt)
trk->par->codec_id == AV_CODEC_ID_AAC ||
trk->par->codec_id == AV_CODEC_ID_AV1 ||
trk->par->codec_id == AV_CODEC_ID_FLAC) {
buffer_size_t side_size;
size_t side_size;
uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size);
if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) {
void *newextra = av_mallocz(side_size + AV_INPUT_BUFFER_PADDING_SIZE);

@ -355,7 +355,7 @@ static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt)
if (mp3->xing_offset) {
uint8_t *side_data = NULL;
buffer_size_t side_data_size;
size_t side_data_size;
mp3_xing_add_frame(mp3, pkt);
mp3->audio_size += pkt->size;
@ -402,7 +402,7 @@ static void mp3_update_xing(AVFormatContext *s)
AVReplayGain *rg;
uint16_t tag_crc;
uint8_t *toc;
buffer_size_t rg_size;
size_t rg_size;
int i;
int64_t old_pos = avio_tell(s->pb);

@ -1681,7 +1681,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
const int64_t max_audio_delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE) / 2;
int64_t dts = pkt->dts, pts = pkt->pts;
int opus_samples = 0;
buffer_size_t side_data_size;
size_t side_data_size;
uint8_t *side_data = NULL;
int stream_id = -1;
@ -1818,7 +1818,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
/* Add Opus control header */
if ((AV_RB16(pkt->data) >> 5) != 0x3ff) {
uint8_t *side_data;
buffer_size_t side_data_size;
size_t side_data_size;
int i, n;
int ctrl_header_size;
int trim_start = 0, trim_end = 0;

@ -87,7 +87,7 @@ struct ogg_stream {
int start_trimming; ///< set the number of packets to drop from the start
int end_trimming; ///< set the number of packets to drop from the end
uint8_t *new_metadata;
buffer_size_t new_metadata_size;
size_t new_metadata_size;
void *private;
};

@ -589,7 +589,7 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
break;
case AV_CODEC_ID_H263:
if (s->flags & FF_RTP_FLAG_RFC2190) {
buffer_size_t mb_info_size;
size_t mb_info_size;
const uint8_t *mb_info =
av_packet_get_side_data(pkt, AV_PKT_DATA_H263_MB_INFO,
&mb_info_size);

@ -856,7 +856,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR(EINVAL);
if (!st->codecpar->extradata_size) {
buffer_size_t pkt_extradata_size;
size_t pkt_extradata_size;
uint8_t *pkt_extradata = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &pkt_extradata_size);
if (pkt_extradata && pkt_extradata_size > 0) {
ret = ff_alloc_extradata(st->codecpar, pkt_extradata_size);

@ -61,7 +61,7 @@ static int srt_write_packet(AVFormatContext *avf, AVPacket *pkt)
SRTContext *srt = avf->priv_data;
int64_t s = pkt->pts, e, d = pkt->duration;
buffer_size_t size;
size_t size;
int x1 = -1, y1 = -1, x2 = -1, y2 = -1;
const uint8_t *p;

@ -5462,7 +5462,7 @@ int ff_generate_avci_extradata(AVStream *st)
}
uint8_t *av_stream_get_side_data(const AVStream *st,
enum AVPacketSideDataType type, buffer_size_t *size)
enum AVPacketSideDataType type, size_t *size)
{
int i;
@ -5515,7 +5515,7 @@ int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type,
}
uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type,
buffer_size_t size)
size_t size)
{
int ret;
uint8_t *data = av_malloc(size);
@ -5631,7 +5631,7 @@ int ff_standardize_creation_time(AVFormatContext *s)
int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, uint32_t *palette)
{
uint8_t *side_data;
buffer_size_t size;
size_t size;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PALETTE, &size);
if (side_data) {

@ -78,7 +78,7 @@ static int webvtt_read_header(AVFormatContext *s)
int64_t pos;
AVPacket *sub;
const char *p, *identifier, *settings;
int identifier_len, settings_len;
size_t identifier_len, settings_len;
int64_t ts_start, ts_end;
ff_subtitles_read_chunk(s->pb, &cue);

@ -64,7 +64,7 @@ static int webvtt_write_header(AVFormatContext *ctx)
static int webvtt_write_packet(AVFormatContext *ctx, AVPacket *pkt)
{
AVIOContext *pb = ctx->pb;
buffer_size_t id_size, settings_size;
size_t id_size, settings_size;
int id_size_int, settings_size_int;
uint8_t *id, *settings;

@ -26,7 +26,7 @@
#include "mem.h"
#include "thread.h"
AVBufferRef *av_buffer_create(uint8_t *data, buffer_size_t size,
AVBufferRef *av_buffer_create(uint8_t *data, size_t size,
void (*free)(void *opaque, uint8_t *data),
void *opaque, int flags)
{
@ -64,7 +64,7 @@ void av_buffer_default_free(void *opaque, uint8_t *data)
av_free(data);
}
AVBufferRef *av_buffer_alloc(buffer_size_t size)
AVBufferRef *av_buffer_alloc(size_t size)
{
AVBufferRef *ret = NULL;
uint8_t *data = NULL;
@ -80,7 +80,7 @@ AVBufferRef *av_buffer_alloc(buffer_size_t size)
return ret;
}
AVBufferRef *av_buffer_allocz(buffer_size_t size)
AVBufferRef *av_buffer_allocz(size_t size)
{
AVBufferRef *ret = av_buffer_alloc(size);
if (!ret)
@ -166,7 +166,7 @@ int av_buffer_make_writable(AVBufferRef **pbuf)
return 0;
}
int av_buffer_realloc(AVBufferRef **pbuf, buffer_size_t size)
int av_buffer_realloc(AVBufferRef **pbuf, size_t size)
{
AVBufferRef *buf = *pbuf;
uint8_t *tmp;
@ -242,8 +242,8 @@ int av_buffer_replace(AVBufferRef **pdst, AVBufferRef *src)
return 0;
}
AVBufferPool *av_buffer_pool_init2(buffer_size_t size, void *opaque,
AVBufferRef* (*alloc)(void *opaque, buffer_size_t size),
AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque,
AVBufferRef* (*alloc)(void *opaque, size_t size),
void (*pool_free)(void *opaque))
{
AVBufferPool *pool = av_mallocz(sizeof(*pool));
@ -263,7 +263,7 @@ AVBufferPool *av_buffer_pool_init2(buffer_size_t size, void *opaque,
return pool;
}
AVBufferPool *av_buffer_pool_init(buffer_size_t size, AVBufferRef* (*alloc)(buffer_size_t size))
AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size))
{
AVBufferPool *pool = av_mallocz(sizeof(*pool));
if (!pool)

@ -93,11 +93,7 @@ typedef struct AVBufferRef {
/**
* Size of data in bytes.
*/
#if FF_API_BUFFER_SIZE_T
int size;
#else
size_t size;
#endif
} AVBufferRef;
/**
@ -105,21 +101,13 @@ typedef struct AVBufferRef {
*
* @return an AVBufferRef of given size or NULL when out of memory
*/
#if FF_API_BUFFER_SIZE_T
AVBufferRef *av_buffer_alloc(int size);
#else
AVBufferRef *av_buffer_alloc(size_t size);
#endif
/**
* Same as av_buffer_alloc(), except the returned buffer will be initialized
* to zero.
*/
#if FF_API_BUFFER_SIZE_T
AVBufferRef *av_buffer_allocz(int size);
#else
AVBufferRef *av_buffer_allocz(size_t size);
#endif
/**
* Always treat the buffer as read-only, even when it has only one
@ -142,11 +130,7 @@ AVBufferRef *av_buffer_allocz(size_t size);
*
* @return an AVBufferRef referring to data on success, NULL on failure.
*/
#if FF_API_BUFFER_SIZE_T
AVBufferRef *av_buffer_create(uint8_t *data, int size,
#else
AVBufferRef *av_buffer_create(uint8_t *data, size_t size,
#endif
void (*free)(void *opaque, uint8_t *data),
void *opaque, int flags);
@ -214,11 +198,7 @@ int av_buffer_make_writable(AVBufferRef **buf);
* reference to it (i.e. the one passed to this function). In all other cases
* a new buffer is allocated and the data is copied.
*/
#if FF_API_BUFFER_SIZE_T
int av_buffer_realloc(AVBufferRef **buf, int size);
#else
int av_buffer_realloc(AVBufferRef **buf, size_t size);
#endif
/**
* Ensure dst refers to the same data as src.
@ -285,11 +265,7 @@ typedef struct AVBufferPool AVBufferPool;
* (av_buffer_alloc()).
* @return newly created buffer pool on success, NULL on error.
*/
#if FF_API_BUFFER_SIZE_T
AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size));
#else
AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size));
#endif
/**
* Allocate and initialize a buffer pool with a more complex allocator.
@ -306,13 +282,8 @@ AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size
* data. May be NULL.
* @return newly created buffer pool on success, NULL on error.
*/
#if FF_API_BUFFER_SIZE_T
AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
AVBufferRef* (*alloc)(void *opaque, int size),
#else
AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque,
AVBufferRef* (*alloc)(void *opaque, size_t size),
#endif
void (*pool_free)(void *opaque));
/**

@ -33,7 +33,7 @@
struct AVBuffer {
uint8_t *data; /**< data described by this buffer */
buffer_size_t size; /**< size of data in bytes */
size_t size; /**< size of data in bytes */
/**
* number of existing AVBufferRef instances referring to this buffer
@ -90,10 +90,10 @@ struct AVBufferPool {
*/
atomic_uint refcount;
buffer_size_t size;
size_t size;
void *opaque;
AVBufferRef* (*alloc)(buffer_size_t size);
AVBufferRef* (*alloc2)(void *opaque, buffer_size_t size);
AVBufferRef* (*alloc)(size_t size);
AVBufferRef* (*alloc2)(void *opaque, size_t size);
void (*pool_free)(void *opaque);
};

@ -54,10 +54,6 @@ AVDetectionBBoxHeader *av_detection_bbox_create_side_data(AVFrame *frame, uint32
header = av_detection_bbox_alloc(nb_bboxes, &size);
if (!header)
return NULL;
if (size > INT_MAX) {
av_freep(&header);
return NULL;
}
buf = av_buffer_create((uint8_t *)header, size, NULL, NULL, 0);
if (!buf) {
av_freep(&header);

@ -603,7 +603,7 @@ AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame,
AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
enum AVFrameSideDataType type,
buffer_size_t size)
size_t size)
{
AVFrameSideData *ret;
AVBufferRef *buf = av_buffer_alloc(size);

@ -209,11 +209,7 @@ enum AVActiveFormatDescription {
typedef struct AVFrameSideData {
enum AVFrameSideDataType type;
uint8_t *data;
#if FF_API_BUFFER_SIZE_T
int size;
#else
size_t size;
#endif
AVDictionary *metadata;
AVBufferRef *buf;
} AVFrameSideData;
@ -818,11 +814,7 @@ AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane);
*/
AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
enum AVFrameSideDataType type,
#if FF_API_BUFFER_SIZE_T
int size);
#else
size_t size);
#endif
/**
* Add a new side data to a frame from an existing AVBufferRef

@ -93,7 +93,7 @@ static void cuda_buffer_free(void *opaque, uint8_t *data)
CHECK_CU(cu->cuCtxPopCurrent(&dummy));
}
static AVBufferRef *cuda_pool_alloc(void *opaque, buffer_size_t size)
static AVBufferRef *cuda_pool_alloc(void *opaque, size_t size)
{
AVHWFramesContext *ctx = opaque;
AVHWDeviceContext *device_ctx = ctx->device_ctx;

@ -202,7 +202,7 @@ static AVBufferRef *d3d11va_alloc_single(AVHWFramesContext *ctx)
return wrap_texture_buf(tex, 0);
}
static AVBufferRef *d3d11va_pool_alloc(void *opaque, buffer_size_t size)
static AVBufferRef *d3d11va_pool_alloc(void *opaque, size_t size)
{
AVHWFramesContext *ctx = (AVHWFramesContext*)opaque;
D3D11VAFramesContext *s = ctx->internal->priv;

@ -124,7 +124,7 @@ static void dxva2_pool_release_dummy(void *opaque, uint8_t *data)
// released in dxva2_frames_uninit()
}
static AVBufferRef *dxva2_pool_alloc(void *opaque, buffer_size_t size)
static AVBufferRef *dxva2_pool_alloc(void *opaque, size_t size)
{
AVHWFramesContext *ctx = (AVHWFramesContext*)opaque;
DXVA2FramesContext *s = ctx->internal->priv;

@ -1617,7 +1617,7 @@ static void opencl_pool_free(void *opaque, uint8_t *data)
av_free(desc);
}
static AVBufferRef *opencl_pool_alloc(void *opaque, buffer_size_t size)
static AVBufferRef *opencl_pool_alloc(void *opaque, size_t size)
{
AVHWFramesContext *hwfc = opaque;
AVOpenCLDeviceContext *hwctx = hwfc->device_ctx->hwctx;

@ -194,7 +194,7 @@ static void qsv_pool_release_dummy(void *opaque, uint8_t *data)
{
}
static AVBufferRef *qsv_pool_alloc(void *opaque, buffer_size_t size)
static AVBufferRef *qsv_pool_alloc(void *opaque, size_t size)
{
AVHWFramesContext *ctx = (AVHWFramesContext*)opaque;
QSVFramesContext *s = ctx->internal->priv;

@ -464,7 +464,7 @@ static void vaapi_buffer_free(void *opaque, uint8_t *data)
}
}
static AVBufferRef *vaapi_pool_alloc(void *opaque, buffer_size_t size)
static AVBufferRef *vaapi_pool_alloc(void *opaque, size_t size)
{
AVHWFramesContext *hwfc = opaque;
VAAPIFramesContext *ctx = hwfc->internal->priv;

@ -225,7 +225,7 @@ static void vdpau_buffer_free(void *opaque, uint8_t *data)
device_priv->surf_destroy(surf);
}
static AVBufferRef *vdpau_pool_alloc(void *opaque, buffer_size_t size)
static AVBufferRef *vdpau_pool_alloc(void *opaque, size_t size)
{
AVHWFramesContext *ctx = opaque;
VDPAUFramesContext *priv = ctx->internal->priv;

@ -1693,7 +1693,7 @@ static void try_export_flags(AVHWFramesContext *hwfc,
}
}
static AVBufferRef *vulkan_pool_alloc(void *opaque, buffer_size_t size)
static AVBufferRef *vulkan_pool_alloc(void *opaque, size_t size)
{
int err;
AVVkFrame *f;

@ -292,11 +292,4 @@ void ff_check_pixfmt_descriptors(void);
*/
int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp);
// Temporary typedef to simplify porting all AVBufferRef users to size_t
#if FF_API_BUFFER_SIZE_T
typedef int buffer_size_t;
#else
typedef size_t buffer_size_t;
#endif
#endif /* AVUTIL_INTERNAL_H */

@ -108,9 +108,6 @@
#ifndef FF_API_CHILD_CLASS_NEXT
#define FF_API_CHILD_CLASS_NEXT (LIBAVUTIL_VERSION_MAJOR < 57)
#endif
#ifndef FF_API_BUFFER_SIZE_T
#define FF_API_BUFFER_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 57)
#endif
#ifndef FF_API_CPU_FLAGS
#define FF_API_CPU_FLAGS (LIBAVUTIL_VERSION_MAJOR < 57)
#endif

@ -63,10 +63,6 @@ av_video_enc_params_create_side_data(AVFrame *frame, enum AVVideoEncParamsType t
par = av_video_enc_params_alloc(type, nb_blocks, &size);
if (!par)
return NULL;
if (size > INT_MAX) {
av_free(par);
return NULL;
}
buf = av_buffer_create((uint8_t *)par, size, NULL, NULL, 0);
if (!buf) {
av_freep(&par);

Loading…
Cancel
Save