mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-03 09:01:52 -05:00
ucm: Set default include path
Many UCM profiles include the UCM profile components under ucm/* subdirectories and thusly put <searchdir:ucm> at each place. This is rather cumbersome. This patch makes the UCM parser to set the default include path, so that each profile no longer needs to set searchdir. All the <searchdir:ucm> lines currently found in the profiles are removed gracefully, too. For the needed implementation, a new helper, _snd_config_load_with_include() is introduced. It's not exported, only for the use inside alsa-lib. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
d48adc2a20
commit
c9fcf98369
23 changed files with 41 additions and 25 deletions
|
|
@ -34,9 +34,6 @@
|
|||
#include <dirent.h>
|
||||
#include <limits.h>
|
||||
|
||||
/** The name of the environment variable containing the UCM directory */
|
||||
#define ALSA_CONFIG_UCM_VAR "ALSA_CONFIG_UCM"
|
||||
|
||||
/* Directories to store UCM configuration files for components, like
|
||||
* off-soc codecs or embedded DSPs. Components can define their own
|
||||
* devices and sequences, to be reused by sound cards/machines. UCM
|
||||
|
|
|
|||
|
|
@ -243,3 +243,6 @@ void uc_mgr_free_sequence_element(struct sequence_element *seq);
|
|||
void uc_mgr_free_transition_element(struct transition_sequence *seq);
|
||||
void uc_mgr_free_verb(snd_use_case_mgr_t *uc_mgr);
|
||||
void uc_mgr_free(snd_use_case_mgr_t *uc_mgr);
|
||||
|
||||
/** The name of the environment variable containing the UCM directory */
|
||||
#define ALSA_CONFIG_UCM_VAR "ALSA_CONFIG_UCM"
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ int uc_mgr_config_load(const char *file, snd_config_t **cfg)
|
|||
FILE *fp;
|
||||
snd_input_t *in;
|
||||
snd_config_t *top;
|
||||
const char *default_path;
|
||||
int err;
|
||||
|
||||
fp = fopen(file, "r");
|
||||
|
|
@ -70,7 +71,11 @@ int uc_mgr_config_load(const char *file, snd_config_t **cfg)
|
|||
err = snd_config_top(&top);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = snd_config_load(top, in);
|
||||
|
||||
default_path = getenv(ALSA_CONFIG_UCM_VAR);
|
||||
if (!default_path || !*default_path)
|
||||
default_path = ALSA_CONFIG_DIR "/ucm";
|
||||
err = _snd_config_load_with_include(top, in, default_path);
|
||||
if (err < 0) {
|
||||
uc_error("could not load configuration file %s", file);
|
||||
snd_config_delete(top);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue