From 5e5a429815e855810bff1a0129f5a403c3f7d880 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 23 Apr 2001 09:15:09 +0000 Subject: [PATCH] Added snd_ctl_elem_info_is_owner and snd_ctl_elem_info_get_owner functions. --- include/control.h | 4 ++++ src/control/control.c | 24 +++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/include/control.h b/include/control.h index 9261e372..f5055ac6 100644 --- a/include/control.h +++ b/include/control.h @@ -503,8 +503,12 @@ int snd_ctl_elem_info_is_inactive(const snd_ctl_elem_info_t *obj); int snd_ctl_elem_info_is_locked(const snd_ctl_elem_info_t *obj); +int snd_ctl_elem_info_is_owner(const snd_ctl_elem_info_t *obj); + int snd_ctl_elem_info_is_indirect(const snd_ctl_elem_info_t *obj); +pid_t snd_ctl_elem_info_get_owner(const snd_ctl_elem_info_t *obj); + unsigned int snd_ctl_elem_info_get_count(const snd_ctl_elem_info_t *obj); long snd_ctl_elem_info_get_min(const snd_ctl_elem_info_t *obj); diff --git a/src/control/control.c b/src/control/control.c index a07f1ca6..b888bd80 100644 --- a/src/control/control.c +++ b/src/control/control.c @@ -1324,7 +1324,7 @@ int snd_ctl_elem_info_is_inactive(const snd_ctl_elem_info_t *obj) } /** - * \brief Get info about status from a CTL element id/info + * \brief Get info whether an element is locked * \param obj CTL element id/info * \return 0 if element value is currently changeable, 1 if it's locked by another application */ @@ -1334,6 +1334,17 @@ int snd_ctl_elem_info_is_locked(const snd_ctl_elem_info_t *obj) return !!(obj->access & SNDRV_CTL_ELEM_ACCESS_LOCK); } +/** + * \brief Get info if I own an element + * \param obj CTL element id/info + * \return 0 if element value is currently changeable, 1 if it's locked by another application + */ +int snd_ctl_elem_info_is_owner(const snd_ctl_elem_info_t *obj) +{ + assert(obj); + return !!(obj->access & SNDRV_CTL_ELEM_ACCESS_OWNER); +} + /** * \brief Get info about values passing policy from a CTL element id/info * \param obj CTL element id/info @@ -1345,6 +1356,17 @@ int snd_ctl_elem_info_is_indirect(const snd_ctl_elem_info_t *obj) return !!(obj->access & SNDRV_CTL_ELEM_ACCESS_INDIRECT); } +/** + * \brief Get owner of a locked element + * \param obj CTL element id/info + * \return value entries count + */ +pid_t snd_ctl_elem_info_get_owner(const snd_ctl_elem_info_t *obj) +{ + assert(obj); + return obj->owner; +} + /** * \brief Get number of value entries from a CTL element id/info * \param obj CTL element id/info -- 2.47.1