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 )
}
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" );
return VLC_FALSE;
}
/* 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,
kAudioUnitScope_Global,
0,
&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 */
i_param_size = sizeof(AudioStreamBasicDescription);
verify_noerr( AudioUnitGetProperty( p_sys->au_unit,
err = AudioUnitGetProperty( p_sys->au_unit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
0,
&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) */
verify_noerr( AudioUnitGetPropertyInfo( p_sys->au_unit,
err = AudioUnitGetPropertyInfo( p_sys->au_unit,
kAudioDevicePropertyPreferredChannelLayout,
kAudioUnitScope_Output,
0,
&i_param_size,
NULL ));
NULL );
if( err == noErr )
{
layout = (AudioChannelLayout *)malloc( i_param_size);
verify_noerr( AudioUnitGetProperty( p_sys->au_unit,
......@@ -416,6 +425,12 @@ static int OpenAnalog( aout_instance_t *p_aout )
}
}
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, "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