diff options
author | Nicolas George <nicola.george@normalesup.org> | 2008-10-15 07:29:37 +0000 |
---|---|---|
committer | Benoit Fouet <benoit.fouet@free.fr> | 2008-10-15 07:29:37 +0000 |
commit | 9c8f0768e305811180c0670808cfcc5f8bbf7f69 (patch) | |
tree | f6500c9e921ea1cae93b91535622c777493341e2 /libavcodec/libvorbis.c | |
parent | ac809e814e8efc825a75eb4c5c292538246e0736 (diff) | |
download | ffmpeg-9c8f0768e305811180c0670808cfcc5f8bbf7f69.tar.gz |
Add a flag to avoid calling vorbis_analysis_wrote twice with an empty buffer.
Patch by Nicolas George: name surname normalesup org
Originally committed as revision 15620 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/libvorbis.c')
-rw-r--r-- | libavcodec/libvorbis.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libavcodec/libvorbis.c b/libavcodec/libvorbis.c index ce796a05f7..6963e708e2 100644 --- a/libavcodec/libvorbis.c +++ b/libavcodec/libvorbis.c @@ -42,6 +42,7 @@ typedef struct OggVorbisContext { vorbis_block vb ; uint8_t buffer[BUFFER_SIZE]; int buffer_index; + int eof; /* decoder */ vorbis_comment vc ; @@ -136,10 +137,13 @@ static int oggvorbis_encode_frame(AVCodecContext *avccontext, int buf_size, void *data) { OggVorbisContext *context = avccontext->priv_data ; - float **buffer ; ogg_packet op ; signed short *audio = data ; - int l, samples = data ? OGGVORBIS_FRAME_SIZE : 0; + int l; + + if(data) { + int samples = OGGVORBIS_FRAME_SIZE; + float **buffer ; buffer = vorbis_analysis_buffer(&context->vd, samples) ; @@ -154,6 +158,11 @@ static int oggvorbis_encode_frame(AVCodecContext *avccontext, } vorbis_analysis_wrote(&context->vd, samples) ; + } else { + if(!context->eof) + vorbis_analysis_wrote(&context->vd, 0) ; + context->eof = 1; + } while(vorbis_analysis_blockout(&context->vd, &context->vb) == 1) { vorbis_analysis(&context->vb, NULL); |