aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2021-03-06 13:29:54 -0300
committerJames Almer <jamrial@gmail.com>2021-03-10 20:26:36 -0300
commite07126f54a11cbfc23288f2e15508872da17f81b (patch)
tree7955894a3b5da65af4c88095b7aaa22ebb8e577e
parentd8a18c8fc2907004448cb45e704dc82bcd2df528 (diff)
downloadffmpeg-e07126f54a11cbfc23288f2e15508872da17f81b.tar.gz
avformat: use the buffer_size_t typedef where required
Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavformat/adtsenc.c3
-rw-r--r--libavformat/apngenc.c2
-rw-r--r--libavformat/dashenc.c5
-rw-r--r--libavformat/flacenc.c2
-rw-r--r--libavformat/flvenc.c2
-rw-r--r--libavformat/latmenc.c3
-rw-r--r--libavformat/matroskaenc.c9
-rw-r--r--libavformat/mov.c3
-rw-r--r--libavformat/movenc.c12
-rw-r--r--libavformat/mp3enc.c5
-rw-r--r--libavformat/mpegtsenc.c4
-rw-r--r--libavformat/rtpenc.c2
-rw-r--r--libavformat/segment.c2
-rw-r--r--libavformat/srtenc.c3
-rw-r--r--libavformat/utils.c2
-rw-r--r--libavformat/webvttenc.c2
16 files changed, 36 insertions, 25 deletions
diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
index 44ff5a70ee..3595cb3bb2 100644
--- a/libavformat/adtsenc.c
+++ b/libavformat/adtsenc.c
@@ -170,7 +170,8 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
if (!par->extradata_size) {
uint8_t *side_data;
- int side_data_size, ret;
+ buffer_size_t side_data_size;
+ int ret;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
&side_data_size);
diff --git a/libavformat/apngenc.c b/libavformat/apngenc.c
index 7ad6a923d5..7e86f45143 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;
- int side_data_size;
+ buffer_size_t side_data_size;
av_assert0(apng->prev_packet);
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 2d757b3a87..81a5c2b452 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1815,7 +1815,8 @@ static int update_stream_extradata(AVFormatContext *s, OutputStream *os,
{
AVCodecParameters *par = os->ctx->streams[0]->codecpar;
uint8_t *extradata;
- int ret, extradata_size;
+ buffer_size_t extradata_size;
+ int ret;
if (par->extradata_size)
return 0;
@@ -2030,7 +2031,7 @@ static int dash_parse_prft(DASHContext *c, AVPacket *pkt)
{
OutputStream *os = &c->streams[pkt->stream_index];
AVProducerReferenceTime *prft;
- int side_data_size;
+ buffer_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/flacenc.c b/libavformat/flacenc.c
index 1c983486aa..088f347bbf 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;
- int streaminfo_size;
+ buffer_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 1cfcdc6392..35bf7ace5e 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) {
- int side_size;
+ buffer_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/latmenc.c b/libavformat/latmenc.c
index 701c3932c4..91e96e90b0 100644
--- a/libavformat/latmenc.c
+++ b/libavformat/latmenc.c
@@ -176,7 +176,8 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt)
return ff_raw_write_packet(s, pkt);
else {
uint8_t *side_data;
- int side_data_size, ret;
+ buffer_size_t side_data_size;
+ int ret;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
&side_data_size);
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 367e05b36b..1749b7fd37 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2023,7 +2023,8 @@ 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;
- int err = 0, offset = 0, size = pkt->size, side_data_size;
+ buffer_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;
int64_t discard_padding = 0;
@@ -2133,7 +2134,8 @@ 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;
- int id_size, settings_size, size;
+ buffer_size_t id_size, settings_size;
+ int size;
const char *id, *settings;
int64_t ts = track->write_dts ? pkt->dts : pkt->pts;
const int flags = 0;
@@ -2198,7 +2200,8 @@ 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;
- int side_data_size, ret;
+ buffer_size_t side_data_size;
+ int ret;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
&side_data_size);
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 1c07cff6b5..23b0ead01e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6375,7 +6375,8 @@ static int mov_read_pssh(MOVContext *c, AVIOContext *pb, MOVAtom atom)
AVStream *st;
uint8_t *side_data, *extra_data, *old_side_data;
size_t side_data_size;
- int ret = 0, old_side_data_size;
+ buffer_size_t old_side_data_size;
+ int ret = 0;
unsigned int version, kid_count, extra_data_size, alloc_size = 0;
if (c->fc->nb_streams < 1)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index ccb9768564..1f0aaf5bc5 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1978,7 +1978,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;
- int icc_profile_size;
+ buffer_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);
@@ -3033,7 +3033,8 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov,
int group = 0;
uint32_t *display_matrix = NULL;
- int display_matrix_size, i;
+ buffer_size_t display_matrix_size;
+ int i;
if (st) {
if (mov->per_stream_grouping)
@@ -4173,7 +4174,8 @@ 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) {
- int * fallback, size;
+ buffer_size_t size;
+ int *fallback;
fallback = (int*)av_stream_get_side_data(track->st,
AV_PKT_DATA_FALLBACK_TRACK,
&size);
@@ -5556,7 +5558,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;
- int prft_size;
+ buffer_size_t prft_size;
uint8_t *reformatted_data = NULL;
ret = check_pkt(s, pkt);
@@ -5908,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) {
- int side_size;
+ buffer_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 4f91c4f1c3..ce503e3473 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;
- int side_data_size;
+ buffer_size_t side_data_size;
mp3_xing_add_frame(mp3, pkt);
mp3->audio_size += pkt->size;
@@ -402,7 +402,8 @@ static void mp3_update_xing(AVFormatContext *s)
AVReplayGain *rg;
uint16_t tag_crc;
uint8_t *toc;
- int i, rg_size;
+ buffer_size_t rg_size;
+ int i;
int64_t old_pos = avio_tell(s->pb);
/* replace "Xing" identification string with "Info" for CBR files. */
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 45f8d5f373..8158a20497 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1677,7 +1677,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;
- int side_data_size;
+ buffer_size_t side_data_size;
uint8_t *side_data = NULL;
int stream_id = -1;
@@ -1814,7 +1814,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;
- int side_data_size;
+ buffer_size_t side_data_size;
int i, n;
int ctrl_header_size;
int trim_start = 0, trim_end = 0;
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 9ef7e9094d..38e4c65c4e 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) {
- int mb_info_size;
+ buffer_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 dff3d0ed48..5265ecaebb 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -859,7 +859,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR(EINVAL);
if (!st->codecpar->extradata_size) {
- int pkt_extradata_size;
+ buffer_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 d811a4da0e..484dd4d230 100644
--- a/libavformat/srtenc.c
+++ b/libavformat/srtenc.c
@@ -61,7 +61,8 @@ static int srt_write_packet(AVFormatContext *avf, AVPacket *pkt)
SRTContext *srt = avf->priv_data;
int64_t s = pkt->pts, e, d = pkt->duration;
- int size, x1 = -1, y1 = -1, x2 = -1, y2 = -1;
+ buffer_size_t size;
+ int x1 = -1, y1 = -1, x2 = -1, y2 = -1;
const uint8_t *p;
p = av_packet_get_side_data(pkt, AV_PKT_DATA_SUBTITLE_POSITION, &size);
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 98e6c55602..8573117694 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -5698,7 +5698,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;
- int size;
+ buffer_size_t size;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_PALETTE, &size);
if (side_data) {
diff --git a/libavformat/webvttenc.c b/libavformat/webvttenc.c
index cbd989dcb6..552bc38b65 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;
- int id_size, settings_size;
+ buffer_size_t id_size, settings_size;
uint8_t *id, *settings;
avio_printf(pb, "\n");