mirror of
https://github.com/openharmony/third_party_tinyalsa.git
synced 2026-07-19 23:33:30 -04:00
Merge branch 'address-duplicate-control-names' of https://github.com/dawagner/tinyalsa into dawagner-address-duplicate-control-names
This commit is contained in:
@@ -232,6 +232,9 @@ const char *mixer_get_name(struct mixer *mixer);
|
||||
unsigned int mixer_get_num_ctls(struct mixer *mixer);
|
||||
struct mixer_ctl *mixer_get_ctl(struct mixer *mixer, unsigned int id);
|
||||
struct mixer_ctl *mixer_get_ctl_by_name(struct mixer *mixer, const char *name);
|
||||
struct mixer_ctl *mixer_get_ctl_by_name_and_index(struct mixer *mixer,
|
||||
const char *name,
|
||||
unsigned int index);
|
||||
|
||||
/* Get info about mixer controls */
|
||||
unsigned int mixer_ctl_get_id(struct mixer_ctl *ctl);
|
||||
|
||||
@@ -188,6 +188,13 @@ struct mixer_ctl *mixer_get_ctl(struct mixer *mixer, unsigned int id)
|
||||
}
|
||||
|
||||
struct mixer_ctl *mixer_get_ctl_by_name(struct mixer *mixer, const char *name)
|
||||
{
|
||||
return mixer_get_ctl_by_name_and_index(mixer, name, 0);
|
||||
}
|
||||
|
||||
struct mixer_ctl *mixer_get_ctl_by_name_and_index(struct mixer *mixer,
|
||||
const char *name,
|
||||
unsigned int index)
|
||||
{
|
||||
unsigned int n;
|
||||
struct mixer_ctl *ctl;
|
||||
@@ -199,7 +206,8 @@ struct mixer_ctl *mixer_get_ctl_by_name(struct mixer *mixer, const char *name)
|
||||
|
||||
for (n = 0; n < mixer->count; n++)
|
||||
if (!strcmp(name, (char*) ctl[n].info.id.name))
|
||||
return &ctl[n];
|
||||
if (index-- == 0)
|
||||
return mixer->ctl + n;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user