* modules/audio_output/coreaudio.c: worked around a CoreAudio bug (should
authorChristophe Massiot <massiot@videolan.org>
Sun, 4 May 2003 15:02:42 +0000 (15:02 +0000)
committerChristophe Massiot <massiot@videolan.org>
Sun, 4 May 2003 15:02:42 +0000 (15:02 +0000)
  fix the "sound drops after half an hour" bug)
* modules/audio_filter/resampler/coreaudio.c: reenabled the coreaudio
  resampler which works perfectly fine here
Please test that I didn't break S/PDIF output on OS X.

modules/audio_filter/resampler/coreaudio.c
modules/audio_output/coreaudio.c

index 575228c..a3a4146 100644 (file)
@@ -2,7 +2,7 @@
  * coreaudio.c resampler based on CoreAudio's AudioConverter
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: coreaudio.c,v 1.2 2003/03/31 22:39:27 massiot Exp $
+ * $Id: coreaudio.c,v 1.3 2003/05/04 15:02:42 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -62,7 +62,7 @@ struct aout_filter_sys_t
  *****************************************************************************/
 vlc_module_begin();
     set_description( _("audio filter using CoreAudio for resampling") );
-    set_capability( "audio filter", 0 );
+    set_capability( "audio filter", 40 );
     set_callbacks( Create, Close );
 vlc_module_end();
 
index 53c85c1..8a79d00 100644 (file)
@@ -2,7 +2,7 @@
  * coreaudio.c: CoreAudio output plugin
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: coreaudio.c,v 1.1 2003/03/30 23:35:06 jlj Exp $
+ * $Id: coreaudio.c,v 1.2 2003/05/04 15:02:42 massiot Exp $
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -337,6 +337,26 @@ static int Open( vlc_object_t * p_this )
 
         msg_Dbg( p_aout, "device buffer size set to: [%ld]", 
                  p_sys->i_buffer_size );
+
+        /* Set buffer frame size */
+        i_param_size = sizeof( p_aout->output.i_nb_samples );
+        err = AudioDeviceSetProperty( p_sys->devid, 0, 0, FALSE,
+                                      kAudioDevicePropertyBufferFrameSize,
+                                      i_param_size,
+                                      &p_aout->output.i_nb_samples );
+        if( err != noErr )
+        {
+            msg_Err( p_aout, "failed to set buffer frame size: [%4.4s]", 
+                     (char *)&err );
+            FreeDevice( p_aout );
+            FreeHardwareInfo( p_aout );
+            vlc_mutex_destroy( &p_sys->lock );
+            free( (void *)p_sys );
+            return( VLC_EGENERIC );
+        }
+
+        msg_Dbg( p_aout, "device buffer frame size set to: [%d]",
+                 p_aout->output.i_nb_samples );
     }
 
     switch( p_sys->stream_format.mFormatID )
@@ -412,26 +432,6 @@ static int Open( vlc_object_t * p_this )
         return( VLC_EGENERIC );
     }
 
-    /* Set buffer frame size */
-    i_param_size = sizeof( p_aout->output.i_nb_samples );
-    err = AudioDeviceSetProperty( p_sys->devid, 0, 0, FALSE,
-                                  kAudioDevicePropertyBufferFrameSize,
-                                  i_param_size,
-                                  &p_aout->output.i_nb_samples );
-    if( err != noErr )
-    {
-        msg_Err( p_aout, "failed to set buffer frame size: [%4.4s]", 
-                 (char *)&err );
-        FreeDevice( p_aout );
-        FreeHardwareInfo( p_aout );
-        vlc_mutex_destroy( &p_sys->lock );
-        free( (void *)p_sys );
-        return( VLC_EGENERIC );
-    }
-
-    msg_Dbg( p_aout, "device buffer frame size set to: [%d]",
-             p_aout->output.i_nb_samples );
-
     /* Add callback */
     err = AudioDeviceAddIOProc( p_sys->devid,
                                 (AudioDeviceIOProc)IOCallback,