[vlc-devel] commit: Fixed vorbis encoder. (Laurent Aimar )

git version control git at videolan.org
Sun Feb 21 16:26:49 CET 2010


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun Feb 21 16:26:29 2010 +0100| [b3e29297c8c5525e1da4ba3efedee686c3c6d785] | committer: Laurent Aimar 

Fixed vorbis encoder.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b3e29297c8c5525e1da4ba3efedee686c3c6d785
---

 modules/codec/vorbis.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/modules/codec/vorbis.c b/modules/codec/vorbis.c
index 4fe9b35..cfaebf3 100644
--- a/modules/codec/vorbis.c
+++ b/modules/codec/vorbis.c
@@ -818,15 +818,14 @@ static int OpenEncoder( vlc_object_t *p_this )
     /* Create and store headers */
     vorbis_analysis_headerout( &p_sys->vd, &p_sys->vc,
                                &header[0], &header[1], &header[2]);
-    p_enc->fmt_out.i_extra = 3 * 2 + header[0].bytes +
-       header[1].bytes + header[2].bytes;
-    p_extra = p_enc->fmt_out.p_extra = xmalloc( p_enc->fmt_out.i_extra );
-    for( i = 0; i < 3; i++ )
+    for( int i = 0; i < 3; i++ )
     {
-        *(p_extra++) = header[i].bytes >> 8;
-        *(p_extra++) = header[i].bytes & 0xFF;
-        memcpy( p_extra, header[i].packet, header[i].bytes );
-        p_extra += header[i].bytes;
+        if( xiph_AppendHeaders( &p_enc->fmt_out.i_extra, &p_enc->fmt_out.p_extra,
+                                header[i].bytes, header[i].packet ) )
+        {
+            p_enc->fmt_out.i_extra = 0;
+            p_enc->fmt_out.p_extra = NULL;
+        }
     }
 
     p_sys->i_channels = p_enc->fmt_in.audio.i_channels;




More information about the vlc-devel mailing list