summaryrefslogtreecommitdiffstats
path: root/src/namereg.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-06-29 20:37:24 +0000
committerLennart Poettering <lennart@poettering.net>2004-06-29 20:37:24 +0000
commitd571be6f5109ff5b256e4c14f391c916264f0a8e (patch)
tree6d0a90457b7f807fbd9f2b187240ab78f7c32637 /src/namereg.c
parente31bac02573cc3090cac5816bea62a2fea888399 (diff)
volume work
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@42 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/namereg.c')
-rw-r--r--src/namereg.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/namereg.c b/src/namereg.c
index b286171d..0af46189 100644
--- a/src/namereg.c
+++ b/src/namereg.c
@@ -1,3 +1,4 @@
+#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <string.h>
@@ -87,11 +88,24 @@ void namereg_unregister(struct core *c, const char *name) {
void* namereg_get(struct core *c, const char *name, enum namereg_type type) {
struct namereg_entry *e;
+ uint32_t index;
+ char *x = NULL;
+ void *d = NULL;
assert(c && name);
- if (!(e = hashset_get(c->namereg, name)))
+ if ((e = hashset_get(c->namereg, name)))
if (e->type == e->type)
return e->data;
- return NULL;
+ index = (uint32_t) strtol(name, &x, 0);
+
+ if (!x || *x != 0)
+ return NULL;
+
+ if (type == NAMEREG_SINK)
+ d = idxset_get_by_index(c->sinks, index);
+ else if (type == NAMEREG_SOURCE)
+ d = idxset_get_by_index(c->sources, index);
+
+ return d;
}