mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
namehint: list card independent devices only once
Card-independent devices such as "null" or "pulse" should only be added once, not once for each card. Signed-off-by: John Lindgren <john.lindgren@tds.net>\ Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
0fcac21756
commit
407e98b4c3
1 changed files with 24 additions and 4 deletions
|
|
@ -457,10 +457,6 @@ static int add_card(struct hint_list *list, int card)
|
|||
list->device = -1;
|
||||
err = try_config(list, list->siface, str);
|
||||
}
|
||||
if (err < 0) {
|
||||
list->card = -1;
|
||||
err = try_config(list, list->siface, str);
|
||||
}
|
||||
if (err == -ENOMEM)
|
||||
goto __error;
|
||||
}
|
||||
|
|
@ -486,6 +482,29 @@ static int get_card_name(struct hint_list *list, int card)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int add_software_devices(struct hint_list *list)
|
||||
{
|
||||
int err;
|
||||
snd_config_t *conf, *n;
|
||||
snd_config_iterator_t i, next;
|
||||
const char *str;
|
||||
|
||||
err = snd_config_search(snd_config, list->siface, &conf);
|
||||
if (err < 0)
|
||||
return err;
|
||||
snd_config_for_each(i, next, conf) {
|
||||
n = snd_config_iterator_entry(i);
|
||||
if (snd_config_get_id(n, &str) < 0)
|
||||
continue;
|
||||
list->card = -1;
|
||||
list->device = -1;
|
||||
err = try_config(list, list->siface, str);
|
||||
if (err == -ENOMEM)
|
||||
return -ENOMEM;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return string list with device name hints.
|
||||
* \param card Card number or -1 (means all cards)
|
||||
|
|
@ -549,6 +568,7 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
|
|||
if (err >= 0)
|
||||
err = add_card(&list, card);
|
||||
} else {
|
||||
add_software_devices(&list);
|
||||
err = snd_card_next(&card);
|
||||
if (err < 0)
|
||||
goto __error;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue