[pulseaudio-commits] 2 commits - PROTOCOL src/modules

Arun Raghavan arun at kemper.freedesktop.org
Mon Feb 20 01:02:44 PST 2012


 PROTOCOL                    |    8 +++++
 src/modules/module-tunnel.c |   60 ++++++++++++++++++++++++++++----------------
 2 files changed, 46 insertions(+), 22 deletions(-)

New commits:
commit 811235d14c511cea1884fb967a81cfb395afbf08
Author: David Henningsson <david.henningsson at canonical.com>
Date:   Mon Jan 30 16:47:54 2012 +0100

    tunnel: fixup create_record_stream
    
    The tunnel source has been broken since protocol v22 (PA 1.0),
    and connecting fails with a protocol error. Fix.
    
    BugLink: https://bugs.launchpad.net/bugs/923661
    Signed-off-by: David Henningsson <david.henningsson at canonical.com>

diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c
index a667e21..0916717 100644
--- a/src/modules/module-tunnel.c
+++ b/src/modules/module-tunnel.c
@@ -1031,6 +1031,28 @@ static int read_ports(struct userdata *u, pa_tagstruct *t)
     return 0;
 }
 
+
+static int read_formats(struct userdata *u, pa_tagstruct *t) {
+    uint8_t n_formats;
+    pa_format_info *format;
+
+    if (pa_tagstruct_getu8(t, &n_formats) < 0) { /* no. of formats */
+        pa_log("Parse failure");
+        return -PA_ERR_PROTOCOL;
+    }
+
+    for (uint8_t j = 0; j < n_formats; j++) {
+        format = pa_format_info_new();
+        if (pa_tagstruct_get_format_info(t, format)) { /* format info */
+            pa_format_info_free(format);
+            pa_log("Parse failure");
+            return -PA_ERR_PROTOCOL;
+        }
+        pa_format_info_free(format);
+    }
+    return 0;
+}
+
 #ifdef TUNNEL_SINK
 
 /* Called from main context */
@@ -1104,25 +1126,8 @@ static void sink_info_cb(pa_pdispatch *pd, uint32_t command,  uint32_t tag, pa_t
     if (read_ports(u, t) < 0)
         goto fail;
 
-    if (u->version >= 21) {
-        uint8_t n_formats;
-        pa_format_info *format;
-
-        if (pa_tagstruct_getu8(t, &n_formats) < 0) { /* no. of formats */
-            pa_log("Parse failure");
-            goto fail;
-        }
-
-        for (uint8_t j = 0; j < n_formats; j++) {
-            format = pa_format_info_new();
-            if (pa_tagstruct_get_format_info(t, format)) { /* format info */
-                pa_format_info_free(format);
-                pa_log("Parse failure");
-                goto fail;
-            }
-            pa_format_info_free(format);
-        }
-    }
+    if (u->version >= 21 && read_formats(u, t) < 0)
+        goto fail;
 
     if (!pa_tagstruct_eof(t)) {
         pa_log("Packet too long");
@@ -1332,6 +1337,9 @@ static void source_info_cb(pa_pdispatch *pd, uint32_t command,  uint32_t tag, pa
     if (read_ports(u, t) < 0)
         goto fail;
 
+    if (u->version >= 22 && read_formats(u, t) < 0)
+        goto fail;
+
     if (!pa_tagstruct_eof(t)) {
         pa_log("Packet too long");
         goto fail;
@@ -1568,9 +1576,7 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
     struct userdata *u = userdata;
     pa_tagstruct *reply;
     char name[256], un[128], hn[128];
-#ifdef TUNNEL_SINK
     pa_cvolume volume;
-#endif
 
     pa_assert(pd);
     pa_assert(u);
@@ -1743,6 +1749,18 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
         /* We're not using the extended API, so n_formats = 0 and that's that */
         pa_tagstruct_putu8(reply, 0);
     }
+#else
+    if (u->version >= 22) {
+        /* We're not using the extended API, so n_formats = 0 and that's that */
+        pa_tagstruct_putu8(reply, 0);
+        pa_cvolume_reset(&volume, u->source->sample_spec.channels);
+        pa_tagstruct_put_cvolume(reply, &volume);
+        pa_tagstruct_put_boolean(reply, FALSE); /* muted */
+        pa_tagstruct_put_boolean(reply, FALSE); /* volume_set */
+        pa_tagstruct_put_boolean(reply, FALSE); /* muted_set */
+        pa_tagstruct_put_boolean(reply, FALSE); /* relative volume */
+        pa_tagstruct_put_boolean(reply, FALSE); /* passthrough stream */
+    }
 #endif
 
     pa_pstream_send_tagstruct(u->pstream, reply);

commit 9a2faad8203aae4b5668d12a597ce94744cf9a42
Author: David Henningsson <david.henningsson at canonical.com>
Date:   Mon Jan 30 16:47:53 2012 +0100

    PROTOCOL: Fix documentation for version 22
    
    Fix the documentation: the protocol file was not reflecting the code
    properly for version 22.
    
    Signed-off-by: David Henningsson <david.henningsson at canonical.com>

diff --git a/PROTOCOL b/PROTOCOL
index 7468cd4..f437829 100644
--- a/PROTOCOL
+++ b/PROTOCOL
@@ -250,6 +250,12 @@ New fields PA_COMMAND_CREATE_RECORD_STREAM:
     format_info format1
     ...
     format_info formatn
+    volume
+    bool muted
+    bool volume_set
+    bool muted_set
+    bool relative_volume
+    bool passthrough
 
 One new field in reply from PA_COMMAND_CREATE_RECORD_STREAM:
 
@@ -266,11 +272,11 @@ PA_COMMAND_GET_SOURCE_INFO_LIST)
 Five new fields in reply from PA_COMMAND_GET_SOURCE_OUTPUT_INFO (and thus
 PA_COMMAND_GET_SOURCE_OUTPUT_INFO_LIST)
 
-    format_info format
     volume
     bool mute
     bool has_volume
     bool volume_writable
+    format_info format
 
 ## v23, implemented by >= 1.0
 



More information about the pulseaudio-commits mailing list