mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-02 09:01:48 -05: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
|
|
@ -321,7 +321,6 @@ int _snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
|||
{
|
||||
snd_config_iterator_t i, next;
|
||||
long card = -1, device = 0, subdevice = -1;
|
||||
const char *str;
|
||||
int err;
|
||||
snd_config_for_each(i, next, conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
|
|
@ -331,15 +330,10 @@ int _snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
|||
if (snd_rawmidi_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)
|
||||
return -EINVAL;
|
||||
card = snd_card_get_index(str);
|
||||
if (card < 0)
|
||||
return card;
|
||||
}
|
||||
err = snd_config_get_card(n);
|
||||
if (err < 0)
|
||||
return err;
|
||||
card = err;
|
||||
continue;
|
||||
}
|
||||
if (strcmp(id, "device") == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue