mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-02-06 04:06:34 -05:00
ucm: configuration - implement in-place Include
An example:
Include {
File "Inc.conf"
Before.SectionDevice "Mic"
}
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
14636be4a8
commit
3edfebc522
6 changed files with 375 additions and 168 deletions
|
|
@ -246,12 +246,28 @@ __nomem:
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
const char *uc_mgr_config_dir(int format)
|
||||
{
|
||||
const char *path;
|
||||
|
||||
if (format >= 2) {
|
||||
path = getenv(ALSA_CONFIG_UCM2_VAR);
|
||||
if (!path || path[0] == '\0')
|
||||
path = ALSA_CONFIG_DIR "/ucm2";
|
||||
} else {
|
||||
path = getenv(ALSA_CONFIG_UCM_VAR);
|
||||
if (!path || path[0] == '\0')
|
||||
path = ALSA_CONFIG_DIR "/ucm";
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
int uc_mgr_config_load(int format, const char *file, snd_config_t **cfg)
|
||||
{
|
||||
FILE *fp;
|
||||
snd_input_t *in;
|
||||
snd_config_t *top;
|
||||
const char *path, *default_paths[2];
|
||||
const char *default_paths[2];
|
||||
int err;
|
||||
|
||||
fp = fopen(file, "r");
|
||||
|
|
@ -268,17 +284,7 @@ int uc_mgr_config_load(int format, const char *file, snd_config_t **cfg)
|
|||
if (err < 0)
|
||||
goto __err1;
|
||||
|
||||
if (format >= 2) {
|
||||
path = getenv(ALSA_CONFIG_UCM2_VAR);
|
||||
if (!path || path[0] == '\0')
|
||||
path = ALSA_CONFIG_DIR "/ucm2";
|
||||
} else {
|
||||
path = getenv(ALSA_CONFIG_UCM_VAR);
|
||||
if (!path || path[0] == '\0')
|
||||
path = ALSA_CONFIG_DIR "/ucm";
|
||||
}
|
||||
|
||||
default_paths[0] = path;
|
||||
default_paths[0] = uc_mgr_config_dir(format);
|
||||
default_paths[1] = NULL;
|
||||
err = _snd_config_load_with_include(top, in, 0, default_paths);
|
||||
if (err < 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue