mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
conf: introduce snd_config_get_card() function
It's helper for the "card" entries parsing. It reduces the code in most of open_hw functions. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
b9a4997e92
commit
19ad9bdc49
9 changed files with 59 additions and 83 deletions
|
|
@ -1816,21 +1816,10 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (snd_pcm_conf_generic_id(id))
|
||||
continue;
|
||||
if (strcmp(id, "card") == 0) {
|
||||
err = snd_config_get_integer(n, &card);
|
||||
if (err < 0) {
|
||||
err = snd_config_get_string(n, &str);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
err = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
card = snd_card_get_index(str);
|
||||
if (card < 0) {
|
||||
SNDERR("Invalid value for %s", id);
|
||||
err = card;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
err = snd_config_get_card(n);
|
||||
if (err < 0)
|
||||
goto fail;
|
||||
card = err;
|
||||
continue;
|
||||
}
|
||||
if (strcmp(id, "device") == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue