@@ -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);
@@ -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);
@@ -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)) {
@@ -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,
@@ -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);
@@ -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);
@@ -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);
@@ -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)
@@ -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);
@@ -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. */
@@ -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;
@@ -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);
@@ -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);
@@ -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);
@@ -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) {
@@ -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");
Signed-off-by: James Almer <jamrial@gmail.com> --- libavformat/adtsenc.c | 3 ++- libavformat/apngenc.c | 2 +- libavformat/dashenc.c | 5 +++-- libavformat/flacenc.c | 2 +- libavformat/flvenc.c | 2 +- libavformat/latmenc.c | 3 ++- libavformat/matroskaenc.c | 9 ++++++--- libavformat/mov.c | 3 ++- libavformat/movenc.c | 12 +++++++----- libavformat/mp3enc.c | 5 +++-- libavformat/mpegtsenc.c | 4 ++-- libavformat/rtpenc.c | 2 +- libavformat/segment.c | 2 +- libavformat/srtenc.c | 3 ++- libavformat/utils.c | 2 +- libavformat/webvttenc.c | 2 +- 16 files changed, 36 insertions(+), 25 deletions(-)