[vlc-commits] auhal: fix device setup when no spidf available
David Fuhrmann
git at videolan.org
Fri Apr 5 21:01:00 CEST 2013
vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Fri Apr 5 20:36:09 2013 +0200| [dd306ec4c4619ab97e54bd797c0d3dbcd6e51b16] | committer: David Fuhrmann
auhal: fix device setup when no spidf available
refs #8286
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dd306ec4c4619ab97e54bd797c0d3dbcd6e51b16
---
modules/audio_output/auhal.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index 462b14d..b520dc6 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -233,6 +233,8 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
* property size */
int b_alive = false;
+ bool b_start_digital = false;
+
p_sys = p_aout->sys;
p_sys->b_digital = false;
p_sys->au_component = NULL;
@@ -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);
- 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);
/* 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)
}
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->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 */
err = AudioObjectAddPropertyListener(p_sys->i_selected_dev, &audioDeviceAliveAddress, HardwareListener, (void *)p_aout);
if (err != noErr) {
@@ -302,7 +310,7 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
bool b_success = false;
/* 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)) {
msg_Dbg(p_aout, "digital output successfully opened");
b_success = true;
More information about the vlc-commits
mailing list