diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-06-22 21:14:01 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-06-22 21:14:01 +0000 |
commit | 6f82497728c49831e230bb631c4c3d6f5deff803 (patch) | |
tree | b7a02d38ef9f9427ffeb6874e6ce82bdcb1940c7 /libavcodec/mp3lameaudio.c | |
parent | f2e92ef2915333b233846e32cd2b0ac1f785516e (diff) | |
download | ffmpeg-6f82497728c49831e230bb631c4c3d6f5deff803.tar.gz |
flush audio encoder buffers at the end
fix vorbis in nut again
Originally committed as revision 3244 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mp3lameaudio.c')
-rw-r--r-- | libavcodec/mp3lameaudio.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/libavcodec/mp3lameaudio.c b/libavcodec/mp3lameaudio.c index f53aee9272..ce02ff0c10 100644 --- a/libavcodec/mp3lameaudio.c +++ b/libavcodec/mp3lameaudio.c @@ -136,7 +136,9 @@ int MP3lame_encode_frame(AVCodecContext *avctx, int lame_result; /* lame 3.91 dies on '1-channel interleaved' data */ - if (s->stereo) { + + if(data){ + if (s->stereo) { lame_result = lame_encode_buffer_interleaved( s->gfp, data, @@ -144,7 +146,7 @@ int MP3lame_encode_frame(AVCodecContext *avctx, s->buffer + s->buffer_index, BUFFER_SIZE - s->buffer_index ); - } else { + } else { lame_result = lame_encode_buffer( s->gfp, data, @@ -153,6 +155,13 @@ int MP3lame_encode_frame(AVCodecContext *avctx, s->buffer + s->buffer_index, BUFFER_SIZE - s->buffer_index ); + } + }else{ + lame_result= lame_encode_flush( + s->gfp, + s->buffer + s->buffer_index, + BUFFER_SIZE - s->buffer_index + ); } if(lame_result==-1) { @@ -174,7 +183,6 @@ int MP3lame_encode_frame(AVCodecContext *avctx, memmove(s->buffer, s->buffer+len, s->buffer_index); //FIXME fix the audio codec API, so we dont need the memcpy() - //FIXME fix the audio codec API, so we can output multiple packets if we have them /*for(i=0; i<len; i++){ av_log(avctx, AV_LOG_DEBUG, "%2X ", frame[i]); }*/ @@ -201,5 +209,6 @@ AVCodec mp3lame_encoder = { sizeof(Mp3AudioContext), MP3lame_encode_init, MP3lame_encode_frame, - MP3lame_encode_close + MP3lame_encode_close, + .capabilities= CODEC_CAP_DELAY, }; |