]> git.sesse.net Git - vlc/blobdiff - modules/audio_filter/converter/float32tou16.c
* I ran --update-po for the last time before the 0.5.1 release (and I
[vlc] / modules / audio_filter / converter / float32tou16.c
index bb0fdaaad4d949050f4a69bf1f9203d57ba8f1ab..5af35da75aa7855d725b80c3127c51a875ae5f10 100644 (file)
@@ -2,7 +2,7 @@
  * float32tou16.c : converter from float32 to unsigned 16 bits integer
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: float32tou16.c,v 1.4 2002/08/21 22:41:59 massiot Exp $
+ * $Id: float32tou16.c,v 1.7 2002/11/20 16:43:32 sam Exp $
  *
  * Authors: Xavier Maillard <zedek@fxgsproject.org>
  *
@@ -24,7 +24,6 @@
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <errno.h>
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
@@ -58,7 +57,7 @@ static int Create( vlc_object_t *p_this )
 {
     aout_filter_t * p_filter = (aout_filter_t *)p_this;
 
-    if ( p_filter->input.i_format != AOUT_FMT_FLOAT32
+    if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
           || p_filter->output.i_format != AOUT_FMT_U16_NE )
     {
         return -1;
@@ -85,7 +84,8 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
     float * p_in = (float *)p_in_buf->p_buffer;
     u16 * p_out = (u16 *)p_out_buf->p_buffer;
 
-    for ( i = 0; i < p_in_buf->i_nb_samples * p_filter->input.i_channels; i++ )
+    for ( i = p_in_buf->i_nb_samples
+               * aout_FormatNbChannels( &p_filter->input ); i-- ; )
     {
         if ( *p_in >= 1.0 ) *p_out = 65535;
         else if ( *p_in < -1.0 ) *p_out = 0;