diff options
-rw-r--r-- | audio/hdmi_audio_hw.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/audio/hdmi_audio_hw.c b/audio/hdmi_audio_hw.c index cd44aec..18b9f6f 100644 --- a/audio/hdmi_audio_hw.c +++ b/audio/hdmi_audio_hw.c | |||
@@ -297,12 +297,28 @@ int hdmi_out_set_volume(struct audio_stream_out *stream, float left, float right | |||
297 | 297 | ||
298 | static int hdmi_out_find_card(void) | 298 | static int hdmi_out_find_card(void) |
299 | { | 299 | { |
300 | /* XXX TODO: Dynamically detect HDMI card | 300 | char name[256] = ""; |
301 | * If another audio device is present at boot time (e.g. | 301 | int card = 0; |
302 | * USB Audio device) then it might take the card #1 | 302 | int found = 0; |
303 | * position, putting HDMI on card #2. | 303 | |
304 | */ | 304 | do { |
305 | return 1; | 305 | /* return an error after last valid card */ |
306 | int ret = mixer_get_card_name(card, name, sizeof(name)); | ||
307 | if (ret) | ||
308 | break; | ||
309 | |||
310 | if (strstr(name, "HDMI") || strstr(name, "hdmi")) { | ||
311 | TRACEM("HDMI card '%s' found at %d", name, card); | ||
312 | found = 1; | ||
313 | break; | ||
314 | } | ||
315 | } while (card++ < MAX_CARD_COUNT); | ||
316 | |||
317 | /* Use default card number if not found */ | ||
318 | if (!found) | ||
319 | card = 1; | ||
320 | |||
321 | return card; | ||
306 | } | 322 | } |
307 | 323 | ||
308 | static int hdmi_out_open_pcm(hdmi_out_t *out) | 324 | static int hdmi_out_open_pcm(hdmi_out_t *out) |