]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/aout.m
aout3 API change :
[vlc] / modules / gui / macosx / aout.m
index bb586781ba7fba836cae4cd857f25219dab8f265..84316e504423b9691c2964b7786e162e982015cf 100644 (file)
@@ -2,7 +2,7 @@
  * aout.m: CoreAudio output plugin
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: aout.m,v 1.3 2002/08/12 22:48:18 massiot Exp $
+ * $Id: aout.m,v 1.8 2002/08/30 23:27:06 massiot Exp $
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -57,9 +57,7 @@ struct aout_sys_t
 /*****************************************************************************
  * Local prototypes.
  *****************************************************************************/
-static int      SetFormat       ( aout_instance_t *p_aout );
-static void     Play            ( aout_instance_t *p_aout,
-                                  aout_buffer_t *p_buffer );
+static void     Play            ( aout_instance_t *p_aout );
 
 static OSStatus IOCallback      ( AudioDeviceID inDevice,
                                   const AudioTimeStamp *inNow, 
@@ -100,22 +98,10 @@ int E_(OpenAudio)( vlc_object_t * p_this )
         return( -1 );
     }
 
-    p_aout->output.pf_setformat = SetFormat;
     p_aout->output.pf_play = Play;
 
-    return 0;
-}
-
-/*****************************************************************************
- * SetFormat: find the closest available format from p_format
- *****************************************************************************/
-static int SetFormat( aout_instance_t * p_aout )
-{
-    struct aout_sys_t * p_sys = p_aout->output.p_sys;
-    OSErr err;
-
     /* Get a description of the data format used by the device */
-    UInt32 i_param_size = sizeof( p_sys->stream_format ); 
+    i_param_size = sizeof( p_sys->stream_format ); 
     err = AudioDeviceGetProperty( p_sys->device, 0, false, 
                                   kAudioDevicePropertyStreamFormat, 
                                   &i_param_size,
@@ -139,14 +125,10 @@ static int SetFormat( aout_instance_t * p_aout )
                  p_aout->output.output.i_format );
         return -1;
     }
-    p_sys->stream_format.mFormatFlags |=
-        kLinearPCMFormatFlagIsFloat;
 
     /* Set sample rate and channels per frame */
-    p_sys->stream_format.mSampleRate
-                 = p_aout->output.output.i_rate; 
-    p_sys->stream_format.mChannelsPerFrame
-                 = p_aout->output.output.i_channels;
+    p_aout->output.output.i_rate = p_sys->stream_format.mSampleRate;
+    p_aout->output.output.i_channels = p_sys->stream_format.mChannelsPerFrame;
 
     /* Get the buffer size that the device uses for IO */
     i_param_size = sizeof( p_sys->i_buffer_size );
@@ -186,8 +168,9 @@ msg_Dbg( p_aout, "toto : %d", p_sys->i_buffer_size );
     }
 
     /* Let's pray for the following operation to be atomic... */
-    p_sys->clock_diff = mdate()
-         - AudioConvertHostTimeToNanos(AudioGetCurrentHostTime()) / 1000;
+    p_sys->clock_diff = - (mtime_t)AudioConvertHostTimeToNanos(
+                                 AudioGetCurrentHostTime()) / 1000;
+    p_sys->clock_diff += mdate();
 
     return 0;
 }
@@ -212,11 +195,10 @@ void E_(CloseAudio)( aout_instance_t * p_aout )
 }
 
 /*****************************************************************************
- * Play: queue a buffer for playing by IOCallback
+ * Play: nothing to do
  *****************************************************************************/
-static void Play( aout_instance_t * p_aout, aout_buffer_t * p_buffer )
+static void Play( aout_instance_t * p_aout )
 {
-    aout_FifoPush( p_aout, &p_aout->output.fifo, p_buffer );
 }
 
 /*****************************************************************************
@@ -241,7 +223,7 @@ static OSStatus IOCallback( AudioDeviceID inDevice,
     current_date = p_sys->clock_diff
                  + AudioConvertHostTimeToNanos(host_time.mHostTime) / 1000;
 
-    p_buffer = aout_OutputNextBuffer( p_aout, current_date );
+    p_buffer = aout_OutputNextBuffer( p_aout, current_date, VLC_FALSE );
 
     /* move data into output data buffer */
     if ( p_buffer != NULL )