Commit 796689c4 authored by Thomas Guillem's avatar Thomas Guillem

coreaudio: move auhal specific code in auhal.c

refs #19949
parent 8e426b90
......@@ -476,7 +476,7 @@ Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
ca_LogWarn("failed to set IO mode");
ret = au_Initialize(p_aout, p_sys->au_unit, fmt, layout,
[p_sys->avInstance outputLatency] * CLOCK_FREQ);
[p_sys->avInstance outputLatency] * CLOCK_FREQ, NULL);
if (ret != VLC_SUCCESS)
goto error;
......
......@@ -1036,7 +1036,9 @@ StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt,
"kAudioDevicePropertyPreferredChannelLayout - using stereo");
/* Do the last VLC aout setups */
int ret = au_Initialize(p_aout, p_sys->au_unit, fmt, layout, i_latency_us);
bool warn_configuration;
int ret = au_Initialize(p_aout, p_sys->au_unit, fmt, layout, i_latency_us,
&warn_configuration);
if (ret != VLC_SUCCESS)
goto error;
......@@ -1053,6 +1055,19 @@ StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt,
MuteSet(p_aout, p_sys->b_mute);
free(layout);
if (warn_configuration)
{
msg_Err(p_aout, "You should configure your speaker layout with "
"Audio Midi Setup in /Applications/Utilities. VLC will "
"output Stereo only.");
vlc_dialog_display_error(p_aout,
_("Audio device is not configured"), "%s",
_("You should configure your speaker layout with "
"\"Audio Midi Setup\" in /Applications/"
"Utilities. VLC will output Stereo only."));
}
return VLC_SUCCESS;
error:
AudioComponentInstanceDispose(p_sys->au_unit);
......
......@@ -399,7 +399,7 @@ GetLayoutDescription(audio_output_t *p_aout,
static int
MapOutputLayout(audio_output_t *p_aout, audio_sample_format_t *fmt,
const AudioChannelLayout *outlayout)
const AudioChannelLayout *outlayout, bool *warn_configuration)
{
/* Fill VLC physical_channels from output layout */
fmt->i_physical_channels = 0;
......@@ -477,16 +477,8 @@ MapOutputLayout(audio_output_t *p_aout, audio_sample_format_t *fmt,
if (fmt->i_physical_channels == 0)
{
fmt->i_physical_channels = AOUT_CHANS_STEREO;
msg_Err(p_aout, "You should configure your speaker layout with "
"Audio Midi Setup in /Applications/Utilities. VLC will "
"output Stereo only.");
#if !TARGET_OS_IPHONE
vlc_dialog_display_error(p_aout,
_("Audio device is not configured"), "%s",
_("You should configure your speaker layout with "
"\"Audio Midi Setup\" in /Applications/"
"Utilities. VLC will output Stereo only."));
#endif
if (warn_configuration)
*warn_configuration = true;
}
}
......@@ -682,18 +674,22 @@ SetupInputLayout(audio_output_t *p_aout, const audio_sample_format_t *fmt,
int
au_Initialize(audio_output_t *p_aout, AudioUnit au, audio_sample_format_t *fmt,
const AudioChannelLayout *outlayout, mtime_t i_dev_latency_us)
const AudioChannelLayout *outlayout, mtime_t i_dev_latency_us,
bool *warn_configuration)
{
int ret;
AudioChannelLayoutTag inlayout_tag;
if (warn_configuration)
*warn_configuration = false;
/* Set the desired format */
AudioStreamBasicDescription desc;
if (aout_BitsPerSample(fmt->i_format) != 0)
{
/* PCM */
fmt->i_format = VLC_CODEC_FL32;
ret = MapOutputLayout(p_aout, fmt, outlayout);
ret = MapOutputLayout(p_aout, fmt, outlayout, warn_configuration);
if (ret != VLC_SUCCESS)
return ret;
......
......@@ -91,6 +91,7 @@ AudioUnit au_NewOutputInstance(audio_output_t *p_aout, OSType comp_sub_type);
int au_Initialize(audio_output_t *p_aout, AudioUnit au,
audio_sample_format_t *fmt,
const AudioChannelLayout *outlayout, mtime_t i_dev_latency_us);
const AudioChannelLayout *outlayout, mtime_t i_dev_latency_us,
bool *warn_configuration);
void au_Uninitialize(audio_output_t *p_aout, AudioUnit au);
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