mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-05 13:30:00 -05:00
topology: Add element ID so we can look up references by name.
Add support to lookup elements by name. This is in preparation for adding some new API calls that will allow building topology data using a C API. This will allow applications to build their own topology data directly. Signed-off-by: Jin Yao <yao.jin@linux.intel.com> Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
1bb4c2fc30
commit
120b3b8ead
7 changed files with 24 additions and 18 deletions
|
|
@ -103,20 +103,27 @@ struct tplg_elem *tplg_elem_lookup(struct list_head *base, const char* id,
|
|||
|
||||
/* create a new common element and object */
|
||||
struct tplg_elem* tplg_elem_new_common(snd_tplg_t *tplg,
|
||||
snd_config_t *cfg, enum object_type type)
|
||||
snd_config_t *cfg, const char *name, enum object_type type)
|
||||
{
|
||||
struct tplg_elem *elem;
|
||||
const char *id;
|
||||
int obj_size = 0;
|
||||
void *obj;
|
||||
|
||||
if (!cfg && !name)
|
||||
return NULL;
|
||||
|
||||
elem = tplg_elem_new();
|
||||
if (!elem)
|
||||
return NULL;
|
||||
|
||||
snd_config_get_id(cfg, &id);
|
||||
strncpy(elem->id, id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||
elem->id[SNDRV_CTL_ELEM_ID_NAME_MAXLEN - 1] = 0;
|
||||
/* do we get name from cfg */
|
||||
if (cfg) {
|
||||
snd_config_get_id(cfg, &id);
|
||||
elem_copy_text(elem->id, id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||
elem->id[SNDRV_CTL_ELEM_ID_NAME_MAXLEN - 1] = 0;
|
||||
} else if (name != NULL)
|
||||
elem_copy_text(elem->id, name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
|
||||
|
||||
switch (type) {
|
||||
case OBJECT_TYPE_DATA:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue