summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-02-17 17:29:17 +0100
committerTakashi Iwai <tiwai@suse.de>2009-02-17 17:29:17 +0100
commit63257a7b4b47cd654c96511366645eb2b6025956 (patch)
tree867edfb50559e48955039be1469b45ceb089baed
parenta8b557b30242002af6189a587d57fb40f11dda95 (diff)
oss: Add numid check in ctl plugin
Added the check of non-zero numid to optimize the look-up for the element. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--oss/ctl_oss.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/oss/ctl_oss.c b/oss/ctl_oss.c
index b589f74..b8847b1 100644
--- a/oss/ctl_oss.c
+++ b/oss/ctl_oss.c
@@ -151,7 +151,21 @@ static snd_ctl_ext_key_t oss_find_elem(snd_ctl_ext_t *ext,
{
snd_ctl_oss_t *oss = ext->private_data;
const char *name;
- unsigned int i, key;
+ unsigned int i, key, numid;
+
+ numid = snd_ctl_elem_id_get_numid(id);
+ if (numid > 0) {
+ numid--;
+ if (numid < oss->num_vol_ctls)
+ return oss->vol_ctl[numid];
+ numid -= oss->num_vol_ctls;
+ if (oss->exclusive_input) {
+ if (!numid)
+ return OSS_KEY_CAPTURE_MUX;
+ } else if (numid < oss->num_rec_items)
+ return oss->rec_item[numid] |
+ OSS_KEY_CAPTURE_FLAG;
+ }
name = snd_ctl_elem_id_get_name(id);
if (! strcmp(name, "Capture Source")) {