]> git.sesse.net Git - vlc/blobdiff - modules/codec/faad.c
Tell FAAD2 to produce FAAD_FMT_16BIT (16bits PCM values) and VLC so that it doesn...
[vlc] / modules / codec / faad.c
index 209926926fcc7ef275752a079d2389fa3f02d956..47fd65b379486f80c07ef676f42436c891fc7812 100644 (file)
@@ -2,7 +2,7 @@
  * decoder.c: AAC decoder using libfaad2
  *****************************************************************************
  * Copyright (C) 2001, 2003 VideoLAN
- * $Id: faad.c,v 1.8 2003/12/12 23:15:40 gbazin Exp $
+ * $Id: faad.c,v 1.11 2004/02/19 15:42:25 jpsaman Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *          Gildas Bazin <gbazin@netcourrier.com>
@@ -108,14 +108,18 @@ static int Open( vlc_object_t *p_this )
     /* Open a faad context */
     if( ( p_sys->hfaad = faacDecOpen() ) == NULL )
     {
-        msg_Err( p_dec, "Cannot initialize faad" );
+        msg_Err( p_dec, "cannot initialize faad" );
         return VLC_EGENERIC;
     }
 
     /* Misc init */
     aout_DateSet( &p_sys->date, 0 );
     p_dec->fmt_out.i_cat = AUDIO_ES;
-    p_dec->fmt_out.i_codec = VLC_FOURCC('f','l','3','2');
+
+    if (p_intf->p_libvlc->i_cpu & CPU_CAPABILITY_FPU)
+        p_dec->fmt_out.i_codec = VLC_FOURCC('f','l','3','2');
+    else
+        p_dec->fmt_out.i_codec = VLC_FOURCC('f','i','1','6');
     p_dec->pf_decode_audio = DecodeBlock;
 
     p_dec->fmt_out.audio.i_physical_channels =
@@ -147,7 +151,10 @@ static int Open( vlc_object_t *p_this )
 
     /* Set the faad config */
     cfg = faacDecGetCurrentConfiguration( p_sys->hfaad );
-    cfg->outputFormat = FAAD_FMT_FLOAT;
+    if (p_intf->p_libvlc->i_cpu & CPU_CAPABILITY_FPU)
+        cfg->outputFormat = FAAD_FMT_FLOAT;
+    else
+        cfg->outputFormat = FAAD_FMT_16BIT;
     faacDecSetConfiguration( p_sys->hfaad, cfg );
 
     /* buffer */
@@ -259,7 +266,7 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 
         if( frame.samples <= 0 )
         {
-            msg_Warn( p_dec, "decoded zero samples" );
+            msg_Warn( p_dec, "decoded zero sample" );
 
             /* Flush the buffer */
             p_sys->i_buffer -= frame.bytesconsumed;