[FFmpeg-cvslog] r15620 - trunk/libavcodec/libvorbis.c

benoit subversion
Wed Oct 15 09:29:37 CEST 2008


Author: benoit
Date: Wed Oct 15 09:29:37 2008
New Revision: 15620

Log:
Add a flag to avoid calling vorbis_analysis_wrote twice with an empty buffer.
Patch by Nicolas George: name surname normalesup org


Modified:
   trunk/libavcodec/libvorbis.c

Modified: trunk/libavcodec/libvorbis.c
==============================================================================
--- trunk/libavcodec/libvorbis.c	(original)
+++ trunk/libavcodec/libvorbis.c	Wed Oct 15 09:29:37 2008
@@ -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(AVCode
                            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(AVCode
     }
 
     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);




More information about the ffmpeg-cvslog mailing list