* 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>
/*****************************************************************************
* 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,
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,
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 );
}
/* 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;
}
}
/*****************************************************************************
- * 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 );
}
/*****************************************************************************
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 )