mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
make the protocol plugins make use of modargs
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@62 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
a96ed347a3
commit
216591d95e
17 changed files with 275 additions and 79 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue