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);
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);
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,
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);
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)
}
uint8_t *av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
- buffer_size_t *size)
+ size_t *size)
{
int i;
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;
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;
}
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;
}
int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
- buffer_size_t size)
+ size_t size)
{
int i;
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);
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);
{
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) {
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,
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;
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;
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;
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,
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;
}
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);
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,
AVPacket *avpkt)
{
int ret;
- buffer_size_t new_extradata_size;
+ size_t new_extradata_size;
uint8_t *new_extradata;
HEVCContext *s = avctx->priv_data;
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)
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);
}
}
}
}
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) {
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);
}
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;
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);
}
typedef struct AVPacketSideData {
uint8_t *data;
-#if FF_API_BUFFER_SIZE_T
- int size;
-#else
size_t size;
-#endif
enum AVPacketSideDataType type;
} AVPacketSideData;
* @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.
* @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.
* @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);
* @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.
*
* @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.
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;
}
static AVBufferRef *vaapi_encode_alloc_output_buffer(void *opaque,
- buffer_size_t size)
+ size_t size)
{
AVCodecContext *avctx = opaque;
VAAPIEncodeContext *ctx = avctx->priv_data;
}
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) {
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)
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);
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) {
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;
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)
};
-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,
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,
* @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,
* @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,
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;
}
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);
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;
}
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,
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);
* @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.
*
* @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);
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);
{
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)
{
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)) {
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;
}
{
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,
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);
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);
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");
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));
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);
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,
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;
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;
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,
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;
// 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);
int group = 0;
uint32_t *display_matrix = NULL;
- buffer_size_t display_matrix_size;
+ size_t display_matrix_size;
int i;
if (st) {
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,
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);
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);
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;
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);
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;
/* 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;
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;
};
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);
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);
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;
}
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;
}
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);
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) {
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);
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;
#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)
{
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;
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)
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;
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));
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)
/**
* Size of data in bytes.
*/
-#if FF_API_BUFFER_SIZE_T
- int size;
-#else
size_t size;
-#endif
} 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
*
* @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);
* 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.
* (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.
* 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));
/**
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
*/
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);
};
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);
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);
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;
*/
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
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;
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;
// 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;
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;
{
}
-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;
}
}
-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;
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;
}
}
-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;
*/
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 */
#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
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);