Commit dd306ec4 authored by David Fuhrmann's avatar David Fuhrmann

auhal: fix device setup when no spidf available

refs #8286
parent 39c57090
...@@ -233,6 +233,8 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt) ...@@ -233,6 +233,8 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
* property size */ * property size */
int b_alive = false; int b_alive = false;
bool b_start_digital = false;
p_sys = p_aout->sys; p_sys = p_aout->sys;
p_sys->b_digital = false; p_sys->b_digital = false;
p_sys->au_component = NULL; p_sys->au_component = NULL;
...@@ -247,9 +249,6 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt) ...@@ -247,9 +249,6 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
aout_FormatPrint(p_aout, "VLC is looking for:", fmt); aout_FormatPrint(p_aout, "VLC is looking for:", fmt);
if (p_sys->b_selected_dev_is_digital)
msg_Dbg(p_aout, "audio device supports digital output");
msg_Dbg(p_aout, "attempting to use device %i", p_sys->i_selected_dev); msg_Dbg(p_aout, "attempting to use device %i", p_sys->i_selected_dev);
/* Check if the desired device is alive and usable */ /* Check if the desired device is alive and usable */
...@@ -267,10 +266,19 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt) ...@@ -267,10 +266,19 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
} }
if (!b_alive) { if (!b_alive) {
msg_Warn(p_aout, "selected audio device is not alive, switching to default device"); msg_Warn(p_aout, "selected audio device is not alive, switching to default device with id %i", p_sys->i_default_dev);
p_sys->i_selected_dev = p_sys->i_default_dev; p_sys->i_selected_dev = p_sys->i_default_dev;
p_sys->b_selected_dev_is_digital = false;
} }
// recheck if device still supports digital
b_start_digital = p_sys->b_selected_dev_is_digital;
if(!AudioDeviceSupportsDigital(p_aout, p_sys->i_selected_dev))
b_start_digital = false;
if (b_start_digital)
msg_Dbg(p_aout, "Use audio device for digital output");
/* add a callback to see if the device dies later on */ /* add a callback to see if the device dies later on */
err = AudioObjectAddPropertyListener(p_sys->i_selected_dev, &audioDeviceAliveAddress, HardwareListener, (void *)p_aout); err = AudioObjectAddPropertyListener(p_sys->i_selected_dev, &audioDeviceAliveAddress, HardwareListener, (void *)p_aout);
if (err != noErr) { if (err != noErr) {
...@@ -302,7 +310,7 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt) ...@@ -302,7 +310,7 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
bool b_success = false; bool b_success = false;
/* Check for Digital mode or Analog output mode */ /* Check for Digital mode or Analog output mode */
if (AOUT_FMT_SPDIF (fmt) && p_sys->b_selected_dev_is_digital) { if (AOUT_FMT_SPDIF (fmt) && b_start_digital) {
if (StartSPDIF (p_aout, fmt)) { if (StartSPDIF (p_aout, fmt)) {
msg_Dbg(p_aout, "digital output successfully opened"); msg_Dbg(p_aout, "digital output successfully opened");
b_success = true; b_success = true;
......
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