]> git.sesse.net Git - vlc/blobdiff - modules/codec/speex.c
Omitted option -duration-scaling which caused plugin to stop working.
[vlc] / modules / codec / speex.c
index 2389feb7ee636c3c457e40ff73c9c38438851cf6..f0eb5014b574b8f821410524bcc52c9d9c1a0d8d 100755 (executable)
@@ -2,7 +2,7 @@
  * speex.c: speex decoder/packetizer/encoder module making use of libspeex.
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: speex.c,v 1.6 2003/12/04 16:49:43 sam Exp $
+ * $Id: speex.c,v 1.9 2004/01/05 13:07:02 zorglub Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -26,6 +26,7 @@
  *****************************************************************************/
 #include <vlc/vlc.h>
 #include <vlc/decoder.h>
+#include "vlc_playlist.h"
 
 #include <ogg/ogg.h>
 #include <speex.h>
@@ -270,13 +271,13 @@ static int ProcessHeader( decoder_t *p_dec, ogg_packet *p_oggpacket )
         msg_Err( p_dec, "File encoded with a newer version of Speex" );
         return VLC_EGENERIC;
     }
-    if( p_mode->bitstream_version > p_header->mode_bitstream_version ) 
+    if( p_mode->bitstream_version > p_header->mode_bitstream_version )
     {
         msg_Err( p_dec, "File encoded with an older version of Speex" );
         return VLC_EGENERIC;
     }
-   
-    msg_Dbg( p_dec, "Speex %d Hz audio using %s mode %s%s", 
+
+    msg_Dbg( p_dec, "Speex %d Hz audio using %s mode %s%s",
              p_header->rate, p_mode->modeName,
              ( p_header->nb_channels == 1 ) ? " (mono" : " (stereo",
              p_header->vbr ? ", VBR)" : ")" );
@@ -460,7 +461,9 @@ static void ParseSpeexComments( decoder_t *p_dec, ogg_packet *p_oggpacket )
     decoder_sys_t *p_sys = p_dec->p_sys;
 
     input_info_category_t *p_cat =
-        input_InfoCategory( p_input, _("Speex Comment") );
+        input_InfoCategory( p_input, _("Speex comment") );
+    playlist_t *p_playlist = vlc_object_find( p_dec, VLC_OBJECT_PLAYLIST,
+                                              FIND_ANYWHERE );
 
     char *p_buf = (char *)p_oggpacket->packet;
     SpeexMode *p_mode;
@@ -469,6 +472,8 @@ static void ParseSpeexComments( decoder_t *p_dec, ogg_packet *p_oggpacket )
     p_mode = speex_mode_list[p_sys->p_header->mode];
     input_AddInfo( p_cat, _("Mode"), "%s%s",
                    p_mode->modeName, p_sys->p_header->vbr ? " VBR" : "" );
+    playlist_AddInfo( p_playlist, -1, _("Speex comment") , _("Mode"), "%s%s",
+                    p_mode->modeName, p_sys->p_header->vbr ? " VBR" : "" );
 
     if( p_oggpacket->bytes < 8 )
     {
@@ -484,6 +489,9 @@ static void ParseSpeexComments( decoder_t *p_dec, ogg_packet *p_oggpacket )
     }
 
     input_AddInfo( p_cat, p_buf, "" );
+    playlist_AddInfo( p_playlist, -1, _("Speex comment") , p_buf , "" );
+
+    if( p_playlist ) vlc_object_release( p_playlist );
 
     /* TODO: finish comments parsing */
 }
@@ -634,7 +642,7 @@ static block_t *Headers( encoder_t *p_enc )
                 p_block->i_buffer );
         p_block->i_dts = p_block->i_pts = p_block->i_length = 0;
         block_ChainAppend( &p_chain, p_block );
-      
+
         p_sys->i_headers = 2;
     }
 
@@ -730,8 +738,8 @@ static block_t *Encode( encoder_t *p_enc, aout_buffer_t *p_aout_buf )
     /* Backup the remaining raw samples */
     if( i_samples )
     {
-        memcpy( p_sys->p_buffer, p_buffer + i_samples_delay * 2 *
-                p_enc->fmt_in.audio.i_channels,
+        memcpy( p_sys->p_buffer + i_samples_delay * 2 *
+                p_enc->fmt_in.audio.i_channels, p_buffer,
                 i_samples * 2 * p_enc->fmt_in.audio.i_channels );
     }