Commit 6da485db authored by Thomas Guillem's avatar Thomas Guillem

coreaudio: move auhal specific code in auhal.c

refs #19949

(cherry picked from commit 796689c4)
Signed-off-by: Thomas Guillem's avatarThomas Guillem <thomas@gllm.fr>
parent 7b96c1e5
...@@ -477,7 +477,7 @@ Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt) ...@@ -477,7 +477,7 @@ Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
ca_LogWarn("failed to set IO mode"); ca_LogWarn("failed to set IO mode");
ret = au_Initialize(p_aout, p_sys->au_unit, fmt, layout, 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) if (ret != VLC_SUCCESS)
goto error; goto error;
......
...@@ -1037,7 +1037,9 @@ StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt, ...@@ -1037,7 +1037,9 @@ StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt,
"kAudioDevicePropertyPreferredChannelLayout - using stereo"); "kAudioDevicePropertyPreferredChannelLayout - using stereo");
/* Do the last VLC aout setups */ /* 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) if (ret != VLC_SUCCESS)
goto error; goto error;
...@@ -1054,6 +1056,19 @@ StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt, ...@@ -1054,6 +1056,19 @@ StartAnalog(audio_output_t *p_aout, audio_sample_format_t *fmt,
MuteSet(p_aout, p_sys->b_mute); MuteSet(p_aout, p_sys->b_mute);
free(layout); 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; return VLC_SUCCESS;
error: error:
AudioComponentInstanceDispose(p_sys->au_unit); AudioComponentInstanceDispose(p_sys->au_unit);
......
...@@ -398,7 +398,7 @@ GetLayoutDescription(audio_output_t *p_aout, ...@@ -398,7 +398,7 @@ GetLayoutDescription(audio_output_t *p_aout,
static int static int
MapOutputLayout(audio_output_t *p_aout, audio_sample_format_t *fmt, 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 */ /* Fill VLC physical_channels from output layout */
fmt->i_physical_channels = 0; fmt->i_physical_channels = 0;
...@@ -476,16 +476,8 @@ MapOutputLayout(audio_output_t *p_aout, audio_sample_format_t *fmt, ...@@ -476,16 +476,8 @@ MapOutputLayout(audio_output_t *p_aout, audio_sample_format_t *fmt,
if (fmt->i_physical_channels == 0) if (fmt->i_physical_channels == 0)
{ {
fmt->i_physical_channels = AOUT_CHANS_STEREO; fmt->i_physical_channels = AOUT_CHANS_STEREO;
msg_Err(p_aout, "You should configure your speaker layout with " if (warn_configuration)
"Audio Midi Setup in /Applications/Utilities. VLC will " *warn_configuration = true;
"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 (aout_FormatNbChannels(fmt) >= 8 if (aout_FormatNbChannels(fmt) >= 8
...@@ -701,18 +693,22 @@ SetupInputLayout(audio_output_t *p_aout, const audio_sample_format_t *fmt, ...@@ -701,18 +693,22 @@ SetupInputLayout(audio_output_t *p_aout, const audio_sample_format_t *fmt,
int int
au_Initialize(audio_output_t *p_aout, AudioUnit au, audio_sample_format_t *fmt, 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; int ret;
AudioChannelLayoutTag inlayout_tag; AudioChannelLayoutTag inlayout_tag;
if (warn_configuration)
*warn_configuration = false;
/* Set the desired format */ /* Set the desired format */
AudioStreamBasicDescription desc; AudioStreamBasicDescription desc;
if (aout_BitsPerSample(fmt->i_format) != 0) if (aout_BitsPerSample(fmt->i_format) != 0)
{ {
/* PCM */ /* PCM */
fmt->i_format = VLC_CODEC_FL32; fmt->i_format = VLC_CODEC_FL32;
ret = MapOutputLayout(p_aout, fmt, outlayout); ret = MapOutputLayout(p_aout, fmt, outlayout, warn_configuration);
if (ret != VLC_SUCCESS) if (ret != VLC_SUCCESS)
return ret; return ret;
......
...@@ -91,6 +91,7 @@ AudioUnit au_NewOutputInstance(audio_output_t *p_aout, OSType comp_sub_type); ...@@ -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, int au_Initialize(audio_output_t *p_aout, AudioUnit au,
audio_sample_format_t *fmt, 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); 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