From 216591d95e00a0cb771088dad9a752efead55e10 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 11 Jul 2004 22:20:08 +0000 Subject: make the protocol plugins make use of modargs git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@62 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/modargs.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/modargs.c') diff --git a/src/modargs.c b/src/modargs.c index a7b48808..a716a80e 100644 --- a/src/modargs.c +++ b/src/modargs.c @@ -7,6 +7,9 @@ #include "modargs.h" #include "idxset.h" #include "sample-util.h" +#include "namereg.h" +#include "sink.h" +#include "source.h" struct pa_modargs; @@ -220,3 +223,37 @@ int pa_modargs_get_sample_spec(struct pa_modargs *ma, struct pa_sample_spec *rss return 0; } + +int pa_modargs_get_source_index(struct pa_modargs *ma, struct pa_core *c, uint32_t *index) { + const char *t; + assert(ma && index); + + if (!(t = pa_modargs_get_value(ma, "source", NULL))) + *index = PA_IDXSET_INVALID; + else { + struct pa_source *source; + if (!(source = pa_namereg_get(c, t, PA_NAMEREG_SOURCE))) + return -1; + + *index = source->index; + } + + return 0; +} + +int pa_modargs_get_sink_index(struct pa_modargs *ma, struct pa_core *c, uint32_t *index) { + const char *t; + assert(ma && index); + + if (!(t = pa_modargs_get_value(ma, "sink", NULL))) + *index = PA_IDXSET_INVALID; + else { + struct pa_sink *sink; + if (!(sink = pa_namereg_get(c, t, PA_NAMEREG_SINK))) + return -1; + + *index = sink->index; + } + + return 0; +} -- cgit