]> code.delx.au - pulseaudio/commitdiff
improve esound module
authorLennart Poettering <lennart@poettering.net>
Tue, 21 Sep 2004 20:46:14 +0000 (20:46 +0000)
committerLennart Poettering <lennart@poettering.net>
Tue, 21 Sep 2004 20:46:14 +0000 (20:46 +0000)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@232 fefdeb5f-60dc-0310-8127-8f9354f1896f

polyp/protocol-esound.c
polyp/scache.c

index ccbc61be14980d66e5c5ea54358a1ecce3709b10..797263f61f3bd7e29dd51b98a093a7a81703e89f 100644 (file)
@@ -122,7 +122,7 @@ static int esd_proto_stream_pan(struct connection *c, esd_proto_t request, const
 static int esd_proto_sample_cache(struct connection *c, esd_proto_t request, const void *data, size_t length);
 static int esd_proto_sample_free_or_play(struct connection *c, esd_proto_t request, const void *data, size_t length);
 static int esd_proto_sample_get_id(struct connection *c, esd_proto_t request, const void *data, size_t length);
-static int esd_proto_noop(struct connection *c, esd_proto_t request, const void *data, size_t length);
+static int esd_proto_standby_or_resume(struct connection *c, esd_proto_t request, const void *data, size_t length);
 
 /* the big map of protocol handler info */
 static struct proto_handler proto_map[ESD_PROTO_MAX] = {
@@ -134,17 +134,17 @@ static struct proto_handler proto_map[ESD_PROTO_MAX] = {
     { ESD_NAME_MAX + 2 * sizeof(int), esd_proto_stream_record, "stream rec" },
     { ESD_NAME_MAX + 2 * sizeof(int), esd_proto_stream_record, "stream mon" },
 
-    { ESD_NAME_MAX + 3 * sizeof(int), esd_proto_sample_cache, "sample cache" },
+    { ESD_NAME_MAX + 3 * sizeof(int), esd_proto_sample_cache, "sample cache" },                      /* 6 */
     { sizeof(int),                    esd_proto_sample_free_or_play, "sample free" },
-    { sizeof(int),                    esd_proto_sample_free_or_play, "sample play" },
+    { sizeof(int),                    esd_proto_sample_free_or_play, "sample play" },                /* 8 */
     { sizeof(int),                    NULL, "sample loop" },
     { sizeof(int),                    NULL, "sample stop" },
     { -1,                             NULL, "TODO: sample kill" },
 
-    { ESD_KEY_LEN + sizeof(int),      esd_proto_noop, "standby" },  /* NOOP! */
-    { ESD_KEY_LEN + sizeof(int),      esd_proto_noop, "resume" },   /* NOOP! */
+    { ESD_KEY_LEN + sizeof(int),      esd_proto_standby_or_resume, "standby" },  /* NOOP! */
+    { ESD_KEY_LEN + sizeof(int),      esd_proto_standby_or_resume, "resume" },   /* NOOP! */         /* 13 */
 
-    { ESD_NAME_MAX,                   esd_proto_sample_get_id, "sample getid" },
+    { ESD_NAME_MAX,                   esd_proto_sample_get_id, "sample getid" },                     /* 14 */
     { ESD_NAME_MAX + 2 * sizeof(int), NULL, "stream filter" },
 
     { sizeof(int),                    esd_proto_server_info, "server info" },
@@ -655,11 +655,12 @@ static int esd_proto_sample_free_or_play(struct connection *c, esd_proto_t reque
     return 0;
 }
 
-static int esd_proto_noop(struct connection *c, esd_proto_t request, const void *data, size_t length) {
+static int esd_proto_standby_or_resume(struct connection *c, esd_proto_t request, const void *data, size_t length) {
     int *ok;
-    ok = connection_write(c, sizeof(int));
+    ok = connection_write(c, sizeof(int)*2);
     assert(ok);
-    *ok = 1;
+    ok[0] = 1;
+    ok[1] = 1;
     return 0;
 }
 
@@ -697,6 +698,8 @@ static int do_read(struct connection *c) {
 
             handler = proto_map+c->request;
 
+            pa_log(__FILE__": executing request #%u\n", c->request);
+
             if (!handler->proc) {
                 pa_log(__FILE__": recieved unimplemented request #%u.\n", c->request);
                 return -1;
index 963a4f86330d373e47a0d76bda1055a5fcaa618a..b17f324216da65e547a24f3c5817c60c528862a1 100644 (file)
@@ -237,7 +237,7 @@ uint32_t pa_scache_get_id_by_name(struct pa_core *c, const char *name) {
     struct pa_scache_entry *e;
     assert(c && name);
 
-    if (!(e = pa_namereg_get(c, name, PA_NAMEREG_SAMPLE, 1)))
+    if (!(e = pa_namereg_get(c, name, PA_NAMEREG_SAMPLE, 0)))
         return PA_IDXSET_INVALID;
 
     return e->index;