ucm: substitute the merged tree completely

We need to define the common shared configuration like for multiple
HDMI devices or so. Substitute the whole merged configuration tree
including identifiers.

Fixes: https://github.com/alsa-project/alsa-lib/issues/67
Fixes: dcef48f13d
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2020-07-06 16:34:33 +02:00
parent 30d12e930c
commit 32addac948
4 changed files with 66 additions and 4 deletions

View file

@ -206,7 +206,8 @@ static int compound_merge(const char *id,
return 0;
}
int uc_mgr_config_tree_merge(snd_config_t *parent, snd_config_t *new_ctx,
int uc_mgr_config_tree_merge(snd_use_case_mgr_t *uc_mgr,
snd_config_t *parent, snd_config_t *new_ctx,
snd_config_t *before, snd_config_t *after)
{
snd_config_iterator_t i, next;
@ -214,6 +215,10 @@ int uc_mgr_config_tree_merge(snd_config_t *parent, snd_config_t *new_ctx,
const char *id;
int err;
err = uc_mgr_substitute_tree(uc_mgr, new_ctx);
if (err < 0)
return err;
snd_config_for_each(i, next, new_ctx) {
n = snd_config_iterator_entry(i);
err = snd_config_remove(n);
@ -271,7 +276,7 @@ int uc_mgr_evaluate_include(snd_use_case_mgr_t *uc_mgr,
err = uc_mgr_evaluate_inplace(uc_mgr, a);
if (err < 0)
return err;
err = uc_mgr_config_tree_merge(parent, a, before, after);
err = uc_mgr_config_tree_merge(uc_mgr, parent, a, before, after);
if (err < 0)
return err;
snd_config_delete(a);