alsa-ucm: add comments to ucm_get_mixer_id()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2019-12-04 16:29:51 +01:00 committed by Arun Raghavan
parent e04f14ebf3
commit f5c02dfcd8

View file

@ -241,7 +241,7 @@ static char *ucm_get_mixer_id(
const char *cprop, const char *cprop,
const char *cid) const char *cid)
{ {
#if SND_LIB_VERSION >= 0x10201 #if SND_LIB_VERSION >= 0x10201 /* alsa-lib-1.2.1+ check */
snd_ctl_elem_id_t *ctl; snd_ctl_elem_id_t *ctl;
int err; int err;
#endif #endif
@ -249,13 +249,17 @@ static char *ucm_get_mixer_id(
char *value2; char *value2;
int index; int index;
/* mixer element as first, if it's found, return it without modifications */
value = pa_proplist_gets(device->proplist, mprop); value = pa_proplist_gets(device->proplist, mprop);
if (value) if (value)
return pa_xstrdup(value); return pa_xstrdup(value);
/* fallback, get the control element identifier */
/* and try to do some heuristic to determine the mixer element name */
value = pa_proplist_gets(device->proplist, cprop); value = pa_proplist_gets(device->proplist, cprop);
if (value == NULL) if (value == NULL)
return NULL; return NULL;
#if SND_LIB_VERSION >= 0x10201 #if SND_LIB_VERSION >= 0x10201 /* alsa-lib-1.2.1+ check */
/* The new parser may return also element index. */
snd_ctl_elem_id_alloca(&ctl); snd_ctl_elem_id_alloca(&ctl);
err = snd_use_case_parse_ctl_elem_id(ctl, cid, value); err = snd_use_case_parse_ctl_elem_id(ctl, cid, value);
if (err < 0) if (err < 0)