avcodec, avformat: Remove unnecessary initializations of side data size

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2020-06-21 06:50:03 +02:00
parent b8c6aae575
commit c3cd6b765b
12 changed files with 13 additions and 15 deletions

View File

@ -483,7 +483,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;
int side_data_size = 0;
int side_data_size;
side_data = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,
&side_data_size);

View File

@ -66,7 +66,7 @@ typedef struct FramePool {
static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt)
{
int size = 0, ret;
int size, ret;
const uint8_t *data;
uint32_t flags;
int64_t val;

View File

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

View File

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

View File

@ -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 = 0;
int side_data_size;
av_assert0(apng->prev_packet);

View File

@ -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 = 0;
int 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);

View File

@ -165,7 +165,7 @@ 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 = 0, ret;
int side_data_size, ret;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
&side_data_size);

View File

@ -2007,7 +2007,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;
int err = 0, offset = 0, size = pkt->size, side_data_size = 0;
int err = 0, offset = 0, size = pkt->size, side_data_size;
int64_t ts = track->write_dts ? pkt->dts : pkt->pts;
uint64_t additional_id;
int64_t discard_padding = 0;
@ -2122,12 +2122,10 @@ static int mkv_write_vtt_blocks(AVFormatContext *s, AVIOContext *pb, const AVPac
int64_t ts = track->write_dts ? pkt->dts : pkt->pts;
const int flags = 0;
id_size = 0;
id = av_packet_get_side_data(pkt, AV_PKT_DATA_WEBVTT_IDENTIFIER,
&id_size);
id = id ? id : "";
settings_size = 0;
settings = av_packet_get_side_data(pkt, AV_PKT_DATA_WEBVTT_SETTINGS,
&settings_size);
settings = settings ? settings : "";
@ -2184,7 +2182,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;
int side_data_size = 0, ret;
int side_data_size, ret;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
&side_data_size);

View File

@ -5788,7 +5788,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 = 0;
int 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);

View File

@ -354,7 +354,7 @@ static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt)
if (mp3->xing_offset) {
uint8_t *side_data = NULL;
int side_data_size = 0;
int side_data_size;
mp3_xing_add_frame(mp3, pkt);
mp3->audio_size += pkt->size;

View File

@ -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 = 0;
int mb_info_size;
const uint8_t *mb_info =
av_packet_get_side_data(pkt, AV_PKT_DATA_H263_MB_INFO,
&mb_info_size);

View File

@ -873,7 +873,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR(EINVAL);
if (!st->codecpar->extradata_size) {
int pkt_extradata_size = 0;
int 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);