Add module-tunnel

add proper locking when autospawning a daemon


git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@245 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2004-09-28 22:47:48 +00:00
parent 450ad85b35
commit 6f59ae1763
14 changed files with 554 additions and 59 deletions

View file

@ -164,7 +164,6 @@ static void callback(struct pa_core *c, enum pa_subscription_event_type t, uint3
int pa__init(struct pa_core *c, struct pa_module*m) {
struct pa_modargs *ma = NULL;
int ret = -1;
const char *table_file;
struct userdata *u;
assert(c && m);
@ -172,25 +171,28 @@ int pa__init(struct pa_core *c, struct pa_module*m) {
if (!(ma = pa_modargs_new(m->argument, valid_modargs)) ||
!(table_file = pa_modargs_get_value(ma, "table", NULL))) {
pa_log(__FILE__": Failed to parse module arguments\n");
goto finish;
goto fail;
}
u = pa_xmalloc(sizeof(struct userdata));
u->rules = NULL;
u->subscription = NULL;
m->userdata = u;
if (load_rules(u, table_file) < 0)
goto finish;
goto fail;
u->subscription = pa_subscription_new(c, PA_SUBSCRIPTION_MASK_SINK_INPUT, callback, u);
ret = 0;
finish:
pa_modargs_free(ma);
return 0;
fail:
pa__done(c, m);
if (ma)
pa_modargs_free(ma);
return ret;
return -1;
}
void pa__done(struct pa_core *c, struct pa_module*m) {