mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 03:55:41 +01:00
topology: pre-process-class: Add function to look up attribute definition in class
Add a helper function look up attribute definition in the "DefineAttribute" config in the class definition. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
c832f48404
commit
1422c09afd
2 changed files with 27 additions and 0 deletions
|
@ -66,3 +66,28 @@ snd_config_t *tplg_class_lookup(struct tplg_pre_processor *tplg_pp, snd_config_t
|
|||
free(class_config_id);
|
||||
return class_cfg;
|
||||
}
|
||||
|
||||
/* find the attribute config by name in the class definition */
|
||||
snd_config_t *tplg_class_find_attribute_by_name(struct tplg_pre_processor *tplg_pp,
|
||||
snd_config_t *class, const char *name)
|
||||
{
|
||||
snd_config_t *attr = NULL;
|
||||
const char *class_id;
|
||||
char *attr_str;
|
||||
int ret;
|
||||
|
||||
if (snd_config_get_id(class, &class_id) < 0)
|
||||
return NULL;
|
||||
|
||||
attr_str = tplg_snprintf("DefineAttribute.%s", name);
|
||||
if (!attr_str)
|
||||
return NULL;
|
||||
|
||||
ret = snd_config_search(class, attr_str, &attr);
|
||||
if (ret < 0)
|
||||
SNDERR("No definition for attribute '%s' in class '%s'\n",
|
||||
name, class_id);
|
||||
|
||||
free(attr_str);
|
||||
return attr;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@ void tplg_pp_config_debug(struct tplg_pre_processor *tplg_pp, snd_config_t *cfg)
|
|||
|
||||
/* class helpers */
|
||||
snd_config_t *tplg_class_lookup(struct tplg_pre_processor *tplg_pp, snd_config_t *cfg);
|
||||
snd_config_t *tplg_class_find_attribute_by_name(struct tplg_pre_processor *tplg_pp,
|
||||
snd_config_t *class, const char *name);
|
||||
|
||||
/* config helpers */
|
||||
snd_config_t *tplg_find_config(snd_config_t *config, const char *name);
|
||||
|
|
Loading…
Reference in a new issue