cosmetics: remove superfluous curly brackets

Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Paul B Mahol 2012-03-22 20:22:39 +00:00 committed by Michael Niedermayer
parent 0e465c1a81
commit ae2c33b0c2
68 changed files with 68 additions and 136 deletions

@ -308,9 +308,8 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
/* any frames to encode? */ /* any frames to encode? */
if (c->mc_lifetime) { if (c->mc_lifetime) {
req_size = charset_size + c->mc_lifetime*(screen_size + colram_size); req_size = charset_size + c->mc_lifetime*(screen_size + colram_size);
if ((ret = ff_alloc_packet2(avctx, pkt, req_size)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, req_size)) < 0)
return ret; return ret;
}
buf = pkt->data; buf = pkt->data;
/* calc optimal new charset + charmaps */ /* calc optimal new charset + charmaps */

@ -574,9 +574,8 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
do { do {
int frame_bits; int frame_bits;
if ((ret = ff_alloc_packet2(avctx, avpkt, 768 * s->channels))) { if ((ret = ff_alloc_packet2(avctx, avpkt, 768 * s->channels)))
return ret; return ret;
}
init_put_bits(&s->pb, avpkt->data, avpkt->size); init_put_bits(&s->pb, avpkt->data, avpkt->size);
if ((avctx->frame_number & 0xFF)==1 && !(avctx->flags & CODEC_FLAG_BITEXACT)) if ((avctx->frame_number & 0xFF)==1 && !(avctx->flags & CODEC_FLAG_BITEXACT))

@ -437,9 +437,8 @@ int AC3_NAME(encode_frame)(AVCodecContext *avctx, AVPacket *avpkt,
ff_ac3_quantize_mantissas(s); ff_ac3_quantize_mantissas(s);
if ((ret = ff_alloc_packet2(avctx, avpkt, s->frame_size))) { if ((ret = ff_alloc_packet2(avctx, avpkt, s->frame_size)))
return ret; return ret;
}
ff_ac3_output_frame(s, avpkt->data); ff_ac3_output_frame(s, avpkt->data);
if (frame->pts != AV_NOPTS_VALUE) if (frame->pts != AV_NOPTS_VALUE)

@ -494,9 +494,8 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
pkt_size = (2 + avctx->channels * (22 + 4 * (frame->nb_samples - 1)) + 7) / 8; pkt_size = (2 + avctx->channels * (22 + 4 * (frame->nb_samples - 1)) + 7) / 8;
else else
pkt_size = avctx->block_align; pkt_size = avctx->block_align;
if ((ret = ff_alloc_packet2(avctx, avpkt, pkt_size))) { if ((ret = ff_alloc_packet2(avctx, avpkt, pkt_size)))
return ret; return ret;
}
dst = avpkt->data; dst = avpkt->data;
switch(avctx->codec->id) { switch(avctx->codec->id) {

@ -139,9 +139,8 @@ static int adx_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
int ch, out_size, ret; int ch, out_size, ret;
out_size = BLOCK_SIZE * avctx->channels + !c->header_parsed * HEADER_SIZE; out_size = BLOCK_SIZE * avctx->channels + !c->header_parsed * HEADER_SIZE;
if ((ret = ff_alloc_packet2(avctx, avpkt, out_size)) < 0) { if ((ret = ff_alloc_packet2(avctx, avpkt, out_size)) < 0)
return ret; return ret;
}
dst = avpkt->data; dst = avpkt->data;
if (!c->header_parsed) { if (!c->header_parsed) {

@ -552,9 +552,8 @@ static int alac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
else else
max_frame_size = s->max_coded_frame_size; max_frame_size = s->max_coded_frame_size;
if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * max_frame_size))) { if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * max_frame_size)))
return ret; return ret;
}
/* use verbatim mode for compression_level 0 */ /* use verbatim mode for compression_level 0 */
s->verbatim = !s->compression_level; s->verbatim = !s->compression_level;

@ -473,9 +473,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int mb_x, mb_y; int mb_x, mb_y;
if ((ret = ff_alloc_packet2(avctx, pkt, a->mb_height*a->mb_width*MAX_MB_SIZE + if ((ret = ff_alloc_packet2(avctx, pkt, a->mb_height*a->mb_width*MAX_MB_SIZE +
FF_MIN_BUFFER_SIZE)) < 0) { FF_MIN_BUFFER_SIZE)) < 0)
return ret; return ret;
}
init_put_bits(&a->pb, pkt->data, pkt->size); init_put_bits(&a->pb, pkt->data, pkt->size);

@ -120,9 +120,8 @@ static int bmp_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
#define SIZE_BITMAPINFOHEADER 40 #define SIZE_BITMAPINFOHEADER 40
hsize = SIZE_BITMAPFILEHEADER + SIZE_BITMAPINFOHEADER + (pal_entries << 2); hsize = SIZE_BITMAPFILEHEADER + SIZE_BITMAPINFOHEADER + (pal_entries << 2);
n_bytes = n_bytes_image + hsize; n_bytes = n_bytes_image + hsize;
if ((ret = ff_alloc_packet2(avctx, pkt, n_bytes)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, n_bytes)) < 0)
return ret; return ret;
}
buf = pkt->data; buf = pkt->data;
bytestream_put_byte(&buf, 'B'); // BITMAPFILEHEADER.bfType bytestream_put_byte(&buf, 'B'); // BITMAPFILEHEADER.bfType
bytestream_put_byte(&buf, 'M'); // do. bytestream_put_byte(&buf, 'M'); // do.

@ -146,9 +146,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
{ 0xCB2A0000, 0xCB250000 }, { 0xCB2A0000, 0xCB250000 },
}; };
if ((ret = ff_alloc_packet2(avctx, pkt, 32*avctx->height*avctx->width/4)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, 32*avctx->height*avctx->width/4)) < 0)
return ret; return ret;
}
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame->key_frame = 1; avctx->coded_frame->key_frame = 1;

@ -910,9 +910,8 @@ static int dnxhd_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
int offset, i, ret; int offset, i, ret;
uint8_t *buf; uint8_t *buf;
if ((ret = ff_alloc_packet2(avctx, pkt, ctx->cid_table->frame_size)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, ctx->cid_table->frame_size)) < 0)
return ret; return ret;
}
buf = pkt->data; buf = pkt->data;
dnxhd_load_picture(ctx, frame); dnxhd_load_picture(ctx, frame);

@ -117,9 +117,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
size = avctx->height * avctx->width * 4; size = avctx->height * avctx->width * 4;
else else
size = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); size = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
if ((ret = ff_alloc_packet2(avctx, pkt, size + HEADER_SIZE)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, size + HEADER_SIZE)) < 0)
return ret; return ret;
}
buf = pkt->data; buf = pkt->data;
memset(buf, 0, HEADER_SIZE); memset(buf, 0, HEADER_SIZE);

@ -1286,9 +1286,8 @@ static int dvvideo_encode_frame(AVCodecContext *c, AVPacket *pkt,
s->sys = avpriv_dv_codec_profile(c); s->sys = avpriv_dv_codec_profile(c);
if (!s->sys || dv_init_dynamic_tables(s->sys)) if (!s->sys || dv_init_dynamic_tables(s->sys))
return -1; return -1;
if ((ret = ff_alloc_packet2(c, pkt, s->sys->frame_size)) < 0) { if ((ret = ff_alloc_packet2(c, pkt, s->sys->frame_size)) < 0)
return ret; return ret;
}
c->pix_fmt = s->sys->pix_fmt; c->pix_fmt = s->sys->pix_fmt;
s->picture = *frame; s->picture = *frame;

@ -1155,9 +1155,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int i, ret; int i, ret;
if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*((8*2+1+1)*4)/8 if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*((8*2+1+1)*4)/8
+ FF_MIN_BUFFER_SIZE)) < 0) { + FF_MIN_BUFFER_SIZE)) < 0)
return ret; return ret;
}
ff_init_range_encoder(c, pkt->data, pkt->size); ff_init_range_encoder(c, pkt->data, pkt->size);
ff_build_rac_states(c, 0.05*(1LL<<32), 256-8); ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);

@ -1254,9 +1254,8 @@ static int flac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
frame_bytes = encode_frame(s); frame_bytes = encode_frame(s);
} }
if ((ret = ff_alloc_packet2(avctx, avpkt, frame_bytes))) { if ((ret = ff_alloc_packet2(avctx, avpkt, frame_bytes)))
return ret; return ret;
}
out_bytes = write_frame(s, avpkt); out_bytes = write_frame(s, avpkt);

@ -834,9 +834,8 @@ static int flashsv2_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
*p = *pict; *p = *pict;
if ((res = ff_alloc_packet2(avctx, pkt, s->frame_size + FF_MIN_BUFFER_SIZE)) < 0) { if ((res = ff_alloc_packet2(avctx, pkt, s->frame_size + FF_MIN_BUFFER_SIZE)) < 0)
return res; return res;
}
/* First frame needs to be a keyframe */ /* First frame needs to be a keyframe */
if (avctx->frame_number == 0) if (avctx->frame_number == 0)

@ -228,9 +228,8 @@ static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
I_frame = 1; I_frame = 1;
} }
if ((res = ff_alloc_packet2(avctx, pkt, s->image_width * s->image_height * 3)) < 0) { if ((res = ff_alloc_packet2(avctx, pkt, s->image_width * s->image_height * 3)) < 0)
return res; return res;
}
pkt->size = encode_bitstream(s, p, pkt->data, pkt->size, opt_w * 16, opt_h * 16, pkt->size = encode_bitstream(s, p, pkt->data, pkt->size, opt_w * 16, opt_h * 16,
pfptr, &I_frame); pfptr, &I_frame);

@ -366,9 +366,8 @@ static int g722_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
int nb_samples, out_size, ret; int nb_samples, out_size, ret;
out_size = (frame->nb_samples + 1) / 2; out_size = (frame->nb_samples + 1) / 2;
if ((ret = ff_alloc_packet2(avctx, avpkt, out_size))) { if ((ret = ff_alloc_packet2(avctx, avpkt, out_size)))
return ret; return ret;
}
nb_samples = frame->nb_samples - (frame->nb_samples & 1); nb_samples = frame->nb_samples - (frame->nb_samples & 1);

@ -361,9 +361,8 @@ static int g726_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
int i, ret, out_size; int i, ret, out_size;
out_size = (frame->nb_samples * c->code_size + 7) / 8; out_size = (frame->nb_samples * c->code_size + 7) / 8;
if ((ret = ff_alloc_packet2(avctx, avpkt, out_size))) { if ((ret = ff_alloc_packet2(avctx, avpkt, out_size)))
return ret; return ret;
}
init_put_bits(&pb, avpkt->data, avpkt->size); init_put_bits(&pb, avpkt->data, avpkt->size);
for (i = 0; i < frame->nb_samples; i++) for (i = 0; i < frame->nb_samples; i++)

@ -164,9 +164,8 @@ static int gif_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
uint8_t *outbuf_ptr, *end; uint8_t *outbuf_ptr, *end;
int ret; int ret;
if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*7/5 + FF_MIN_BUFFER_SIZE)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*7/5 + FF_MIN_BUFFER_SIZE)) < 0)
return ret; return ret;
}
outbuf_ptr = pkt->data; outbuf_ptr = pkt->data;
end = pkt->data + pkt->size; end = pkt->data + pkt->size;

@ -1281,9 +1281,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
AVFrame * const p= &s->picture; AVFrame * const p= &s->picture;
int i, j, size = 0, ret; int i, j, size = 0, ret;
if ((ret = ff_alloc_packet2(avctx, pkt, width * height * 3 * 4 + FF_MIN_BUFFER_SIZE)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, width * height * 3 * 4 + FF_MIN_BUFFER_SIZE)) < 0)
return ret; return ret;
}
*p = *pict; *p = *pict;
p->pict_type= AV_PICTURE_TYPE_I; p->pict_type= AV_PICTURE_TYPE_I;

@ -927,9 +927,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int tileno, ret; int tileno, ret;
J2kEncoderContext *s = avctx->priv_data; J2kEncoderContext *s = avctx->priv_data;
if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*9 + FF_MIN_BUFFER_SIZE)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*9 + FF_MIN_BUFFER_SIZE)) < 0)
return ret; return ret;
}
// init: // init:
s->buf = s->buf_start = pkt->data; s->buf = s->buf_start = pkt->data;

@ -251,9 +251,8 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
comps = 3; comps = 3;
if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*comps*4 + if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*comps*4 +
FF_MIN_BUFFER_SIZE)) < 0) { FF_MIN_BUFFER_SIZE)) < 0)
return ret; return ret;
}
buf2 = av_malloc(pkt->size); buf2 = av_malloc(pkt->size);

@ -78,9 +78,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int zret; // Zlib return code int zret; // Zlib return code
int max_size = deflateBound(&c->zstream, avctx->width * avctx->height * 3); int max_size = deflateBound(&c->zstream, avctx->width * avctx->height * 3);
if ((ret = ff_alloc_packet2(avctx, pkt, max_size)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, max_size)) < 0)
return ret; return ret;
}
*p = *pict; *p = *pict;
p->pict_type= AV_PICTURE_TYPE_I; p->pict_type= AV_PICTURE_TYPE_I;

@ -184,9 +184,8 @@ static int Faac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
int num_samples = frame ? frame->nb_samples : 0; int num_samples = frame ? frame->nb_samples : 0;
void *samples = frame ? frame->data[0] : NULL; void *samples = frame ? frame->data[0] : NULL;
if ((ret = ff_alloc_packet2(avctx, avpkt, (7 + 768) * avctx->channels))) { if ((ret = ff_alloc_packet2(avctx, avpkt, (7 + 768) * avctx->channels)))
return ret; return ret;
}
bytes_written = faacEncEncode(s->faac_handle, samples, bytes_written = faacEncEncode(s->faac_handle, samples,
num_samples * avctx->channels, num_samples * avctx->channels,

@ -100,9 +100,8 @@ static int libgsm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
gsm_signal *samples = (gsm_signal *)frame->data[0]; gsm_signal *samples = (gsm_signal *)frame->data[0];
struct gsm_state *state = avctx->priv_data; struct gsm_state *state = avctx->priv_data;
if ((ret = ff_alloc_packet2(avctx, avpkt, avctx->block_align))) { if ((ret = ff_alloc_packet2(avctx, avpkt, avctx->block_align)))
return ret; return ret;
}
switch(avctx->codec_id) { switch(avctx->codec_id) {
case CODEC_ID_GSM: case CODEC_ID_GSM:

@ -255,9 +255,8 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
av_dlog(avctx, "in:%d packet-len:%d index:%d\n", avctx->frame_size, len, av_dlog(avctx, "in:%d packet-len:%d index:%d\n", avctx->frame_size, len,
s->buffer_index); s->buffer_index);
if (len <= s->buffer_index) { if (len <= s->buffer_index) {
if ((ret = ff_alloc_packet2(avctx, avpkt, len))) { if ((ret = ff_alloc_packet2(avctx, avpkt, len)))
return ret; return ret;
}
memcpy(avpkt->data, s->buffer, len); memcpy(avpkt->data, s->buffer, len);
s->buffer_index -= len; s->buffer_index -= len;
memmove(s->buffer, s->buffer + len, s->buffer_index); memmove(s->buffer, s->buffer + len, s->buffer_index);

@ -244,9 +244,8 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
s->enc_bitrate = avctx->bit_rate; s->enc_bitrate = avctx->bit_rate;
} }
if ((ret = ff_alloc_packet2(avctx, avpkt, 32))) { if ((ret = ff_alloc_packet2(avctx, avpkt, 32)))
return ret; return ret;
}
if (frame) { if (frame) {
if (frame->nb_samples < avctx->frame_size) { if (frame->nb_samples < avctx->frame_size) {

@ -381,9 +381,8 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk
pkt_size = p_frame_output->size; pkt_size = p_frame_output->size;
if (last_frame_in_sequence && p_schro_params->enc_buf_size > 0) if (last_frame_in_sequence && p_schro_params->enc_buf_size > 0)
pkt_size += p_schro_params->enc_buf_size; pkt_size += p_schro_params->enc_buf_size;
if ((ret = ff_alloc_packet2(avccontext, pkt, pkt_size)) < 0) { if ((ret = ff_alloc_packet2(avccontext, pkt, pkt_size)) < 0)
goto error; goto error;
}
memcpy(pkt->data, p_frame_output->p_encbuf, p_frame_output->size); memcpy(pkt->data, p_frame_output->p_encbuf, p_frame_output->size);
avccontext->coded_frame->key_frame = p_frame_output->key_frame; avccontext->coded_frame->key_frame = p_frame_output->key_frame;

@ -267,9 +267,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
/* write output if all frames for the packet have been encoded */ /* write output if all frames for the packet have been encoded */
if (s->pkt_frame_count == s->frames_per_packet) { if (s->pkt_frame_count == s->frames_per_packet) {
s->pkt_frame_count = 0; s->pkt_frame_count = 0;
if ((ret = ff_alloc_packet2(avctx, avpkt, speex_bits_nbytes(&s->bits)))) { if ((ret = ff_alloc_packet2(avctx, avpkt, speex_bits_nbytes(&s->bits))))
return ret; return ret;
}
ret = speex_bits_write(&s->bits, avpkt->data, avpkt->size); ret = speex_bits_write(&s->bits, avpkt->data, avpkt->size);
speex_bits_reset(&s->bits); speex_bits_reset(&s->bits);

@ -328,9 +328,8 @@ static int encode_frame(AVCodecContext* avc_context, AVPacket *pkt,
} }
/* Copy ogg_packet content out to buffer */ /* Copy ogg_packet content out to buffer */
if ((ret = ff_alloc_packet2(avc_context, pkt, o_packet.bytes)) < 0) { if ((ret = ff_alloc_packet2(avc_context, pkt, o_packet.bytes)) < 0)
return ret; return ret;
}
memcpy(pkt->data, o_packet.packet, o_packet.bytes); memcpy(pkt->data, o_packet.packet, o_packet.bytes);
// HACK: assumes no encoder delay, this is true until libtheora becomes // HACK: assumes no encoder delay, this is true until libtheora becomes

@ -130,9 +130,8 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
uint8_t *dst; uint8_t *dst;
/* Alloc buffer */ /* Alloc buffer */
if ((ret = ff_alloc_packet2(avctx, pkt, utv->buf_size)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, utv->buf_size)) < 0)
return ret; return ret;
}
dst = pkt->data; dst = pkt->data;

@ -161,9 +161,8 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
return ret; return ret;
} }
if ((ret = ff_alloc_packet2(avctx, avpkt, FFMAX(8192, 768 * avctx->channels)))) { if ((ret = ff_alloc_packet2(avctx, avpkt, FFMAX(8192, 768 * avctx->channels))))
return ret; return ret;
}
input.Buffer = samples; input.Buffer = samples;
input.Length = 2 * avctx->channels * avctx->frame_size; input.Length = 2 * avctx->channels * avctx->frame_size;

@ -117,9 +117,8 @@ static int amr_wb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
const int16_t *samples = (const int16_t *)frame->data[0]; const int16_t *samples = (const int16_t *)frame->data[0];
int size, ret; int size, ret;
if ((ret = ff_alloc_packet2(avctx, avpkt, MAX_PACKET_SIZE))) { if ((ret = ff_alloc_packet2(avctx, avpkt, MAX_PACKET_SIZE)))
return ret; return ret;
}
if (s->last_bitrate != avctx->bit_rate) { if (s->last_bitrate != avctx->bit_rate) {
s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx); s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx);

@ -353,9 +353,8 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
av_fifo_generic_read(s->pkt_fifo, &op, sizeof(ogg_packet), NULL); av_fifo_generic_read(s->pkt_fifo, &op, sizeof(ogg_packet), NULL);
if ((ret = ff_alloc_packet2(avctx, avpkt, op.bytes))) { if ((ret = ff_alloc_packet2(avctx, avpkt, op.bytes)))
return ret; return ret;
}
av_fifo_generic_read(s->pkt_fifo, avpkt->data, op.bytes, NULL); av_fifo_generic_read(s->pkt_fifo, avpkt->data, op.bytes, NULL);
avpkt->pts = ff_samples_to_time_base(avctx, op.granulepos); avpkt->pts = ff_samples_to_time_base(avctx, op.granulepos);

@ -87,9 +87,8 @@ static int encode_nals(AVCodecContext *ctx, AVPacket *pkt,
for (i = 0; i < nnal; i++) for (i = 0; i < nnal; i++)
size += nals[i].i_payload; size += nals[i].i_payload;
if ((ret = ff_alloc_packet2(ctx, pkt, size)) < 0) { if ((ret = ff_alloc_packet2(ctx, pkt, size)) < 0)
return ret; return ret;
}
p = pkt->data; p = pkt->data;
/* Write the SEI as part of the first frame. */ /* Write the SEI as part of the first frame. */

@ -385,9 +385,8 @@ static int xvid_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
xvid_enc_frame_t xvid_enc_frame; xvid_enc_frame_t xvid_enc_frame;
xvid_enc_stats_t xvid_enc_stats; xvid_enc_stats_t xvid_enc_stats;
if ((ret = ff_alloc_packet2(avctx, pkt, mb_width*mb_height*MAX_MB_BYTES + FF_MIN_BUFFER_SIZE)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, mb_width*mb_height*MAX_MB_BYTES + FF_MIN_BUFFER_SIZE)) < 0)
return ret; return ret;
}
/* Start setting up the frame */ /* Start setting up the frame */
memset(&xvid_enc_frame, 0, sizeof(xvid_enc_frame)); memset(&xvid_enc_frame, 0, sizeof(xvid_enc_frame));

@ -57,9 +57,8 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
max_pkt_size += mb_width * mb_height * 3 * 4 max_pkt_size += mb_width * mb_height * 3 * 4
* s->mjpeg_hsample[0] * s->mjpeg_vsample[0]; * s->mjpeg_hsample[0] * s->mjpeg_vsample[0];
} }
if ((ret = ff_alloc_packet2(avctx, pkt, max_pkt_size)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, max_pkt_size)) < 0)
return ret; return ret;
}
init_put_bits(&s->pb, pkt->data, pkt->size); init_put_bits(&s->pb, pkt->data, pkt->size);

@ -751,9 +751,8 @@ static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
} }
compute_bit_allocation(s, smr, bit_alloc, &padding); compute_bit_allocation(s, smr, bit_alloc, &padding);
if ((ret = ff_alloc_packet2(avctx, avpkt, MPA_MAX_CODED_FRAME_SIZE))) { if ((ret = ff_alloc_packet2(avctx, avpkt, MPA_MAX_CODED_FRAME_SIZE)))
return ret; return ret;
}
init_put_bits(&s->pb, avpkt->data, avpkt->size); init_put_bits(&s->pb, avpkt->data, avpkt->size);

@ -76,9 +76,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int i, j, k, x, y, ret; int i, j, k, x, y, ret;
int skips = 0; int skips = 0;
if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*9 + FF_MIN_BUFFER_SIZE)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*9 + FF_MIN_BUFFER_SIZE)) < 0)
return ret; return ret;
}
dst= buf= pkt->data; dst= buf= pkt->data;
*p = *pict; *p = *pict;

@ -401,9 +401,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
s->last_frame = 1; s->last_frame = 1;
} }
if ((ret = ff_alloc_packet2(avctx, avpkt, NELLY_BLOCK_LEN))) { if ((ret = ff_alloc_packet2(avctx, avpkt, NELLY_BLOCK_LEN)))
return ret; return ret;
}
encode_block(s, avpkt->data, avpkt->size); encode_block(s, avpkt->data, avpkt->size);
/* Get the next frame pts/duration */ /* Get the next frame pts/duration */

@ -88,9 +88,8 @@ static int pam_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
return -1; return -1;
} }
if ((ret = ff_alloc_packet2(avctx, pkt, n*h + 200)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, n*h + 200)) < 0)
return ret; return ret;
}
*p = *pict; *p = *pict;
p->pict_type = AV_PICTURE_TYPE_I; p->pict_type = AV_PICTURE_TYPE_I;

@ -96,9 +96,8 @@ static int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
n = frame->nb_samples * avctx->channels; n = frame->nb_samples * avctx->channels;
samples = (const short *)frame->data[0]; samples = (const short *)frame->data[0];
if ((ret = ff_alloc_packet2(avctx, avpkt, n * sample_size))) { if ((ret = ff_alloc_packet2(avctx, avpkt, n * sample_size)))
return ret; return ret;
}
dst = avpkt->data; dst = avpkt->data;
switch(avctx->codec->id) { switch(avctx->codec->id) {

@ -153,9 +153,8 @@ static int pcx_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
line_bytes = (line_bytes + 1) & ~1; line_bytes = (line_bytes + 1) & ~1;
max_pkt_size = 128 + avctx->height * 2 * line_bytes * nplanes + (pal ? 256*3 + 1 : 0); max_pkt_size = 128 + avctx->height * 2 * line_bytes * nplanes + (pal ? 256*3 + 1 : 0);
if ((ret = ff_alloc_packet2(avctx, pkt, max_pkt_size)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, max_pkt_size)) < 0)
return ret; return ret;
}
buf = pkt->data; buf = pkt->data;
buf_end = pkt->data + pkt->size; buf_end = pkt->data + pkt->size;

@ -292,9 +292,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
+ FF_MIN_BUFFER_SIZE; + FF_MIN_BUFFER_SIZE;
if (max_packet_size > INT_MAX) if (max_packet_size > INT_MAX)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
if ((ret = ff_alloc_packet2(avctx, pkt, max_packet_size)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, max_packet_size)) < 0)
return ret; return ret;
}
s->bytestream_start = s->bytestream_start =
s->bytestream = pkt->data; s->bytestream = pkt->data;

@ -34,9 +34,8 @@ static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
if ((ret = ff_alloc_packet2(avctx, pkt, avpicture_get_size(avctx->pix_fmt, if ((ret = ff_alloc_packet2(avctx, pkt, avpicture_get_size(avctx->pix_fmt,
avctx->width, avctx->width,
avctx->height) + 200)) < 0) { avctx->height) + 200)) < 0)
return ret; return ret;
}
*p = *pict; *p = *pict;
p->pict_type = AV_PICTURE_TYPE_I; p->pict_type = AV_PICTURE_TYPE_I;

@ -494,9 +494,8 @@ static int prores_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int frame_size = FFALIGN(avctx->width, 16) * FFALIGN(avctx->height, 16)*16 + 500 + FF_MIN_BUFFER_SIZE; //FIXME choose tighter limit int frame_size = FFALIGN(avctx->width, 16) * FFALIGN(avctx->height, 16)*16 + 500 + FF_MIN_BUFFER_SIZE; //FIXME choose tighter limit
if ((ret = ff_alloc_packet2(avctx, pkt, frame_size + FF_MIN_BUFFER_SIZE)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, frame_size + FF_MIN_BUFFER_SIZE)) < 0)
return ret; return ret;
}
buf = pkt->data; buf = pkt->data;
pic_size = prores_encode_picture(avctx, pict, buf + header_size + 8, pic_size = prores_encode_picture(avctx, pict, buf + header_size + 8,

@ -700,9 +700,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
pkt_size = ctx->frame_size + FF_MIN_BUFFER_SIZE; pkt_size = ctx->frame_size + FF_MIN_BUFFER_SIZE;
if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size)) < 0)
return ret; return ret;
}
orig_buf = pkt->data; orig_buf = pkt->data;

@ -310,9 +310,8 @@ static int qtrle_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
*p = *pict; *p = *pict;
if ((ret = ff_alloc_packet2(avctx, pkt, s->max_buf_size)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, s->max_buf_size)) < 0)
return ret; return ret;
}
if (avctx->gop_size == 0 || (s->avctx->frame_number % avctx->gop_size) == 0) { if (avctx->gop_size == 0 || (s->avctx->frame_number % avctx->gop_size) == 0) {
/* I-Frame */ /* I-Frame */

@ -43,9 +43,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
uint8_t *src_line; uint8_t *src_line;
uint8_t *dst; uint8_t *dst;
if ((ret = ff_alloc_packet2(avctx, pkt, 4 * aligned_width * avctx->height)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, 4 * aligned_width * avctx->height)) < 0)
return ret; return ret;
}
avctx->coded_frame->reference = 0; avctx->coded_frame->reference = 0;
avctx->coded_frame->key_frame = 1; avctx->coded_frame->key_frame = 1;

@ -458,9 +458,8 @@ static int ra144_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
if (ractx->last_frame) if (ractx->last_frame)
return 0; return 0;
if ((ret = ff_alloc_packet2(avctx, avpkt, FRAMESIZE))) { if ((ret = ff_alloc_packet2(avctx, avpkt, FRAMESIZE)))
return ret; return ret;
}
/** /**
* Since the LPC coefficients are calculated on a frame centered over the * Since the LPC coefficients are calculated on a frame centered over the

@ -171,9 +171,8 @@ static int roq_dpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
else else
data_size = avctx->channels * avctx->frame_size; data_size = avctx->channels * avctx->frame_size;
if ((ret = ff_alloc_packet2(avctx, avpkt, ROQ_HEADER_SIZE + data_size))) { if ((ret = ff_alloc_packet2(avctx, avpkt, ROQ_HEADER_SIZE + data_size)))
return ret; return ret;
}
out = avpkt->data; out = avpkt->data;
bytestream_put_byte(&out, stereo ? 0x21 : 0x20); bytestream_put_byte(&out, stereo ? 0x21 : 0x20);

@ -1020,9 +1020,8 @@ static int roq_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
/* 138 bits max per 8x8 block + /* 138 bits max per 8x8 block +
* 256 codebooks*(6 bytes 2x2 + 4 bytes 4x4) + 8 bytes frame header */ * 256 codebooks*(6 bytes 2x2 + 4 bytes 4x4) + 8 bytes frame header */
size = ((enc->width * enc->height / 64) * 138 + 7) / 8 + 256 * (6 + 4) + 8; size = ((enc->width * enc->height / 64) * 138 + 7) / 8 + 256 * (6 + 4) + 8;
if ((ret = ff_alloc_packet2(avctx, pkt, size)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, size)) < 0)
return ret; return ret;
}
enc->out_buf = pkt->data; enc->out_buf = pkt->data;
/* Check for I frame */ /* Check for I frame */

@ -113,9 +113,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
else // assume ff_rl_encode() produces at most 2x size of input else // assume ff_rl_encode() produces at most 2x size of input
length += tablesize * 2 + depth * height * (2 * width + 1); length += tablesize * 2 + depth * height * (2 * width + 1);
if ((ret = ff_alloc_packet2(avctx, pkt, bytes_per_channel * length)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, bytes_per_channel * length)) < 0)
return ret; return ret;
}
buf = pkt->data; buf = pkt->data;
end_buf = pkt->data + pkt->size; end_buf = pkt->data + pkt->size;

@ -1614,9 +1614,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
uint8_t rc_header_bak[sizeof(s->header_state)]; uint8_t rc_header_bak[sizeof(s->header_state)];
uint8_t rc_block_bak[sizeof(s->block_state)]; uint8_t rc_block_bak[sizeof(s->block_state)];
if ((ret = ff_alloc_packet2(avctx, pkt, s->b_width*s->b_height*MB_SIZE*MB_SIZE*3 + FF_MIN_BUFFER_SIZE)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, s->b_width*s->b_height*MB_SIZE*MB_SIZE*3 + FF_MIN_BUFFER_SIZE)) < 0)
return ret; return ret;
}
ff_init_range_encoder(c, pkt->data, pkt->size); ff_init_range_encoder(c, pkt->data, pkt->size);
ff_build_rac_states(c, 0.05*(1LL<<32), 256-8); ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);

@ -505,9 +505,8 @@ static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
AVFrame temp; AVFrame temp;
int i, ret; int i, ret;
if ((ret = ff_alloc_packet2(avctx, pkt, s->y_block_width*s->y_block_height*MAX_MB_BYTES*3 + FF_MIN_BUFFER_SIZE) < 0)) { if ((ret = ff_alloc_packet2(avctx, pkt, s->y_block_width*s->y_block_height*MAX_MB_BYTES*3 + FF_MIN_BUFFER_SIZE) < 0))
return ret; return ret;
}
if(avctx->pix_fmt != PIX_FMT_YUV410P){ if(avctx->pix_fmt != PIX_FMT_YUV410P){
av_log(avctx, AV_LOG_ERROR, "unsupported pixel format\n"); av_log(avctx, AV_LOG_ERROR, "unsupported pixel format\n");

@ -86,9 +86,8 @@ static int targa_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
picsize = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); picsize = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
if ((ret = ff_alloc_packet2(avctx, pkt, picsize + 45)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, picsize + 45)) < 0)
return ret; return ret;
}
/* zero out the header and only set applicable fields */ /* zero out the header and only set applicable fields */
memset(pkt->data, 0, 12); memset(pkt->data, 0, 12);

@ -305,9 +305,8 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt,
strips = (s->height - 1) / s->rps + 1; strips = (s->height - 1) / s->rps + 1;
if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * s->bpp * 2 + if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * s->bpp * 2 +
avctx->height * 4 + FF_MIN_BUFFER_SIZE)) < 0) { avctx->height * 4 + FF_MIN_BUFFER_SIZE)) < 0)
return ret; return ret;
}
ptr = pkt->data; ptr = pkt->data;
s->buf_start = pkt->data; s->buf_start = pkt->data;
s->buf = &ptr; s->buf = &ptr;

@ -57,9 +57,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const uint16_t *v = (const uint16_t*)pic->data[2]; const uint16_t *v = (const uint16_t*)pic->data[2];
PutByteContext p; PutByteContext p;
if ((ret = ff_alloc_packet2(avctx, pkt, avctx->height * stride)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, avctx->height * stride)) < 0)
return ret; return ret;
}
bytestream2_init_writer(&p, pkt->data, pkt->size); bytestream2_init_writer(&p, pkt->data, pkt->size);

@ -48,9 +48,8 @@ static int v308_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
uint8_t *y, *u, *v; uint8_t *y, *u, *v;
int i, j, ret; int i, j, ret;
if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * 3)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * 3)) < 0)
return ret; return ret;
}
dst = pkt->data; dst = pkt->data;
avctx->coded_frame->reference = 0; avctx->coded_frame->reference = 0;

@ -43,9 +43,8 @@ static int v408_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
uint8_t *y, *u, *v, *a; uint8_t *y, *u, *v, *a;
int i, j, ret; int i, j, ret;
if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * 4)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * 4)) < 0)
return ret; return ret;
}
dst = pkt->data; dst = pkt->data;
avctx->coded_frame->reference = 0; avctx->coded_frame->reference = 0;

@ -49,9 +49,8 @@ static int v410_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
uint32_t val; uint32_t val;
int i, j, ret; int i, j, ret;
if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * 4)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * 4)) < 0)
return ret; return ret;
}
dst = pkt->data; dst = pkt->data;
avctx->coded_frame->reference = 0; avctx->coded_frame->reference = 0;

@ -1030,9 +1030,8 @@ static int vorbis_encode_frame(AVCodecContext *avccontext, AVPacket *avpkt,
return 0; return 0;
samples = 1 << (venc->log2_blocksize[0] - 1); samples = 1 << (venc->log2_blocksize[0] - 1);
if ((ret = ff_alloc_packet2(avccontext, avpkt, 8192))) { if ((ret = ff_alloc_packet2(avccontext, avpkt, 8192)))
return ret; return ret;
}
init_put_bits(&pb, avpkt->data, avpkt->size); init_put_bits(&pb, avpkt->data, avpkt->size);

@ -371,9 +371,8 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt,
} }
} }
if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * MAX_CODED_SUPERFRAME_SIZE))) { if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * MAX_CODED_SUPERFRAME_SIZE)))
return ret; return ret;
}
#if 1 #if 1
total_gain= 128; total_gain= 128;

@ -41,9 +41,8 @@ static int xbm_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
linesize = (avctx->width + 7) / 8; linesize = (avctx->width + 7) / 8;
size = avctx->height * (linesize * 7 + 2) + 110; size = avctx->height * (linesize * 7 + 2) + 110;
if ((ret = ff_alloc_packet2(avctx, pkt, size)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, size)) < 0)
return ret; return ret;
}
buf = pkt->data; buf = pkt->data;
ptr = p->data[0]; ptr = p->data[0];

@ -148,9 +148,8 @@ static int xwd_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
header_size = XWD_HEADER_SIZE + WINDOW_NAME_SIZE; header_size = XWD_HEADER_SIZE + WINDOW_NAME_SIZE;
out_size = header_size + ncolors * XWD_CMAP_SIZE + avctx->height * lsize; out_size = header_size + ncolors * XWD_CMAP_SIZE + avctx->height * lsize;
if ((ret = ff_alloc_packet2(avctx, pkt, out_size)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, out_size)) < 0)
return ret; return ret;
}
buf = pkt->data; buf = pkt->data;
avctx->coded_frame->key_frame = 1; avctx->coded_frame->key_frame = 1;

@ -48,9 +48,8 @@ static int y41p_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
uint8_t *y, *u, *v; uint8_t *y, *u, *v;
int i, j, ret; int i, j, ret;
if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * 1.5)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * 1.5)) < 0)
return ret; return ret;
}
avctx->coded_frame->reference = 0; avctx->coded_frame->reference = 0;
avctx->coded_frame->key_frame = 1; avctx->coded_frame->key_frame = 1;

@ -42,9 +42,8 @@ static int yuv4_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
uint8_t *y, *u, *v; uint8_t *y, *u, *v;
int i, j, ret; int i, j, ret;
if ((ret = ff_alloc_packet2(avctx, pkt, 6 * (avctx->width + 1 >> 1) * (avctx->height + 1 >> 1))) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, 6 * (avctx->width + 1 >> 1) * (avctx->height + 1 >> 1))) < 0)
return ret; return ret;
}
dst = pkt->data; dst = pkt->data;
avctx->coded_frame->reference = 0; avctx->coded_frame->reference = 0;

@ -228,9 +228,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
} }
pkt_size = c->zstream.total_out + 1 + 6*keyframe; pkt_size = c->zstream.total_out + 1 + 6*keyframe;
if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size)) < 0) { if ((ret = ff_alloc_packet2(avctx, pkt, pkt_size)) < 0)
return ret; return ret;
}
buf = pkt->data; buf = pkt->data;
fl = (keyframe ? ZMBV_KEYFRAME : 0) | (chpal ? ZMBV_DELTAPAL : 0); fl = (keyframe ? ZMBV_KEYFRAME : 0) | (chpal ? ZMBV_DELTAPAL : 0);