From d571be6f5109ff5b256e4c14f391c916264f0a8e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 29 Jun 2004 20:37:24 +0000 Subject: volume work git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@42 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/namereg.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/namereg.c') 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 #include #include #include @@ -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; } -- cgit