Codebase list alsa-lib / cd4b07f
ucm: add snd_use_case_parse_ctl_elem_id() Signed-off-by: Jaroslav Kysela <perex@perex.cz> Jaroslav Kysela 4 years ago
2 changed file(s) with 34 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
439439 }
440440
441441 /**
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 /**
442453 * \}
443454 */
444455
19191919 pthread_mutex_unlock(&uc_mgr->mutex);
19201920 return err;
19211921 }
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 }