Commit 07b5873d authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* workaround for device drivers that do not support "kAudioDevicePropertyPreferredChannelLayout".

  Grmbl @ Digidesign coders...
parent b05d7cdf
...@@ -292,40 +292,49 @@ static int OpenAnalog( aout_instance_t *p_aout ) ...@@ -292,40 +292,49 @@ static int OpenAnalog( aout_instance_t *p_aout )
} }
err = OpenAComponent( p_sys->au_component, &p_sys->au_unit ); err = OpenAComponent( p_sys->au_component, &p_sys->au_unit );
if( err ) if( err != noErr )
{ {
msg_Warn( p_aout, "we cannot open our HAL component" ); msg_Warn( p_aout, "we cannot open our HAL component" );
return VLC_FALSE; return VLC_FALSE;
} }
/* Set the device we will use for this output unit */ /* Set the device we will use for this output unit */
verify_noerr( AudioUnitSetProperty( p_sys->au_unit, err = AudioUnitSetProperty( p_sys->au_unit,
kAudioOutputUnitProperty_CurrentDevice, kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Global, kAudioUnitScope_Global,
0, 0,
&p_sys->i_selected_dev, &p_sys->i_selected_dev,
sizeof( AudioDeviceID ))); sizeof( AudioDeviceID ));
if( err != noErr )
{
msg_Warn( p_aout, "we cannot select the audio device" );
return VLC_FALSE;
}
/* Get the current format */ /* Get the current format */
i_param_size = sizeof(AudioStreamBasicDescription); i_param_size = sizeof(AudioStreamBasicDescription);
verify_noerr( AudioUnitGetProperty( p_sys->au_unit, err = AudioUnitGetProperty( p_sys->au_unit,
kAudioUnitProperty_StreamFormat, kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input, kAudioUnitScope_Input,
0, 0,
&DeviceFormat, &DeviceFormat,
&i_param_size )); &i_param_size );
msg_Dbg( p_aout, STREAM_FORMAT_MSG( "current format is: ", DeviceFormat ) ); if( err != noErr ) return VLC_FALSE;
else msg_Dbg( p_aout, STREAM_FORMAT_MSG( "current format is: ", DeviceFormat ) );
/* Get the channel layout of the device side of the unit (vlc -> unit -> device) */ /* Get the channel layout of the device side of the unit (vlc -> unit -> device) */
verify_noerr( AudioUnitGetPropertyInfo( p_sys->au_unit, err = AudioUnitGetPropertyInfo( p_sys->au_unit,
kAudioDevicePropertyPreferredChannelLayout, kAudioDevicePropertyPreferredChannelLayout,
kAudioUnitScope_Output, kAudioUnitScope_Output,
0, 0,
&i_param_size, &i_param_size,
NULL )); NULL );
if( err == noErr )
{
layout = (AudioChannelLayout *)malloc( i_param_size); layout = (AudioChannelLayout *)malloc( i_param_size);
verify_noerr( AudioUnitGetProperty( p_sys->au_unit, verify_noerr( AudioUnitGetProperty( p_sys->au_unit,
...@@ -416,6 +425,12 @@ static int OpenAnalog( aout_instance_t *p_aout ) ...@@ -416,6 +425,12 @@ static int OpenAnalog( aout_instance_t *p_aout )
} }
} }
if( layout ) free( layout ); if( layout ) free( layout );
}
else
{
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;
}
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->output.output ) );
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->output.output ));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment