summaryrefslogtreecommitdiff
path: root/topology/pre-processor.c
diff options
context:
space:
mode:
Diffstat (limited to 'topology/pre-processor.c')
-rw-r--r--topology/pre-processor.c57
1 files changed, 34 insertions, 23 deletions
diff --git a/topology/pre-processor.c b/topology/pre-processor.c
index dfe3ad6..38bb87b 100644
--- a/topology/pre-processor.c
+++ b/topology/pre-processor.c
@@ -504,30 +504,39 @@ static int pre_process_include_conf(struct tplg_pre_processor *tplg_pp, snd_conf
if (ret)
continue;
- /* regex matched. now include the conf file */
- ret = snd_config_get_string(n, &filename);
- if (ret < 0)
- goto err;
-
- if (filename && filename[0] != '/')
- full_path = tplg_snprintf("%s/%s", tplg_pp->inc_path, filename);
- else
- full_path = tplg_snprintf("%s", filename);
-
- ret = snd_input_stdio_open(&in, full_path, "r");
- if (ret < 0) {
- fprintf(stderr, "Unable to open included conf file %s\n", full_path);
+ /* regex matched. now include or use the configuration */
+ if (snd_config_get_type(n) == SND_CONFIG_TYPE_COMPOUND) {
+ /* configuration block */
+ ret = snd_config_merge(*new, n, 0);
+ if (ret < 0) {
+ fprintf(stderr, "Unable to merge key '%s'\n", value);
+ goto err;
+ }
+ } else {
+ ret = snd_config_get_string(n, &filename);
+ if (ret < 0)
+ goto err;
+
+ if (filename && filename[0] != '/')
+ full_path = tplg_snprintf("%s/%s", tplg_pp->inc_path, filename);
+ else
+ full_path = tplg_snprintf("%s", filename);
+
+ ret = snd_input_stdio_open(&in, full_path, "r");
+ if (ret < 0) {
+ fprintf(stderr, "Unable to open included conf file %s\n", full_path);
+ free(full_path);
+ goto err;
+ }
free(full_path);
- goto err;
- }
- free(full_path);
- /* load config */
- ret = snd_config_load(*new, in);
- snd_input_close(in);
- if (ret < 0) {
- fprintf(stderr, "Unable to load included configuration\n");
- goto err;
+ /* load config */
+ ret = snd_config_load(*new, in);
+ snd_input_close(in);
+ if (ret < 0) {
+ fprintf(stderr, "Unable to load included configuration\n");
+ goto err;
+ }
}
/* forcefully overwrite with defines from the command line */
@@ -538,7 +547,9 @@ static int pre_process_include_conf(struct tplg_pre_processor *tplg_pp, snd_conf
}
/* recursively process any nested includes */
- return pre_process_includes(tplg_pp, *new);
+ ret = pre_process_includes(tplg_pp, *new);
+ if (ret < 0)
+ goto err;
}
err: