Added snd_config_hook_load_for_all_cards.

Added private_data parameter for snd_config_hooks function.
Fixed the return value mess in the config parser routines.
The include file could begin with 'confdir:' which is replaced with /usr/share/alsa.
The snd_config_search_definitions looks for raw name at first (without suggested root).
Added snd_func_private_card_strtype function.
All configuration files moved to the src/conf directory.
Configuration files modified to use load-on-demand feature using hooks.
This commit is contained in:
Jaroslav Kysela 2001-06-21 13:41:50 +00:00
parent be5529bc3a
commit bc581b87ae
24 changed files with 909 additions and 199 deletions

View file

@ -428,39 +428,16 @@ static int string_from_integer(char **dst, long v)
}
#endif
int snd_func_card_strtype(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
int snd_func_private_card_strtype(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src, void *private_data)
{
snd_config_t *n;
char *res = NULL;
char *str;
snd_ctl_t *ctl = NULL;
snd_ctl_card_info_t *info;
long v;
int err;
err = snd_config_search(src, "card", &n);
if (err < 0) {
SNDERR("field card not found");
goto __error;
}
err = snd_config_evaluate(n, root, private_data, NULL);
if (err < 0) {
SNDERR("error evaluating card");
goto __error;
}
err = snd_config_get_ascii(n, &str);
if (err < 0) {
SNDERR("field card is not an integer or a string");
goto __error;
}
v = snd_card_get_index(str);
if (v < 0) {
SNDERR("cannot find card '%s'", str);
free(str);
err = v;
goto __error;
}
free(str);
v = (long)private_data;
assert(v >= 0 && v <= 32);
err = open_ctl(v, &ctl);
if (err < 0) {
SNDERR("could not open control for card %li", v);
@ -487,6 +464,38 @@ int snd_func_card_strtype(snd_config_t **dst, snd_config_t *root, snd_config_t *
return err;
}
int snd_func_card_strtype(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{
snd_config_t *n;
char *str;
long v;
int err;
err = snd_config_search(src, "card", &n);
if (err < 0) {
SNDERR("field card not found");
return err;
}
err = snd_config_evaluate(n, root, private_data, NULL);
if (err < 0) {
SNDERR("error evaluating card");
return err;
}
err = snd_config_get_ascii(n, &str);
if (err < 0) {
SNDERR("field card is not an integer or a string");
return err;
}
v = snd_card_get_index(str);
if (v < 0) {
SNDERR("cannot find card '%s'", str);
free(str);
return v;
}
free(str);
return snd_func_private_card_strtype(dst, root, src, (void *)v);
}
int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{
snd_config_t *n;