Commit d809a3fb authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Merge aout_output_t into aout_instance_t

This prepares for a possible cleanup of the audio output object,
especially hiding more stuff into the core.
parent 335bbdfe
...@@ -164,31 +164,9 @@ struct aout_fifo_t ...@@ -164,31 +164,9 @@ struct aout_fifo_t
/* FIXME to remove once aout.h is cleaned a bit more */ /* FIXME to remove once aout.h is cleaned a bit more */
#include <vlc_block.h> #include <vlc_block.h>
/** an output stream for the audio output */
typedef struct aout_output_t
{
audio_sample_format_t output;
/* Indicates whether the audio output is currently starving, to avoid
* printing a 1,000 "output is starving" messages. */
bool b_starving;
/* post-filters */
filter_t * pp_filters[AOUT_MAX_FILTERS];
int i_nb_filters;
aout_fifo_t fifo;
struct module_t * p_module;
struct aout_sys_t * p_sys;
void (*pf_play)( aout_instance_t * );
void (* pf_pause)( aout_instance_t *, bool, mtime_t );
int (* pf_volume_set )( aout_instance_t *, float, bool );
int i_nb_samples;
} aout_output_t;
struct aout_mixer_t; struct aout_mixer_t;
/** audio output thread descriptor */ /** Audio output object */
struct aout_instance_t struct aout_instance_t
{ {
VLC_COMMON_MEMBERS VLC_COMMON_MEMBERS
...@@ -205,8 +183,27 @@ struct aout_instance_t ...@@ -205,8 +183,27 @@ struct aout_instance_t
float mixer_multiplier; float mixer_multiplier;
struct aout_mixer_t *p_mixer; struct aout_mixer_t *p_mixer;
/* Output plug-in */ audio_sample_format_t format; /**< Output format (plugin can modify it
aout_output_t output; only when succesfully probed and not afterward) */
/* Indicates whether the audio output is currently starving, to avoid
* printing a 1,000 "output is starving" messages. */
bool b_starving;
/* post-filters */
filter_t * pp_filters[AOUT_MAX_FILTERS];
int i_nb_filters;
aout_fifo_t fifo;
struct module_t *module; /**< Output plugin */
struct aout_sys_t *sys; /**< Output plugin private data */
void (*pf_play)( aout_instance_t * ); /**< Audio buffer callback */
void (* pf_pause)( aout_instance_t *, bool, mtime_t ); /**< Pause/resume
callback (optional, may be NULL) */
int (* pf_volume_set )(aout_instance_t *, float, bool); /**< Volume setter
(optional, may be NULL) */
int i_nb_samples;
}; };
/** /**
......
...@@ -184,7 +184,7 @@ static int Open (vlc_object_t *obj) ...@@ -184,7 +184,7 @@ static int Open (vlc_object_t *obj)
return VLC_ENOMEM; return VLC_ENOMEM;
snd_pcm_format_t pcm_format; /* ALSA sample format */ snd_pcm_format_t pcm_format; /* ALSA sample format */
vlc_fourcc_t fourcc = p_aout->output.output.i_format; vlc_fourcc_t fourcc = p_aout->format.i_format;
bool spdif = false; bool spdif = false;
switch (fourcc) switch (fourcc)
...@@ -242,7 +242,7 @@ static int Open (vlc_object_t *obj) ...@@ -242,7 +242,7 @@ static int Open (vlc_object_t *obj)
pcm_format = SND_PCM_FORMAT_U8; pcm_format = SND_PCM_FORMAT_U8;
break; break;
default: default:
if (AOUT_FMT_NON_LINEAR(&p_aout->output.output)) if (AOUT_FMT_NON_LINEAR(&p_aout->format))
spdif = var_InheritBool (p_aout, "spdif"); spdif = var_InheritBool (p_aout, "spdif");
if (HAVE_FPU) if (HAVE_FPU)
{ {
...@@ -263,7 +263,7 @@ static int Open (vlc_object_t *obj) ...@@ -263,7 +263,7 @@ static int Open (vlc_object_t *obj)
{ {
unsigned aes3; unsigned aes3;
switch (p_aout->output.output.i_rate) switch (p_aout->format.i_rate)
{ {
#define FS(freq) \ #define FS(freq) \
case freq: aes3 = IEC958_AES3_CON_FS_ ## freq; break; case freq: aes3 = IEC958_AES3_CON_FS_ ## freq; break;
...@@ -293,7 +293,7 @@ static int Open (vlc_object_t *obj) ...@@ -293,7 +293,7 @@ static int Open (vlc_object_t *obj)
free (psz_device); free (psz_device);
return VLC_ENOMEM; return VLC_ENOMEM;
} }
p_aout->output.p_sys = p_sys; p_aout->sys = p_sys;
#ifdef ALSA_DEBUG #ifdef ALSA_DEBUG
snd_output_stdio_attach( &p_sys->p_snd_stderr, stderr, 0 ); snd_output_stdio_attach( &p_sys->p_snd_stderr, stderr, 0 );
...@@ -349,24 +349,24 @@ static int Open (vlc_object_t *obj) ...@@ -349,24 +349,24 @@ static int Open (vlc_object_t *obj)
pcm_format = SND_PCM_FORMAT_S16; pcm_format = SND_PCM_FORMAT_S16;
i_channels = 2; i_channels = 2;
p_aout->output.i_nb_samples = i_period_size = ALSA_SPDIF_PERIOD_SIZE; p_aout->i_nb_samples = i_period_size = ALSA_SPDIF_PERIOD_SIZE;
p_aout->output.output.i_bytes_per_frame = AOUT_SPDIF_SIZE; p_aout->format.i_bytes_per_frame = AOUT_SPDIF_SIZE;
p_aout->output.output.i_frame_length = A52_FRAME_NB; p_aout->format.i_frame_length = A52_FRAME_NB;
aout_VolumeNoneInit( p_aout ); aout_VolumeNoneInit( p_aout );
} }
else else
{ {
i_buffer_size = ALSA_DEFAULT_BUFFER_SIZE; i_buffer_size = ALSA_DEFAULT_BUFFER_SIZE;
i_channels = aout_FormatNbChannels( &p_aout->output.output ); i_channels = aout_FormatNbChannels( &p_aout->format );
p_aout->output.i_nb_samples = i_period_size = ALSA_DEFAULT_PERIOD_SIZE; p_aout->i_nb_samples = i_period_size = ALSA_DEFAULT_PERIOD_SIZE;
aout_VolumeSoftInit( p_aout ); aout_VolumeSoftInit( p_aout );
} }
p_aout->output.pf_play = Play; p_aout->pf_play = Play;
p_aout->output.pf_pause = NULL; p_aout->pf_pause = NULL;
snd_pcm_hw_params_t *p_hw; snd_pcm_hw_params_t *p_hw;
snd_pcm_sw_params_t *p_sw; snd_pcm_sw_params_t *p_sw;
...@@ -391,7 +391,7 @@ static int Open (vlc_object_t *obj) ...@@ -391,7 +391,7 @@ static int Open (vlc_object_t *obj)
goto error; goto error;
} }
p_aout->output.output.i_format = fourcc; p_aout->format.i_format = fourcc;
val = snd_pcm_hw_params_set_access( p_sys->p_snd_pcm, p_hw, val = snd_pcm_hw_params_set_access( p_sys->p_snd_pcm, p_hw,
SND_PCM_ACCESS_RW_INTERLEAVED ); SND_PCM_ACCESS_RW_INTERLEAVED );
...@@ -412,9 +412,9 @@ static int Open (vlc_object_t *obj) ...@@ -412,9 +412,9 @@ static int Open (vlc_object_t *obj)
} }
/* Set rate. */ /* Set rate. */
unsigned old_rate = p_aout->output.output.i_rate; unsigned old_rate = p_aout->format.i_rate;
val = snd_pcm_hw_params_set_rate_near (p_sys->p_snd_pcm, p_hw, val = snd_pcm_hw_params_set_rate_near (p_sys->p_snd_pcm, p_hw,
&p_aout->output.output.i_rate, &p_aout->format.i_rate,
NULL); NULL);
if (val < 0) if (val < 0)
{ {
...@@ -422,9 +422,9 @@ static int Open (vlc_object_t *obj) ...@@ -422,9 +422,9 @@ static int Open (vlc_object_t *obj)
snd_strerror (val)); snd_strerror (val));
goto error; goto error;
} }
if (p_aout->output.output.i_rate != old_rate) if (p_aout->format.i_rate != old_rate)
msg_Warn (p_aout, "resampling from %d Hz to %d Hz", old_rate, msg_Warn (p_aout, "resampling from %d Hz to %d Hz", old_rate,
p_aout->output.output.i_rate); p_aout->format.i_rate);
/* Set period size. */ /* Set period size. */
val = snd_pcm_hw_params_set_period_size_near( p_sys->p_snd_pcm, p_hw, val = snd_pcm_hw_params_set_period_size_near( p_sys->p_snd_pcm, p_hw,
...@@ -435,7 +435,7 @@ static int Open (vlc_object_t *obj) ...@@ -435,7 +435,7 @@ static int Open (vlc_object_t *obj)
snd_strerror( val ) ); snd_strerror( val ) );
goto error; goto error;
} }
p_aout->output.i_nb_samples = i_period_size; p_aout->i_nb_samples = i_period_size;
/* Set buffer size. */ /* Set buffer size. */
val = snd_pcm_hw_params_set_buffer_size_near( p_sys->p_snd_pcm, p_hw, val = snd_pcm_hw_params_set_buffer_size_near( p_sys->p_snd_pcm, p_hw,
...@@ -469,7 +469,7 @@ static int Open (vlc_object_t *obj) ...@@ -469,7 +469,7 @@ static int Open (vlc_object_t *obj)
snd_pcm_sw_params_current( p_sys->p_snd_pcm, p_sw ); snd_pcm_sw_params_current( p_sys->p_snd_pcm, p_sw );
snd_pcm_sw_params_set_avail_min( p_sys->p_snd_pcm, p_sw, snd_pcm_sw_params_set_avail_min( p_sys->p_snd_pcm, p_sw,
p_aout->output.i_nb_samples ); p_aout->i_nb_samples );
/* start playing when one period has been written */ /* start playing when one period has been written */
val = snd_pcm_sw_params_set_start_threshold( p_sys->p_snd_pcm, p_sw, val = snd_pcm_sw_params_set_start_threshold( p_sys->p_snd_pcm, p_sw,
ALSA_DEFAULT_PERIOD_SIZE); ALSA_DEFAULT_PERIOD_SIZE);
...@@ -529,13 +529,13 @@ static void PlayIgnore( aout_instance_t *p_aout ) ...@@ -529,13 +529,13 @@ static void PlayIgnore( aout_instance_t *p_aout )
*****************************************************************************/ *****************************************************************************/
static void Play( aout_instance_t *p_aout ) static void Play( aout_instance_t *p_aout )
{ {
p_aout->output.pf_play = PlayIgnore; p_aout->pf_play = PlayIgnore;
/* get the playing date of the first aout buffer */ /* get the playing date of the first aout buffer */
p_aout->output.p_sys->start_date = aout_FifoFirstDate( &p_aout->output.fifo ); p_aout->sys->start_date = aout_FifoFirstDate( &p_aout->fifo );
/* wake up the audio output thread */ /* wake up the audio output thread */
sem_post( &p_aout->output.p_sys->wait ); sem_post( &p_aout->sys->wait );
} }
/***************************************************************************** /*****************************************************************************
...@@ -544,7 +544,7 @@ static void Play( aout_instance_t *p_aout ) ...@@ -544,7 +544,7 @@ static void Play( aout_instance_t *p_aout )
static void Close (vlc_object_t *obj) static void Close (vlc_object_t *obj)
{ {
aout_instance_t *p_aout = (aout_instance_t *)obj; aout_instance_t *p_aout = (aout_instance_t *)obj;
struct aout_sys_t * p_sys = p_aout->output.p_sys; struct aout_sys_t * p_sys = p_aout->sys;
/* Make sure that the thread will stop once it is waken up */ /* Make sure that the thread will stop once it is waken up */
vlc_cancel( p_sys->thread ); vlc_cancel( p_sys->thread );
...@@ -565,7 +565,7 @@ static void Close (vlc_object_t *obj) ...@@ -565,7 +565,7 @@ static void Close (vlc_object_t *obj)
static void* ALSAThread( void *data ) static void* ALSAThread( void *data )
{ {
aout_instance_t * p_aout = data; aout_instance_t * p_aout = data;
struct aout_sys_t * p_sys = p_aout->output.p_sys; struct aout_sys_t * p_sys = p_aout->sys;
/* Wait for the exact time to start playing (avoids resampling) */ /* Wait for the exact time to start playing (avoids resampling) */
vlc_sem_wait( &p_sys->wait ); vlc_sem_wait( &p_sys->wait );
...@@ -583,7 +583,7 @@ static void* ALSAThread( void *data ) ...@@ -583,7 +583,7 @@ static void* ALSAThread( void *data )
*****************************************************************************/ *****************************************************************************/
static void ALSAFill( aout_instance_t * p_aout ) static void ALSAFill( aout_instance_t * p_aout )
{ {
struct aout_sys_t * p_sys = p_aout->output.p_sys; struct aout_sys_t * p_sys = p_aout->sys;
snd_pcm_t *p_pcm = p_sys->p_snd_pcm; snd_pcm_t *p_pcm = p_sys->p_snd_pcm;
snd_pcm_status_t * p_status; snd_pcm_status_t * p_status;
int i_snd_rc; int i_snd_rc;
...@@ -635,9 +635,9 @@ static void ALSAFill( aout_instance_t * p_aout ) ...@@ -635,9 +635,9 @@ static void ALSAFill( aout_instance_t * p_aout )
size_t i_bytes = snd_pcm_frames_to_bytes( p_pcm, delay ); size_t i_bytes = snd_pcm_frames_to_bytes( p_pcm, delay );
mtime_t delay_us = CLOCK_FREQ * i_bytes mtime_t delay_us = CLOCK_FREQ * i_bytes
/ p_aout->output.output.i_bytes_per_frame / p_aout->format.i_bytes_per_frame
/ p_aout->output.output.i_rate / p_aout->format.i_rate
* p_aout->output.output.i_frame_length; * p_aout->format.i_frame_length;
#ifdef ALSA_DEBUG #ifdef ALSA_DEBUG
snd_pcm_state_t state = snd_pcm_status_get_state( p_status ); snd_pcm_state_t state = snd_pcm_status_get_state( p_status );
...@@ -646,16 +646,16 @@ static void ALSAFill( aout_instance_t * p_aout ) ...@@ -646,16 +646,16 @@ static void ALSAFill( aout_instance_t * p_aout )
msg_Dbg( p_aout, "Delay is %ld frames (%zu bytes)", delay, i_bytes ); msg_Dbg( p_aout, "Delay is %ld frames (%zu bytes)", delay, i_bytes );
msg_Dbg( p_aout, "Bytes per frame: %d", p_aout->output.output.i_bytes_per_frame ); msg_Dbg( p_aout, "Bytes per frame: %d", p_aout->format.i_bytes_per_frame );
msg_Dbg( p_aout, "Rate: %d", p_aout->output.output.i_rate ); msg_Dbg( p_aout, "Rate: %d", p_aout->format.i_rate );
msg_Dbg( p_aout, "Frame length: %d", p_aout->output.output.i_frame_length ); msg_Dbg( p_aout, "Frame length: %d", p_aout->format.i_frame_length );
msg_Dbg( p_aout, "Next date: in %"PRId64" microseconds", delay_us ); msg_Dbg( p_aout, "Next date: in %"PRId64" microseconds", delay_us );
#endif #endif
next_date = mdate() + delay_us; next_date = mdate() + delay_us;
} }
block_t *p_buffer = aout_OutputNextBuffer( p_aout, next_date, block_t *p_buffer = aout_OutputNextBuffer( p_aout, next_date,
(p_aout->output.output.i_format == VLC_CODEC_SPDIFL) ); (p_aout->format.i_format == VLC_CODEC_SPDIFL) );
/* Audio output buffer shortage -> stop the fill process and wait */ /* Audio output buffer shortage -> stop the fill process and wait */
if( p_buffer == NULL ) if( p_buffer == NULL )
......
...@@ -61,10 +61,10 @@ struct aout_sys_t ...@@ -61,10 +61,10 @@ struct aout_sys_t
static void Play (aout_instance_t *aout) static void Play (aout_instance_t *aout)
{ {
aout_sys_t *sys = aout->output.p_sys; aout_sys_t *sys = aout->sys;
block_t *block; block_t *block;
while ((block = aout_FifoPop(&aout->output.fifo)) != NULL) while ((block = aout_FifoPop(&aout->fifo)) != NULL)
{ {
sys->play (sys->opaque, block->p_buffer, block->i_nb_samples, sys->play (sys->opaque, block->p_buffer, block->i_nb_samples,
block->i_pts); block->i_pts);
...@@ -74,7 +74,7 @@ static void Play (aout_instance_t *aout) ...@@ -74,7 +74,7 @@ static void Play (aout_instance_t *aout)
static int VolumeSet (aout_instance_t *aout, float vol, bool mute) static int VolumeSet (aout_instance_t *aout, float vol, bool mute)
{ {
aout_sys_t *sys = aout->output.p_sys; aout_sys_t *sys = aout->sys;
return sys->set_volume (sys->opaque, vol, mute) ? -1 : 0; return sys->set_volume (sys->opaque, vol, mute) ? -1 : 0;
} }
...@@ -88,7 +88,7 @@ static int Open (vlc_object_t *obj) ...@@ -88,7 +88,7 @@ static int Open (vlc_object_t *obj)
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
return VLC_ENOMEM; return VLC_ENOMEM;
aout->output.p_sys = sys; aout->sys = sys;
sys->opaque = var_InheritAddress (obj, "amem-data"); sys->opaque = var_InheritAddress (obj, "amem-data");
sys->play = var_InheritAddress (obj, "amem-play"); sys->play = var_InheritAddress (obj, "amem-play");
sys->set_volume = var_InheritAddress (obj, "amem-set-volume"); sys->set_volume = var_InheritAddress (obj, "amem-set-volume");
...@@ -102,8 +102,8 @@ static int Open (vlc_object_t *obj) ...@@ -102,8 +102,8 @@ static int Open (vlc_object_t *obj)
if (setup != NULL) if (setup != NULL)
{ {
rate = aout->output.output.i_rate; rate = aout->format.i_rate;
channels = aout_FormatNbChannels(&aout->output.output); channels = aout_FormatNbChannels(&aout->format);
if (setup (&sys->opaque, format, &rate, &channels)) if (setup (&sys->opaque, format, &rate, &channels))
goto error; goto error;
...@@ -122,18 +122,18 @@ static int Open (vlc_object_t *obj) ...@@ -122,18 +122,18 @@ static int Open (vlc_object_t *obj)
/* TODO: amem-format */ /* TODO: amem-format */
/* FIXME/TODO channel mapping */ /* FIXME/TODO channel mapping */
if (strcmp(format, "S16N") || aout->output.output.i_channels != channels) if (strcmp(format, "S16N") || aout->format.i_channels != channels)
{ {
msg_Err (aout, "format not supported"); msg_Err (aout, "format not supported");
goto error; goto error;
} }
aout->output.output.i_format = VLC_CODEC_S16N; aout->format.i_format = VLC_CODEC_S16N;
aout->output.output.i_rate = rate; aout->format.i_rate = rate;
aout->output.pf_play = Play; aout->pf_play = Play;
aout->output.pf_pause = NULL; aout->pf_pause = NULL;
if (sys->set_volume != NULL) if (sys->set_volume != NULL)
aout->output.pf_volume_set = VolumeSet; aout->pf_volume_set = VolumeSet;
else else
aout_VolumeSoftInit (aout); aout_VolumeSoftInit (aout);
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -146,7 +146,7 @@ error: ...@@ -146,7 +146,7 @@ error:
static void Close (vlc_object_t *obj) static void Close (vlc_object_t *obj)
{ {
aout_instance_t *aout = (aout_instance_t *)obj; aout_instance_t *aout = (aout_instance_t *)obj;
aout_sys_t *sys = aout->output.p_sys; aout_sys_t *sys = aout->sys;
if (sys->cleanup != NULL) if (sys->cleanup != NULL)
sys->cleanup (sys->opaque); sys->cleanup (sys->opaque);
......
...@@ -78,7 +78,7 @@ static int Open ( vlc_object_t *p_this ) ...@@ -78,7 +78,7 @@ static int Open ( vlc_object_t *p_this )
{ {
aout_instance_t *p_aout = (aout_instance_t *)p_this; aout_instance_t *p_aout = (aout_instance_t *)p_this;
struct aout_sys_t *p_sys = malloc(sizeof(aout_sys_t)); struct aout_sys_t *p_sys = malloc(sizeof(aout_sys_t));
p_aout->output.p_sys = p_sys; p_aout->sys = p_sys;
OSStatus status = 0; OSStatus status = 0;
...@@ -118,12 +118,12 @@ static int Open ( vlc_object_t *p_this ) ...@@ -118,12 +118,12 @@ static int Open ( vlc_object_t *p_this )
/* Volume is entirely done in software. */ /* Volume is entirely done in software. */
aout_VolumeSoftInit( p_aout ); aout_VolumeSoftInit( p_aout );
p_aout->output.output.i_format = VLC_CODEC_S16L; p_aout->format.i_format = VLC_CODEC_S16L;
p_aout->output.output.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT; p_aout->format.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
p_aout->output.output.i_rate = 44100; p_aout->format.i_rate = 44100;
p_aout->output.i_nb_samples = FRAME_SIZE; p_aout->format.i_nb_samples = FRAME_SIZE;
p_aout->output.pf_play = Play; p_aout->format.pf_play = Play;
p_aout->output.pf_pause = NULL; p_aout->format.pf_pause = NULL;
msg_Dbg(p_aout, "Starting AudioQueue (status = %i)", status); msg_Dbg(p_aout, "Starting AudioQueue (status = %i)", status);
status = AudioQueueStart(p_sys->audioQueue, NULL); status = AudioQueueStart(p_sys->audioQueue, NULL);
...@@ -145,7 +145,7 @@ static void Play( aout_instance_t * p_aout ) ...@@ -145,7 +145,7 @@ static void Play( aout_instance_t * p_aout )
static void Close ( vlc_object_t *p_this ) static void Close ( vlc_object_t *p_this )
{ {
aout_instance_t *p_aout = (aout_instance_t *)p_this; aout_instance_t *p_aout = (aout_instance_t *)p_this;
struct aout_sys_t * p_sys = p_aout->output.p_sys; struct aout_sys_t * p_sys = p_aout->sys;
msg_Dbg(p_aout, "Stopping AudioQueue"); msg_Dbg(p_aout, "Stopping AudioQueue");
AudioQueueStop(p_sys->audioQueue, false); AudioQueueStop(p_sys->audioQueue, false);
...@@ -160,7 +160,7 @@ void AudioQueueCallback(void * inUserData, AudioQueueRef inAQ, AudioQueueBufferR ...@@ -160,7 +160,7 @@ void AudioQueueCallback(void * inUserData, AudioQueueRef inAQ, AudioQueueBufferR
if (p_aout) { if (p_aout) {
vlc_mutex_lock( &p_aout->lock ); vlc_mutex_lock( &p_aout->lock );
p_buffer = aout_FifoPop( &p_aout->output.fifo ); p_buffer = aout_FifoPop( &p_aout->fifo );
vlc_mutex_unlock( &p_aout->lock ); vlc_mutex_unlock( &p_aout->lock );
} }
......
...@@ -165,11 +165,11 @@ static int Open( vlc_object_t * p_this ) ...@@ -165,11 +165,11 @@ static int Open( vlc_object_t * p_this )
int b_alive = false; int b_alive = false;
/* Allocate structure */ /* Allocate structure */
p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) ); p_aout->sys = malloc( sizeof( aout_sys_t ) );
if( p_aout->output.p_sys == NULL ) if( p_aout->sys == NULL )
return VLC_ENOMEM; return VLC_ENOMEM;
p_sys = p_aout->output.p_sys; p_sys = p_aout->sys;
p_sys->i_default_dev = 0; p_sys->i_default_dev = 0;
p_sys->i_selected_dev = 0; p_sys->i_selected_dev = 0;
p_sys->i_devices = 0; p_sys->i_devices = 0;
...@@ -187,10 +187,10 @@ static int Open( vlc_object_t * p_this ) ...@@ -187,10 +187,10 @@ static int Open( vlc_object_t * p_this )
p_sys->b_changed_mixing = false; p_sys->b_changed_mixing = false;
memset( p_sys->p_remainder_buffer, 0, sizeof(uint8_t) * BUFSIZE ); memset( p_sys->p_remainder_buffer, 0, sizeof(uint8_t) * BUFSIZE );
p_aout->output.pf_play = Play; p_aout->pf_play = Play;
p_aout->output.pf_pause = NULL; p_aout->pf_pause = NULL;
aout_FormatPrint( p_aout, "VLC is looking for:", (audio_sample_format_t *)&p_aout->output.output ); aout_FormatPrint( p_aout, "VLC is looking for:", &p_aout->format );
/* Persistent device variable */ /* Persistent device variable */
if( var_Type( p_aout->p_libvlc, "macosx-audio-device" ) == 0 ) if( var_Type( p_aout->p_libvlc, "macosx-audio-device" ) == 0 )
...@@ -262,7 +262,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -262,7 +262,7 @@ static int Open( vlc_object_t * p_this )
} }
/* Check for Digital mode or Analog output mode */ /* Check for Digital mode or Analog output mode */
if( AOUT_FMT_NON_LINEAR( &p_aout->output.output ) && p_sys->b_supports_digital ) if( AOUT_FMT_NON_LINEAR( &p_aout->format ) && p_sys->b_supports_digital )
{ {
if( OpenSPDIF( p_aout ) ) if( OpenSPDIF( p_aout ) )
{ {
...@@ -292,7 +292,7 @@ error: ...@@ -292,7 +292,7 @@ error:
*****************************************************************************/ *****************************************************************************/
static int OpenAnalog( aout_instance_t *p_aout ) static int OpenAnalog( aout_instance_t *p_aout )
{ {
struct aout_sys_t *p_sys = p_aout->output.p_sys; struct aout_sys_t *p_sys = p_aout->sys;
OSStatus err = noErr; OSStatus err = noErr;
UInt32 i_param_size = 0; UInt32 i_param_size = 0;
int i_original; int i_original;
...@@ -390,18 +390,18 @@ static int OpenAnalog( aout_instance_t *p_aout ) ...@@ -390,18 +390,18 @@ static int OpenAnalog( aout_instance_t *p_aout )
msg_Dbg( p_aout, "layout of AUHAL has %d channels" , (int)layout->mNumberChannelDescriptions ); msg_Dbg( p_aout, "layout of AUHAL has %d channels" , (int)layout->mNumberChannelDescriptions );
/* Initialize the VLC core channel count */ /* Initialize the VLC core channel count */
p_aout->output.output.i_physical_channels = 0; p_aout->format.i_physical_channels = 0;
i_original = p_aout->output.output.i_original_channels & AOUT_CHAN_PHYSMASK; i_original = p_aout->format.i_original_channels & AOUT_CHAN_PHYSMASK;
if( i_original == AOUT_CHAN_CENTER || layout->mNumberChannelDescriptions < 2 ) if( i_original == AOUT_CHAN_CENTER || layout->mNumberChannelDescriptions < 2 )
{ {
/* We only need Mono or cannot output more than 1 channel */ /* We only need Mono or cannot output more than 1 channel */
p_aout->output.output.i_physical_channels = AOUT_CHAN_CENTER; p_aout->format.i_physical_channels = AOUT_CHAN_CENTER;
} }
else if( i_original == (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT) || layout->mNumberChannelDescriptions < 3 ) else if( i_original == (AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT) || layout->mNumberChannelDescriptions < 3 )
{ {
/* We only need Stereo or cannot output more than 2 channels */ /* We only need Stereo or cannot output more than 2 channels */
p_aout->output.output.i_physical_channels = AOUT_CHAN_RIGHT | AOUT_CHAN_LEFT; p_aout->format.i_physical_channels = AOUT_CHAN_RIGHT | AOUT_CHAN_LEFT;
} }
else else
{ {
...@@ -413,39 +413,39 @@ static int OpenAnalog( aout_instance_t *p_aout ) ...@@ -413,39 +413,39 @@ static int OpenAnalog( aout_instance_t *p_aout )
switch( layout->mChannelDescriptions[i].mChannelLabel ) switch( layout->mChannelDescriptions[i].mChannelLabel )
{ {
case kAudioChannelLabel_Left: case kAudioChannelLabel_Left:
p_aout->output.output.i_physical_channels |= AOUT_CHAN_LEFT; p_aout->format.i_physical_channels |= AOUT_CHAN_LEFT;
continue; continue;
case kAudioChannelLabel_Right: case kAudioChannelLabel_Right:
p_aout->output.output.i_physical_channels |= AOUT_CHAN_RIGHT; p_aout->format.i_physical_channels |= AOUT_CHAN_RIGHT;
continue; continue;
case kAudioChannelLabel_Center: case kAudioChannelLabel_Center:
p_aout->output.output.i_physical_channels |= AOUT_CHAN_CENTER; p_aout->format.i_physical_channels |= AOUT_CHAN_CENTER;
continue; continue;
case kAudioChannelLabel_LFEScreen: case kAudioChannelLabel_LFEScreen:
p_aout->output.output.i_physical_channels |= AOUT_CHAN_LFE; p_aout->format.i_physical_channels |= AOUT_CHAN_LFE;
continue; continue;
case kAudioChannelLabel_LeftSurround: case kAudioChannelLabel_LeftSurround:
p_aout->output.output.i_physical_channels |= AOUT_CHAN_REARLEFT; p_aout->format.i_physical_channels |= AOUT_CHAN_REARLEFT;
continue; continue;
case kAudioChannelLabel_RightSurround: case kAudioChannelLabel_RightSurround:
p_aout->output.output.i_physical_channels |= AOUT_CHAN_REARRIGHT; p_aout->format.i_physical_channels |= AOUT_CHAN_REARRIGHT;
continue; continue;
case kAudioChannelLabel_RearSurroundLeft: case kAudioChannelLabel_RearSurroundLeft:
p_aout->output.output.i_physical_channels |= AOUT_CHAN_MIDDLELEFT; p_aout->format.i_physical_channels |= AOUT_CHAN_MIDDLELEFT;
continue; continue;
case kAudioChannelLabel_RearSurroundRight: case kAudioChannelLabel_RearSurroundRight:
p_aout->output.output.i_physical_channels |= AOUT_CHAN_MIDDLERIGHT; p_aout->format.i_physical_channels |= AOUT_CHAN_MIDDLERIGHT;
continue; continue;
case kAudioChannelLabel_CenterSurround: case kAudioChannelLabel_CenterSurround:
p_aout->output.output.i_physical_channels |= AOUT_CHAN_REARCENTER; p_aout->format.i_physical_channels |= AOUT_CHAN_REARCENTER;
continue; continue;
default: default:
msg_Warn( p_aout, "unrecognized channel form provided by driver: %d", (int)layout->mChannelDescriptions[i].mChannelLabel ); msg_Warn( p_aout, "unrecognized channel form provided by driver: %d", (int)layout->mChannelDescriptions[i].mChannelLabel );
} }
} }
if( p_aout->output.output.i_physical_channels == 0 ) if( p_aout->format.i_physical_channels == 0 )
{ {
p_aout->output.output.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT; p_aout->format.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
msg_Err( p_aout, "You should configure your speaker layout with Audio Midi Setup Utility in /Applications/Utilities. Now using Stereo mode." ); msg_Err( p_aout, "You should configure your speaker layout with Audio Midi Setup Utility in /Applications/Utilities. Now using Stereo mode." );
dialog_Fatal( p_aout, _("Audio device is not configured"), "%s", dialog_Fatal( p_aout, _("Audio device is not configured"), "%s",
_("You should configure your speaker layout with " _("You should configure your speaker layout with "
...@@ -458,14 +458,14 @@ static int OpenAnalog( aout_instance_t *p_aout ) ...@@ -458,14 +458,14 @@ static int OpenAnalog( aout_instance_t *p_aout )
else else
{ {
msg_Warn( p_aout, "this driver does not support kAudioDevicePropertyPreferredChannelLayout. BAD DRIVER AUTHOR !!!" ); msg_Warn( p_aout, "this driver does not support kAudioDevicePropertyPreferredChannelLayout. BAD DRIVER AUTHOR !!!" );
p_aout->output.output.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT; p_aout->format.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT;
} }
msg_Dbg( p_aout, "selected %d physical channels for device output", aout_FormatNbChannels( &p_aout->output.output ) ); msg_Dbg( p_aout, "selected %d physical channels for device output", aout_FormatNbChannels( &p_aout->format ) );
msg_Dbg( p_aout, "VLC will output: %s", aout_FormatPrintChannels( &p_aout->output.output )); msg_Dbg( p_aout, "VLC will output: %s", aout_FormatPrintChannels( &p_aout->format ));
memset (&new_layout, 0, sizeof(new_layout)); memset (&new_layout, 0, sizeof(new_layout));
switch( aout_FormatNbChannels( &p_aout->output.output ) ) switch( aout_FormatNbChannels( &p_aout->format ) )
{ {
case 1: case 1:
new_layout.mChannelLayoutTag = kAudioChannelLayoutTag_Mono; new_layout.mChannelLayoutTag = kAudioChannelLayoutTag_Mono;
...@@ -474,41 +474,41 @@ static int OpenAnalog( aout_instance_t *p_aout ) ...@@ -474,41 +474,41 @@ static int OpenAnalog( aout_instance_t *p_aout )
new_layout.mChannelLayoutTag = kAudioChannelLayoutTag_Stereo;