]> code.delx.au - pulseaudio/blobdiff - src/protocol-native.c
update todo
[pulseaudio] / src / protocol-native.c
index c7a7cce071f724f8d0a8d25453270d3ce47efc7b..abd170263f48852dfa9e581568e0a45e11e6ca15 100644 (file)
@@ -48,6 +48,7 @@ struct connection {
 };
 
 struct pa_protocol_native {
+    struct pa_module *module;
     int public;
     struct pa_core *core;
     struct pa_socket_server *server;
@@ -110,6 +111,8 @@ static struct record_stream* record_stream_new(struct connection *c, struct pa_s
     s->source_output->push = source_output_push_cb;
     s->source_output->kill = source_output_kill_cb;
     s->source_output->userdata = s;
+    s->source_output->owner = c->protocol->module;
+    s->source_output->client = c->client;
 
     s->memblockq = pa_memblockq_new(maxlength, 0, base = pa_sample_size(ss), 0, 0);
     assert(s->memblockq);
@@ -153,6 +156,8 @@ static struct playback_stream* playback_stream_new(struct connection *c, struct
     s->sink_input->kill = sink_input_kill_cb;
     s->sink_input->get_latency = sink_input_get_latency_cb;
     s->sink_input->userdata = s;
+    s->sink_input->owner = c->protocol->module;
+    s->sink_input->client = c->client;
     
     s->memblockq = pa_memblockq_new(maxlength, tlength, pa_sample_size(ss), prebuf, minreq);
     assert(s->memblockq);
@@ -707,6 +712,8 @@ static void on_connection(struct pa_socket_server*s, struct pa_iochannel *io, vo
     assert(c->client);
     c->client->kill = client_kill_cb;
     c->client->userdata = c;
+    c->client->owner = p->module;
+    
     c->pstream = pa_pstream_new(p->core->mainloop, io);
     assert(c->pstream);
 
@@ -729,19 +736,26 @@ static void on_connection(struct pa_socket_server*s, struct pa_iochannel *io, vo
 
 /*** module entry points ***/
 
-struct pa_protocol_native* pa_protocol_native_new(struct pa_core *core, struct pa_socket_server *server) {
+struct pa_protocol_native* pa_protocol_native_new(struct pa_core *core, struct pa_socket_server *server, struct pa_module *m, struct pa_modargs *ma) {
     struct pa_protocol_native *p;
-    assert(core && server);
+    uint32_t public;
+    assert(core && server && ma);
 
+    if (pa_modargs_get_value_u32(ma, "public", &public) < 0) {
+        fprintf(stderr, __FILE__": public= expects numeric argument.\n");
+        return NULL;
+    }
+    
     p = malloc(sizeof(struct pa_protocol_native));
     assert(p);
 
-    if (pa_authkey_load_from_home(PA_NATIVE_COOKIE_FILE, p->auth_cookie, sizeof(p->auth_cookie)) < 0) {
+    if (pa_authkey_load_from_home(pa_modargs_get_value(ma, "cookie", PA_NATIVE_COOKIE_FILE), p->auth_cookie, sizeof(p->auth_cookie)) < 0) {
         free(p);
         return NULL;
     }
-    
-    p->public = 1;
+
+    p->module = m;
+    p->public = public;
     p->server = server;
     p->core = core;
     p->connections = pa_idxset_new(NULL, NULL);