ucm: add snd_use_case_parse_ctl_elem_id()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Jaroslav Kysela
4 years ago
439 | 439 |
}
|
440 | 440 |
|
441 | 441 |
/**
|
|
442 |
* \brief Parse control element identifier
|
|
443 |
* \param elem_id Element identifier
|
|
444 |
* \param ucm_id Use case identifier
|
|
445 |
* \param value String value to be parsed
|
|
446 |
* \return Zero if success, otherwise a negative error code
|
|
447 |
*/
|
|
448 |
int snd_use_case_parse_ctl_elem_id(snd_ctl_elem_id_t *dst,
|
|
449 |
const char *ucm_id, char *value);
|
|
450 |
|
|
451 |
|
|
452 |
/**
|
442 | 453 |
* \}
|
443 | 454 |
*/
|
444 | 455 |
|
1919 | 1919 |
pthread_mutex_unlock(&uc_mgr->mutex);
|
1920 | 1920 |
return err;
|
1921 | 1921 |
}
|
|
1922 |
|
|
1923 |
/**
|
|
1924 |
* \brief Parse control element identifier
|
|
1925 |
* \param elem_id Element identifier
|
|
1926 |
* \param ucm_id Use case identifier
|
|
1927 |
* \param value String value to be parsed
|
|
1928 |
* \return Zero if success, otherwise a negative error code
|
|
1929 |
*/
|
|
1930 |
int snd_use_case_parse_ctl_elem_id(snd_ctl_elem_id_t *dst,
|
|
1931 |
const char *ucm_id, char *value)
|
|
1932 |
{
|
|
1933 |
snd_ctl_elem_iface_t iface;
|
|
1934 |
|
|
1935 |
snd_ctl_elem_id_clear(dst);
|
|
1936 |
if (strcasestr(ucm_id, "name="))
|
|
1937 |
return __snd_ctl_ascii_elem_id_parse(dst, value, NULL);
|
|
1938 |
iface = SND_CTL_ELEM_IFACE_MIXER;
|
|
1939 |
if (strcasecmp(ucm_id, "JackControl") == 0)
|
|
1940 |
iface = SND_CTL_ELEM_IFACE_CARD;
|
|
1941 |
snd_ctl_elem_id_set_interface(dst, iface);
|
|
1942 |
snd_ctl_elem_id_set_name(dst, value);
|
|
1943 |
return 0;
|
|
1944 |
}
|