diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-04-14 14:59:32 +0200 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2021-04-27 10:43:13 -0300 |
commit | ef6a9e5e311f09fa8032974fa4d0c1e166a959bb (patch) | |
tree | b9b1893c45771cde9f36853685a5bc8a6b5cf27c /libavformat | |
parent | 985c0dac674846721ec8ff23344c16ac7d1c9a1e (diff) | |
download | ffmpeg-ef6a9e5e311f09fa8032974fa4d0c1e166a959bb.tar.gz |
avutil/buffer: Switch AVBuffer API to size_t
Announced in 14040a1d913794d9a3fd6406a6d8c2f0e37e0062.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/adtsenc.c | 2 | ||||
-rw-r--r-- | libavformat/apngenc.c | 2 | ||||
-rw-r--r-- | libavformat/avformat.h | 8 | ||||
-rw-r--r-- | libavformat/concatdec.c | 2 | ||||
-rw-r--r-- | libavformat/dashenc.c | 4 | ||||
-rw-r--r-- | libavformat/dump.c | 4 | ||||
-rw-r--r-- | libavformat/flacenc.c | 2 | ||||
-rw-r--r-- | libavformat/flvenc.c | 2 | ||||
-rw-r--r-- | libavformat/framecrcenc.c | 6 | ||||
-rw-r--r-- | libavformat/hashenc.c | 7 | ||||
-rw-r--r-- | libavformat/img2dec.c | 2 | ||||
-rw-r--r-- | libavformat/latmenc.c | 2 | ||||
-rw-r--r-- | libavformat/matroskaenc.c | 6 | ||||
-rw-r--r-- | libavformat/mov.c | 3 | ||||
-rw-r--r-- | libavformat/movenc.c | 10 | ||||
-rw-r--r-- | libavformat/mp3enc.c | 4 | ||||
-rw-r--r-- | libavformat/mpegtsenc.c | 4 | ||||
-rw-r--r-- | libavformat/oggdec.h | 2 | ||||
-rw-r--r-- | libavformat/rtpenc.c | 2 | ||||
-rw-r--r-- | libavformat/segment.c | 2 | ||||
-rw-r--r-- | libavformat/srtenc.c | 2 | ||||
-rw-r--r-- | libavformat/utils.c | 6 | ||||
-rw-r--r-- | libavformat/webvttdec.c | 2 | ||||
-rw-r--r-- | libavformat/webvttenc.c | 2 |
24 files changed, 41 insertions, 47 deletions
diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c index 52c543e35c..f34c52b780 100644 --- a/libavformat/adtsenc.c +++ b/libavformat/adtsenc.c @@ -170,7 +170,7 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt) return 0; if (!par->extradata_size) { uint8_t *side_data; - buffer_size_t side_data_size; + size_t side_data_size; int ret; side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, diff --git a/libavformat/apngenc.c b/libavformat/apngenc.c index 7e86f45143..643bf73300 100644 --- a/libavformat/apngenc.c +++ b/libavformat/apngenc.c @@ -119,7 +119,7 @@ static int flush_packet(AVFormatContext *format_context, AVPacket *packet) AVIOContext *io_context = format_context->pb; AVStream *codec_stream = format_context->streams[0]; uint8_t *side_data = NULL; - buffer_size_t side_data_size; + size_t side_data_size; av_assert0(apng->prev_packet); diff --git a/libavformat/avformat.h b/libavformat/avformat.h index bb8ddef88d..3834c9869f 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1873,11 +1873,7 @@ int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type, * @return pointer to fresh allocated data or NULL otherwise */ uint8_t *av_stream_new_side_data(AVStream *stream, -#if FF_API_BUFFER_SIZE_T - enum AVPacketSideDataType type, int size); -#else enum AVPacketSideDataType type, size_t size); -#endif /** * Get side information from stream. * @@ -1888,11 +1884,7 @@ uint8_t *av_stream_new_side_data(AVStream *stream, * @return pointer to data if present or NULL otherwise */ uint8_t *av_stream_get_side_data(const AVStream *stream, -#if FF_API_BUFFER_SIZE_T - enum AVPacketSideDataType type, int *size); -#else enum AVPacketSideDataType type, size_t *size); -#endif AVProgram *av_new_program(AVFormatContext *s, int id); diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 32d4a99010..fb70c21dc2 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -626,7 +626,7 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt) av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base), av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base)); if (cat->cur_file->metadata) { - buffer_size_t metadata_len; + size_t metadata_len; char* packed_metadata = av_packet_pack_dictionary(cat->cur_file->metadata, &metadata_len); if (!packed_metadata) return AVERROR(ENOMEM); diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index a73fa60d2a..0ceaa5fdfd 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -1806,7 +1806,7 @@ static int update_stream_extradata(AVFormatContext *s, OutputStream *os, { AVCodecParameters *par = os->ctx->streams[0]->codecpar; uint8_t *extradata; - buffer_size_t extradata_size; + size_t extradata_size; int ret; if (par->extradata_size) @@ -2022,7 +2022,7 @@ static int dash_parse_prft(DASHContext *c, AVPacket *pkt) { OutputStream *os = &c->streams[pkt->stream_index]; AVProducerReferenceTime *prft; - buffer_size_t side_data_size; + size_t side_data_size; prft = (AVProducerReferenceTime *)av_packet_get_side_data(pkt, AV_PKT_DATA_PRFT, &side_data_size); if (!prft || side_data_size != sizeof(AVProducerReferenceTime) || (prft->flags && prft->flags != 24)) { diff --git a/libavformat/dump.c b/libavformat/dump.c index 4d6ccd006a..f8ad01102a 100644 --- a/libavformat/dump.c +++ b/libavformat/dump.c @@ -491,8 +491,8 @@ static void dump_sidedata(void *ctx, const AVStream *st, const char *indent) dump_s12m_timecode(ctx, st, sd); break; default: - av_log(ctx, AV_LOG_INFO, - "unknown side data type %d (%d bytes)", sd->type, sd->size); + av_log(ctx, AV_LOG_INFO, "unknown side data type %d " + "(%"SIZE_SPECIFIER" bytes)", sd->type, sd->size); break; } diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index 57f5c012f7..cdd25b817f 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -280,7 +280,7 @@ static int flac_write_audio_packet(struct AVFormatContext *s, AVPacket *pkt) { FlacMuxerContext *c = s->priv_data; uint8_t *streaminfo; - buffer_size_t streaminfo_size; + size_t streaminfo_size; /* check for updated streaminfo */ streaminfo = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 35bf7ace5e..711b94c5bc 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -902,7 +902,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) if (par->codec_id == AV_CODEC_ID_AAC || par->codec_id == AV_CODEC_ID_H264 || par->codec_id == AV_CODEC_ID_MPEG4) { - buffer_size_t side_size; + size_t side_size; uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) { ret = ff_alloc_extradata(par, side_size); diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c index 1fbe4aa4ee..4e62049305 100644 --- a/libavformat/framecrcenc.c +++ b/libavformat/framecrcenc.c @@ -88,7 +88,7 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt) case AV_PKT_DATA_SPHERICAL: case AV_PKT_DATA_CONTENT_LIGHT_LEVEL: case AV_PKT_DATA_S12M_TIMECODE: - for (int j = 0; j < sd->size / 4; j++) { + for (size_t j = 0; j < sd->size / 4; j++) { uint8_t buf[4]; AV_WL32(buf, AV_RB32(sd->data + 4 * j)); side_data_crc = av_adler32_update(side_data_crc, buf, 4); @@ -119,7 +119,9 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt) default: side_data_crc = av_adler32_update(0, data, sd->size); } - av_strlcatf(buf, sizeof(buf), ", %8d, 0x%08"PRIx32, pkt->side_data[i].size, side_data_crc); + + av_strlcatf(buf, sizeof(buf), ", %8"SIZE_SPECIFIER", 0x%08"PRIx32, + pkt->side_data[i].size, side_data_crc); } } av_strlcatf(buf, sizeof(buf), "\n"); diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c index 1e9faf372a..ec4e44ef12 100644 --- a/libavformat/hashenc.c +++ b/libavformat/hashenc.c @@ -298,18 +298,19 @@ static int framehash_write_packet(struct AVFormatContext *s, AVPacket *pkt) avio_write(s->pb, buf, strlen(buf)); if (c->format_version > 1 && pkt->side_data_elems) { - int i, j; + int i; avio_printf(s->pb, ", S=%d", pkt->side_data_elems); for (i = 0; i < pkt->side_data_elems; i++) { av_hash_init(c->hashes[0]); if (HAVE_BIGENDIAN && pkt->side_data[i].type == AV_PKT_DATA_PALETTE) { - for (j = 0; j < pkt->side_data[i].size; j += sizeof(uint32_t)) { + for (size_t j = 0; j < pkt->side_data[i].size; j += sizeof(uint32_t)) { uint32_t data = AV_RL32(pkt->side_data[i].data + j); av_hash_update(c->hashes[0], (uint8_t *)&data, sizeof(uint32_t)); } } else av_hash_update(c->hashes[0], pkt->side_data[i].data, pkt->side_data[i].size); - snprintf(buf, sizeof(buf) - (AV_HASH_MAX_SIZE * 2 + 1), ", %8d, ", pkt->side_data[i].size); + snprintf(buf, sizeof(buf) - (AV_HASH_MAX_SIZE * 2 + 1), + ", %8"SIZE_SPECIFIER", ", pkt->side_data[i].size); len = strlen(buf); av_hash_final_hex(c->hashes[0], buf + len, sizeof(buf) - len); avio_write(s->pb, buf, strlen(buf)); diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c index 7b03cb2af1..84ce9ea093 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -383,7 +383,7 @@ int ff_img_read_header(AVFormatContext *s1) static int add_filename_as_pkt_side_data(char *filename, AVPacket *pkt) { AVDictionary *d = NULL; char *packed_metadata = NULL; - buffer_size_t metadata_len; + size_t metadata_len; int ret; av_dict_set(&d, "lavf.image2dec.source_path", filename, 0); diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c index 5488361bde..80fd2dfe27 100644 --- a/libavformat/latmenc.c +++ b/libavformat/latmenc.c @@ -176,7 +176,7 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt) return ff_raw_write_packet(s, pkt); else { uint8_t *side_data; - buffer_size_t side_data_size; + size_t side_data_size; int ret; side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index c3d895f931..5ac4db458b 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -2030,7 +2030,7 @@ static int mkv_write_block(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar; mkv_track *track = &mkv->tracks[pkt->stream_index]; uint8_t *data = NULL, *side_data = NULL; - buffer_size_t side_data_size; + size_t side_data_size; int err = 0, offset = 0, size = pkt->size; int64_t ts = track->write_dts ? pkt->dts : pkt->pts; uint64_t additional_id; @@ -2141,7 +2141,7 @@ static int mkv_write_vtt_blocks(AVFormatContext *s, AVIOContext *pb, const AVPac MatroskaMuxContext *mkv = s->priv_data; mkv_track *track = &mkv->tracks[pkt->stream_index]; ebml_master blockgroup; - buffer_size_t id_size, settings_size; + size_t id_size, settings_size; int size, id_size_int, settings_size_int; const char *id, *settings; int64_t ts = track->write_dts ? pkt->dts : pkt->pts; @@ -2214,7 +2214,7 @@ static int mkv_check_new_extra_data(AVFormatContext *s, const AVPacket *pkt) mkv_track *track = &mkv->tracks[pkt->stream_index]; AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar; uint8_t *side_data; - buffer_size_t side_data_size; + size_t side_data_size; int ret; side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, diff --git a/libavformat/mov.c b/libavformat/mov.c index 69477a0abc..06034695e7 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -6364,8 +6364,7 @@ static int mov_read_pssh(MOVContext *c, AVIOContext *pb, MOVAtom atom) uint8_t **key_ids; AVStream *st; uint8_t *side_data, *extra_data, *old_side_data; - size_t side_data_size; - buffer_size_t old_side_data_size; + size_t side_data_size, old_side_data_size; int ret = 0; unsigned int version, kid_count, extra_data_size, alloc_size = 0; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b15ecbe713..a315377ef6 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1992,7 +1992,7 @@ static int mov_write_colr_tag(AVIOContext *pb, MOVTrack *track, int prefer_icc) // Ref (MP4): ISO/IEC 14496-12:2012 const uint8_t *icc_profile; - buffer_size_t icc_profile_size; + size_t icc_profile_size; if (prefer_icc) { icc_profile = av_stream_get_side_data(track->st, AV_PKT_DATA_ICC_PROFILE, &icc_profile_size); @@ -3046,7 +3046,7 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov, int group = 0; uint32_t *display_matrix = NULL; - buffer_size_t display_matrix_size; + size_t display_matrix_size; int i; if (st) { @@ -4173,7 +4173,7 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, track->tref_tag = MKTAG('h','i','n','t'); track->tref_id = mov->tracks[track->src_track].track_id; } else if (track->par->codec_type == AVMEDIA_TYPE_AUDIO) { - buffer_size_t size; + size_t size; int *fallback; fallback = (int*)av_stream_get_side_data(track->st, AV_PKT_DATA_FALLBACK_TRACK, @@ -5557,7 +5557,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) AVProducerReferenceTime *prft; unsigned int samples_in_chunk = 0; int size = pkt->size, ret = 0, offset = 0; - buffer_size_t prft_size; + size_t prft_size; uint8_t *reformatted_data = NULL; ret = check_pkt(s, pkt); @@ -5910,7 +5910,7 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt) trk->par->codec_id == AV_CODEC_ID_AAC || trk->par->codec_id == AV_CODEC_ID_AV1 || trk->par->codec_id == AV_CODEC_ID_FLAC) { - buffer_size_t side_size; + size_t side_size; uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) { void *newextra = av_mallocz(side_size + AV_INPUT_BUFFER_PADDING_SIZE); diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index 803148f0c8..6607560086 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -355,7 +355,7 @@ static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt) if (mp3->xing_offset) { uint8_t *side_data = NULL; - buffer_size_t side_data_size; + size_t side_data_size; mp3_xing_add_frame(mp3, pkt); mp3->audio_size += pkt->size; @@ -402,7 +402,7 @@ static void mp3_update_xing(AVFormatContext *s) AVReplayGain *rg; uint16_t tag_crc; uint8_t *toc; - buffer_size_t rg_size; + size_t rg_size; int i; int64_t old_pos = avio_tell(s->pb); diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index a357f3a6aa..51da325e90 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -1681,7 +1681,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) const int64_t max_audio_delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE) / 2; int64_t dts = pkt->dts, pts = pkt->pts; int opus_samples = 0; - buffer_size_t side_data_size; + size_t side_data_size; uint8_t *side_data = NULL; int stream_id = -1; @@ -1818,7 +1818,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) /* Add Opus control header */ if ((AV_RB16(pkt->data) >> 5) != 0x3ff) { uint8_t *side_data; - buffer_size_t side_data_size; + size_t side_data_size; int i, n; int ctrl_header_size; int trim_start = 0, trim_end = 0; diff --git a/libavformat/oggdec.h b/libavformat/oggdec.h index bf982bfe1c..4cce53de41 100644 --- a/libavformat/oggdec.h +++ b/libavformat/oggdec.h @@ -87,7 +87,7 @@ struct ogg_stream { int start_trimming; ///< set the number of packets to drop from the start int end_trimming; ///< set the number of packets to drop from the end uint8_t *new_metadata; - buffer_size_t new_metadata_size; + size_t new_metadata_size; void *private; }; diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c index 38e4c65c4e..557128ce53 100644 --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@ -589,7 +589,7 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt) break; case AV_CODEC_ID_H263: if (s->flags & FF_RTP_FLAG_RFC2190) { - buffer_size_t mb_info_size; + size_t mb_info_size; const uint8_t *mb_info = av_packet_get_side_data(pkt, AV_PKT_DATA_H263_MB_INFO, &mb_info_size); diff --git a/libavformat/segment.c b/libavformat/segment.c index 13954b8f99..faa8eb8f92 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -856,7 +856,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt) return AVERROR(EINVAL); if (!st->codecpar->extradata_size) { - buffer_size_t pkt_extradata_size; + size_t pkt_extradata_size; uint8_t *pkt_extradata = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &pkt_extradata_size); if (pkt_extradata && pkt_extradata_size > 0) { ret = ff_alloc_extradata(st->codecpar, pkt_extradata_size); diff --git a/libavformat/srtenc.c b/libavformat/srtenc.c index 9bb0ff94c1..93d5ed7ac8 100644 --- a/libavformat/srtenc.c +++ b/libavformat/srtenc.c @@ -61,7 +61,7 @@ static int srt_write_packet(AVFormatContext *avf, AVPacket *pkt) SRTContext *srt = avf->priv_data; int64_t s = pkt->pts, e, d = pkt->duration; - buffer_size_t size; + size_t size; int x1 = -1, y1 = -1, x2 = -1, y2 = -1; const uint8_t *p; diff --git a/libavformat/utils.c b/libavformat/utils.c index e36b75081f..7078891dc0 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -5462,7 +5462,7 @@ int ff_generate_avci_extradata(AVStream *st) } uint8_t *av_stream_get_side_data(const AVStream *st, - enum AVPacketSideDataType type, buffer_size_t *size) + enum AVPacketSideDataType type, size_t *size) { int i; @@ -5515,7 +5515,7 @@ int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type, } uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type, - buffer_size_t size) + size_t size) { int ret; uint8_t *data = av_malloc(size); @@ -5631,7 +5631,7 @@ int ff_standardize_creation_time(AVFormatContext *s) int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, uint32_t *palette) { uint8_t *side_data; - buffer_size_t size; + size_t size; side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PALETTE, &size); if (side_data) { diff --git a/libavformat/webvttdec.c b/libavformat/webvttdec.c index 8d2fdfed37..cf060bd011 100644 --- a/libavformat/webvttdec.c +++ b/libavformat/webvttdec.c @@ -78,7 +78,7 @@ static int webvtt_read_header(AVFormatContext *s) int64_t pos; AVPacket *sub; const char *p, *identifier, *settings; - int identifier_len, settings_len; + size_t identifier_len, settings_len; int64_t ts_start, ts_end; ff_subtitles_read_chunk(s->pb, &cue); diff --git a/libavformat/webvttenc.c b/libavformat/webvttenc.c index 2bc86041a7..95f58e2942 100644 --- a/libavformat/webvttenc.c +++ b/libavformat/webvttenc.c @@ -64,7 +64,7 @@ static int webvtt_write_header(AVFormatContext *ctx) static int webvtt_write_packet(AVFormatContext *ctx, AVPacket *pkt) { AVIOContext *pb = ctx->pb; - buffer_size_t id_size, settings_size; + size_t id_size, settings_size; int id_size_int, settings_size_int; uint8_t *id, *settings; |