mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
Extended parameterization. Marked with @ all fields with special use
This commit is contained in:
parent
cf325c68e3
commit
54daf2f16d
16 changed files with 315 additions and 349 deletions
|
|
@ -90,11 +90,11 @@ static int snd_seq_open_conf(snd_seq_t **seqp, const char *name,
|
|||
SNDERR("Invalid type for %s", snd_config_get_id(conf));
|
||||
return err;
|
||||
}
|
||||
err = snd_config_search_alias(snd_config, "seq_type", str, &type_conf);
|
||||
err = snd_config_search_definition(snd_config, "seq_type", str, &type_conf);
|
||||
if (err >= 0) {
|
||||
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for SEQ type %s definition", str);
|
||||
return -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
snd_config_for_each(i, next, type_conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
|
|
@ -105,7 +105,7 @@ static int snd_seq_open_conf(snd_seq_t **seqp, const char *name,
|
|||
err = snd_config_get_string(n, &lib);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
@ -113,11 +113,13 @@ static int snd_seq_open_conf(snd_seq_t **seqp, const char *name,
|
|||
err = snd_config_get_string(n, &open_name);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
_err:
|
||||
snd_config_delete(type_conf);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
|
@ -128,11 +130,14 @@ static int snd_seq_open_conf(snd_seq_t **seqp, const char *name,
|
|||
if (!lib)
|
||||
lib = ALSA_LIB;
|
||||
h = dlopen(lib, RTLD_NOW);
|
||||
if (h)
|
||||
open_func = dlsym(h, open_name);
|
||||
if (type_conf)
|
||||
snd_config_delete(type_conf);
|
||||
if (!h) {
|
||||
SNDERR("Cannot open shared library %s", lib);
|
||||
return -ENOENT;
|
||||
}
|
||||
open_func = dlsym(h, open_name);
|
||||
if (!open_func) {
|
||||
SNDERR("symbol %s is not defined inside %s", open_name, lib);
|
||||
dlclose(h);
|
||||
|
|
@ -146,42 +151,9 @@ static int snd_seq_open_noupdate(snd_seq_t **seqp, snd_config_t *root,
|
|||
{
|
||||
int err;
|
||||
snd_config_t *seq_conf;
|
||||
char *base, *key;
|
||||
const char *args = strchr(name, ':');
|
||||
|
||||
if (args) {
|
||||
args++;
|
||||
base = alloca(args - name);
|
||||
memcpy(base, name, args - name - 1);
|
||||
base[args - name - 1] = '\0';
|
||||
key = strchr(base, '.');
|
||||
if (key)
|
||||
*key++ = '\0';
|
||||
} else {
|
||||
key = strchr(name, '.');
|
||||
if (key) {
|
||||
key++;
|
||||
base = alloca(key - name);
|
||||
memcpy(base, name, key - name - 1);
|
||||
base[key - name - 1] = '\0';
|
||||
} else
|
||||
base = (char *) name;
|
||||
}
|
||||
if (key == NULL) {
|
||||
key = base;
|
||||
base = NULL;
|
||||
}
|
||||
err = snd_config_search_alias(root, base, key, &seq_conf);
|
||||
err = snd_config_search_definition(root, "seq", name, &seq_conf);
|
||||
if (err < 0) {
|
||||
(void)(base == NULL && (err = snd_config_search_alias(root, "seq", key, &seq_conf)));
|
||||
if (err < 0) {
|
||||
SNDERR("Unknown PCM %s", name);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
err = snd_config_expand(seq_conf, args, NULL, &seq_conf);
|
||||
if (err < 0) {
|
||||
SNDERR("Could not expand configuration for %s: %s", name, snd_strerror(err));
|
||||
SNDERR("Unknown SEQ %s", name);
|
||||
return err;
|
||||
}
|
||||
err = snd_seq_open_conf(seqp, name, seq_conf, streams, mode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue