diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-09-28 21:50:40 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-09-28 21:50:40 +0000 |
commit | 78953e626f5202a467c03e00623cbac68cf2b529 (patch) | |
tree | 4583442b59156f6afb00ea6a32661f0c49098d96 | |
parent | 80e85288652e0ddfa78fcf1e2aaaa04b1643e3cd (diff) | |
download | ffmpeg-78953e626f5202a467c03e00623cbac68cf2b529.tar.gz |
avoid using local arrays outside the block where they live ...
Originally committed as revision 3536 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | ffmpeg.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1085,7 +1085,9 @@ static int output_packet(AVInputStream *ist, int ist_index, int data_size, got_picture; AVFrame picture; void *buffer_to_free; - + static int samples_size= 0; + static short *samples= NULL; + if(!pkt){ ist->pts= ist->next_pts; // needed for last packet if vsync=0 } else if (pkt->dts != AV_NOPTS_VALUE) { //FIXME seems redundant, as libavformat does this too @@ -1111,9 +1113,10 @@ static int output_packet(AVInputStream *ist, int ist_index, if (ist->decoding_needed) { switch(ist->st->codec.codec_type) { case CODEC_TYPE_AUDIO:{ + if(pkt) + samples= av_fast_realloc(samples, &samples_size, FFMAX(pkt->size, AVCODEC_MAX_AUDIO_FRAME_SIZE)); /* XXX: could avoid copy if PCM 16 bits with same endianness as CPU */ - short samples[pkt && pkt->size > AVCODEC_MAX_AUDIO_FRAME_SIZE/2 ? pkt->size : AVCODEC_MAX_AUDIO_FRAME_SIZE/2]; ret = avcodec_decode_audio(&ist->st->codec, samples, &data_size, ptr, len); if (ret < 0) |