[pulseaudio-discuss] [PATCH RFCv3 11/51] pstream: Add pa_pstream_send_tagstruct()

Peter Meerwald pmeerw at pmeerw.net
Tue Nov 4 15:26:06 PST 2014


From: Peter Meerwald <p.meerwald at bct-electronic.com>

don't encapsulate a tagstruct in a packet anymore, allow to
pass the tagstruct directly to the pstream

this removes the ugly macro pa_pstream_send_tagstruct()
in pstream-util.h and calls the new function pa_pstream_send_tagstruct()
causing the addition of a NULL parameters in many places

Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
---
 src/modules/module-device-manager.c |  4 +-
 src/modules/module-device-restore.c |  4 +-
 src/modules/module-stream-restore.c |  4 +-
 src/modules/module-tunnel.c         | 26 ++++++------
 src/pulse/context.c                 | 20 ++++-----
 src/pulse/ext-device-manager.c      | 14 +++----
 src/pulse/ext-device-restore.c      | 10 ++---
 src/pulse/ext-stream-restore.c      | 10 ++---
 src/pulse/introspect.c              | 82 ++++++++++++++++++-------------------
 src/pulse/scache.c                  | 10 ++---
 src/pulse/stream.c                  | 22 +++++-----
 src/pulse/subscribe.c               |  2 +-
 src/pulsecore/protocol-native.c     | 60 +++++++++++++--------------
 src/pulsecore/pstream-util.c        | 30 ++++----------
 src/pulsecore/pstream-util.h        |  2 -
 src/pulsecore/pstream.c             | 34 +++++++++++++++
 src/pulsecore/pstream.h             |  2 +
 17 files changed, 177 insertions(+), 159 deletions(-)

diff --git a/src/modules/module-device-manager.c b/src/modules/module-device-manager.c
index a396edc..2f08a3f 100644
--- a/src/modules/module-device-manager.c
+++ b/src/modules/module-device-manager.c
@@ -458,7 +458,7 @@ static void notify_subscribers(struct userdata *u) {
         pa_tagstruct_puts(t, u->module->name);
         pa_tagstruct_putu32(t, SUBCOMMAND_EVENT);
 
-        pa_pstream_send_tagstruct(pa_native_connection_get_pstream(c), t);
+        pa_pstream_send_tagstruct(pa_native_connection_get_pstream(c), t, NULL);
     }
 }
 
@@ -1490,7 +1490,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
       goto fail;
   }
 
-  pa_pstream_send_tagstruct(pa_native_connection_get_pstream(c), reply);
+  pa_pstream_send_tagstruct(pa_native_connection_get_pstream(c), reply, NULL);
   return 0;
 
   fail:
diff --git a/src/modules/module-device-restore.c b/src/modules/module-device-restore.c
index ad9115e..03cff9b 100644
--- a/src/modules/module-device-restore.c
+++ b/src/modules/module-device-restore.c
@@ -162,7 +162,7 @@ static void trigger_save(struct userdata *u, pa_device_type_t type, uint32_t sin
             pa_tagstruct_putu32(t, type);
             pa_tagstruct_putu32(t, sink_idx);
 
-            pa_pstream_send_tagstruct(pa_native_connection_get_pstream(c), t);
+            pa_pstream_send_tagstruct(pa_native_connection_get_pstream(c), t, NULL);
         }
     }
 
@@ -1184,7 +1184,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
             goto fail;
     }
 
-    pa_pstream_send_tagstruct(pa_native_connection_get_pstream(c), reply);
+    pa_pstream_send_tagstruct(pa_native_connection_get_pstream(c), reply, NULL);
     return 0;
 
 fail:
diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c
index a625d60..3622d6f 100644
--- a/src/modules/module-stream-restore.c
+++ b/src/modules/module-stream-restore.c
@@ -1210,7 +1210,7 @@ static void trigger_save(struct userdata *u) {
         pa_tagstruct_puts(t, u->module->name);
         pa_tagstruct_putu32(t, SUBCOMMAND_EVENT);
 
-        pa_pstream_send_tagstruct(pa_native_connection_get_pstream(c), t);
+        pa_pstream_send_tagstruct(pa_native_connection_get_pstream(c), t, NULL);
     }
 
     if (u->save_time_event)
@@ -2239,7 +2239,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
             goto fail;
     }
 
-    pa_pstream_send_tagstruct(pa_native_connection_get_pstream(c), reply);
+    pa_pstream_send_tagstruct(pa_native_connection_get_pstream(c), reply, NULL);
     return 0;
 
 fail:
diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c
index 65e10ab..d98f0d7 100644
--- a/src/modules/module-tunnel.c
+++ b/src/modules/module-tunnel.c
@@ -458,7 +458,7 @@ static void stream_cork(struct userdata *u, bool cork) {
     pa_tagstruct_putu32(t, u->ctag++);
     pa_tagstruct_putu32(t, u->channel);
     pa_tagstruct_put_boolean(t, cork);
-    pa_pstream_send_tagstruct(u->pstream, t);
+    pa_pstream_send_tagstruct(u->pstream, t, NULL);
 
     request_latency(u);
 }
@@ -893,7 +893,7 @@ static void request_latency(struct userdata *u) {
 
     pa_tagstruct_put_timeval(t, pa_gettimeofday(&now));
 
-    pa_pstream_send_tagstruct(u->pstream, t);
+    pa_pstream_send_tagstruct(u->pstream, t, NULL);
     pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, stream_get_latency_callback, u, NULL);
 
     u->ignore_latency_before = tag;
@@ -953,7 +953,7 @@ static void update_description(struct userdata *u) {
     pa_tagstruct_putu32(t, u->ctag++);
     pa_tagstruct_putu32(t, u->channel);
     pa_tagstruct_puts(t, d);
-    pa_pstream_send_tagstruct(u->pstream, t);
+    pa_pstream_send_tagstruct(u->pstream, t, NULL);
 
     pa_xfree(d);
 }
@@ -1367,7 +1367,7 @@ static void request_info(struct userdata *u) {
     t = pa_tagstruct_new();
     pa_tagstruct_putu32(t, PA_COMMAND_GET_SERVER_INFO);
     pa_tagstruct_putu32(t, tag = u->ctag++);
-    pa_pstream_send_tagstruct(u->pstream, t);
+    pa_pstream_send_tagstruct(u->pstream, t, NULL);
     pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, server_info_cb, u, NULL);
 
 #ifdef TUNNEL_SINK
@@ -1375,7 +1375,7 @@ static void request_info(struct userdata *u) {
     pa_tagstruct_putu32(t, PA_COMMAND_GET_SINK_INPUT_INFO);
     pa_tagstruct_putu32(t, tag = u->ctag++);
     pa_tagstruct_putu32(t, u->device_index);
-    pa_pstream_send_tagstruct(u->pstream, t);
+    pa_pstream_send_tagstruct(u->pstream, t, NULL);
     pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, sink_input_info_cb, u, NULL);
 
     if (u->sink_name) {
@@ -1384,7 +1384,7 @@ static void request_info(struct userdata *u) {
         pa_tagstruct_putu32(t, tag = u->ctag++);
         pa_tagstruct_putu32(t, PA_INVALID_INDEX);
         pa_tagstruct_puts(t, u->sink_name);
-        pa_pstream_send_tagstruct(u->pstream, t);
+        pa_pstream_send_tagstruct(u->pstream, t, NULL);
         pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, sink_info_cb, u, NULL);
     }
 #else
@@ -1394,7 +1394,7 @@ static void request_info(struct userdata *u) {
         pa_tagstruct_putu32(t, tag = u->ctag++);
         pa_tagstruct_putu32(t, PA_INVALID_INDEX);
         pa_tagstruct_puts(t, u->source_name);
-        pa_pstream_send_tagstruct(u->pstream, t);
+        pa_pstream_send_tagstruct(u->pstream, t, NULL);
         pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, source_info_cb, u, NULL);
     }
 #endif
@@ -1447,7 +1447,7 @@ static void start_subscribe(struct userdata *u) {
 #endif
                         );
 
-    pa_pstream_send_tagstruct(u->pstream, t);
+    pa_pstream_send_tagstruct(u->pstream, t, NULL);
 }
 
 /* Called from main context */
@@ -1636,7 +1636,7 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
     } else
         pa_tagstruct_puts(reply, "PulseAudio");
 
-    pa_pstream_send_tagstruct(u->pstream, reply);
+    pa_pstream_send_tagstruct(u->pstream, reply, NULL);
     /* We ignore the server's reply here */
 
     reply = pa_tagstruct_new();
@@ -1757,7 +1757,7 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
     }
 #endif
 
-    pa_pstream_send_tagstruct(u->pstream, reply);
+    pa_pstream_send_tagstruct(u->pstream, reply, NULL);
     pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, create_stream_callback, u, NULL);
 
     pa_log_debug("Connection authenticated, creating stream ...");
@@ -1863,7 +1863,7 @@ static void on_connection(pa_socket_client *sc, pa_iochannel *io, void *userdata
     pa_pstream_send_tagstruct_with_creds(u->pstream, t, &ucred);
 }
 #else
-    pa_pstream_send_tagstruct(u->pstream, t);
+    pa_pstream_send_tagstruct(u->pstream, t, NULL);
 #endif
 
     pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, setup_complete_callback, u, NULL);
@@ -1887,7 +1887,7 @@ static void sink_set_volume(pa_sink *sink) {
     pa_tagstruct_putu32(t, u->ctag++);
     pa_tagstruct_putu32(t, u->device_index);
     pa_tagstruct_put_cvolume(t, &sink->real_volume);
-    pa_pstream_send_tagstruct(u->pstream, t);
+    pa_pstream_send_tagstruct(u->pstream, t, NULL);
 }
 
 /* Called from main context */
@@ -1907,7 +1907,7 @@ static void sink_set_mute(pa_sink *sink) {
     pa_tagstruct_putu32(t, u->ctag++);
     pa_tagstruct_putu32(t, u->device_index);
     pa_tagstruct_put_boolean(t, sink->muted);
-    pa_pstream_send_tagstruct(u->pstream, t);
+    pa_pstream_send_tagstruct(u->pstream, t, NULL);
 }
 
 #endif
diff --git a/src/pulse/context.c b/src/pulse/context.c
index ce513d0..6f857ce 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -374,7 +374,7 @@ static void handle_srbchannel_memblock(pa_context *c, pa_memblock *memblock) {
     t = pa_tagstruct_new();
     pa_tagstruct_putu32(t, PA_COMMAND_ENABLE_SRBCHANNEL);
     pa_tagstruct_putu32(t, c->srb_setup_tag);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
 
     /* ...and switch over */
     pa_pstream_set_srbchannel(c->pstream, sr);
@@ -526,7 +526,7 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
             } else
                 pa_tagstruct_puts(reply, pa_proplist_gets(c->proplist, PA_PROP_APPLICATION_NAME));
 
-            pa_pstream_send_tagstruct(c->pstream, reply);
+            pa_pstream_send_tagstruct(c->pstream, reply, NULL);
             pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, setup_complete_callback, c, NULL);
 
             pa_context_set_state(c, PA_CONTEXT_SETTING_NAME);
@@ -602,7 +602,7 @@ static void setup_context(pa_context *c, pa_iochannel *io) {
     pa_pstream_send_tagstruct_with_creds(c->pstream, t, &ucred);
 }
 #else
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
 #endif
 
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, setup_complete_callback, c, NULL);
@@ -1170,7 +1170,7 @@ pa_operation* pa_context_send_simple_command(pa_context *c, uint32_t command, pa
     o = pa_operation_new(c, NULL, cb, userdata);
 
     t = pa_tagstruct_command(c, command, &tag);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, internal_cb, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1197,7 +1197,7 @@ pa_operation* pa_context_set_default_sink(pa_context *c, const char *name, pa_co
     o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
     t = pa_tagstruct_command(c, PA_COMMAND_SET_DEFAULT_SINK, &tag);
     pa_tagstruct_puts(t, name);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT,  pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1217,7 +1217,7 @@ pa_operation* pa_context_set_default_source(pa_context *c, const char *name, pa_
     o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
     t = pa_tagstruct_command(c, PA_COMMAND_SET_DEFAULT_SOURCE, &tag);
     pa_tagstruct_puts(t, name);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT,  pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1256,7 +1256,7 @@ pa_operation* pa_context_set_name(pa_context *c, const char *name, pa_context_su
         o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
         t = pa_tagstruct_command(c, PA_COMMAND_SET_CLIENT_NAME, &tag);
         pa_tagstruct_puts(t, name);
-        pa_pstream_send_tagstruct(c->pstream, t);
+        pa_pstream_send_tagstruct(c->pstream, t, NULL);
         pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT,  pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
     }
 
@@ -1339,7 +1339,7 @@ pa_operation *pa_context_proplist_update(pa_context *c, pa_update_mode_t mode, p
     pa_tagstruct_putu32(t, (uint32_t) mode);
     pa_tagstruct_put_proplist(t, p);
 
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     /* Please note that we don't update c->proplist here, because we
@@ -1371,7 +1371,7 @@ pa_operation *pa_context_proplist_remove(pa_context *c, const char *const keys[]
 
     pa_tagstruct_puts(t, NULL);
 
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     /* Please note that we don't update c->proplist here, because we
@@ -1479,7 +1479,7 @@ static void pa_command_disable_srbchannel(pa_pdispatch *pd, uint32_t command, ui
     t2 = pa_tagstruct_new();
     pa_tagstruct_putu32(t2, PA_COMMAND_DISABLE_SRBCHANNEL);
     pa_tagstruct_putu32(t2, tag);
-    pa_pstream_send_tagstruct(c->pstream, t2);
+    pa_pstream_send_tagstruct(c->pstream, t2, NULL);
 }
 
 
diff --git a/src/pulse/ext-device-manager.c b/src/pulse/ext-device-manager.c
index 9158068..c20930f 100644
--- a/src/pulse/ext-device-manager.c
+++ b/src/pulse/ext-device-manager.c
@@ -100,7 +100,7 @@ pa_operation *pa_ext_device_manager_test(
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, "module-device-manager");
     pa_tagstruct_putu32(t, SUBCOMMAND_TEST);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, ext_device_manager_test_cb, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -200,7 +200,7 @@ pa_operation *pa_ext_device_manager_read(
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, "module-device-manager");
     pa_tagstruct_putu32(t, SUBCOMMAND_READ);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, ext_device_manager_read_cb, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -237,7 +237,7 @@ pa_operation *pa_ext_device_manager_set_device_description(
     pa_tagstruct_puts(t, device);
     pa_tagstruct_puts(t, description);
 
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -276,7 +276,7 @@ pa_operation *pa_ext_device_manager_delete(
         pa_tagstruct_puts(t, *k);
     }
 
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -319,7 +319,7 @@ pa_operation *pa_ext_device_manager_enable_role_device_priority_routing(
     pa_tagstruct_putu32(t, SUBCOMMAND_ROLE_DEVICE_PRIORITY_ROUTING);
     pa_tagstruct_put_boolean(t, !!enable);
 
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -361,7 +361,7 @@ pa_operation *pa_ext_device_manager_reorder_devices_for_role(
     while (devices[i])
         pa_tagstruct_puts(t, devices[i++]);
 
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -391,7 +391,7 @@ pa_operation *pa_ext_device_manager_subscribe(
     pa_tagstruct_puts(t, "module-device-manager");
     pa_tagstruct_putu32(t, SUBCOMMAND_SUBSCRIBE);
     pa_tagstruct_put_boolean(t, enable);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
diff --git a/src/pulse/ext-device-restore.c b/src/pulse/ext-device-restore.c
index e40ea88..5e6575b 100644
--- a/src/pulse/ext-device-restore.c
+++ b/src/pulse/ext-device-restore.c
@@ -101,7 +101,7 @@ pa_operation *pa_ext_device_restore_test(
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, "module-device-restore");
     pa_tagstruct_putu32(t, SUBCOMMAND_TEST);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, ext_device_restore_test_cb, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -131,7 +131,7 @@ pa_operation *pa_ext_device_restore_subscribe(
     pa_tagstruct_puts(t, "module-device-restore");
     pa_tagstruct_putu32(t, SUBCOMMAND_SUBSCRIBE);
     pa_tagstruct_put_boolean(t, enable);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -254,7 +254,7 @@ pa_operation *pa_ext_device_restore_read_formats_all(
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, "module-device-restore");
     pa_tagstruct_putu32(t, SUBCOMMAND_READ_FORMATS_ALL);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, ext_device_restore_read_device_formats_cb, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -287,7 +287,7 @@ pa_operation *pa_ext_device_restore_read_formats(
     pa_tagstruct_putu32(t, SUBCOMMAND_READ_FORMATS);
     pa_tagstruct_putu32(t, type);
     pa_tagstruct_putu32(t, idx);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, ext_device_restore_read_device_formats_cb, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -330,7 +330,7 @@ pa_operation *pa_ext_device_restore_save_formats(
     for (j = 0; j < n_formats; j++)
         pa_tagstruct_put_format_info(t, formats[j]);
 
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
diff --git a/src/pulse/ext-stream-restore.c b/src/pulse/ext-stream-restore.c
index 3362a5f..f950111 100644
--- a/src/pulse/ext-stream-restore.c
+++ b/src/pulse/ext-stream-restore.c
@@ -96,7 +96,7 @@ pa_operation *pa_ext_stream_restore_test(
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, "module-stream-restore");
     pa_tagstruct_putu32(t, SUBCOMMAND_TEST);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, ext_stream_restore_test_cb, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -177,7 +177,7 @@ pa_operation *pa_ext_stream_restore_read(
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, "module-stream-restore");
     pa_tagstruct_putu32(t, SUBCOMMAND_READ);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, ext_stream_restore_read_cb, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -231,7 +231,7 @@ pa_operation *pa_ext_stream_restore_write(
         pa_tagstruct_put_boolean(t, data->mute);
     }
 
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -279,7 +279,7 @@ pa_operation *pa_ext_stream_restore_delete(
         pa_tagstruct_puts(t, *k);
     }
 
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -318,7 +318,7 @@ pa_operation *pa_ext_stream_restore_subscribe(
     pa_tagstruct_puts(t, "module-stream-restore");
     pa_tagstruct_putu32(t, SUBCOMMAND_SUBSCRIBE);
     pa_tagstruct_put_boolean(t, enable);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c
index d7696df..866d770 100644
--- a/src/pulse/introspect.c
+++ b/src/pulse/introspect.c
@@ -326,7 +326,7 @@ pa_operation* pa_context_get_sink_info_by_index(pa_context *c, uint32_t idx, pa_
     t = pa_tagstruct_command(c, PA_COMMAND_GET_SINK_INFO, &tag);
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_puts(t, NULL);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_sink_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -350,7 +350,7 @@ pa_operation* pa_context_get_sink_info_by_name(pa_context *c, const char *name,
     t = pa_tagstruct_command(c, PA_COMMAND_GET_SINK_INFO, &tag);
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, name);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_sink_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -375,7 +375,7 @@ pa_operation* pa_context_set_sink_port_by_index(pa_context *c, uint32_t idx, con
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_puts(t, NULL);
     pa_tagstruct_puts(t, port);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -400,7 +400,7 @@ pa_operation* pa_context_set_sink_port_by_name(pa_context *c, const char *name,
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, name);
     pa_tagstruct_puts(t, port);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -599,7 +599,7 @@ pa_operation* pa_context_get_source_info_by_index(pa_context *c, uint32_t idx, p
     t = pa_tagstruct_command(c, PA_COMMAND_GET_SOURCE_INFO, &tag);
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_puts(t, NULL);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_source_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -623,7 +623,7 @@ pa_operation* pa_context_get_source_info_by_name(pa_context *c, const char *name
     t = pa_tagstruct_command(c, PA_COMMAND_GET_SOURCE_INFO, &tag);
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, name);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_source_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -648,7 +648,7 @@ pa_operation* pa_context_set_source_port_by_index(pa_context *c, uint32_t idx, c
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_puts(t, NULL);
     pa_tagstruct_puts(t, port);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -673,7 +673,7 @@ pa_operation* pa_context_set_source_port_by_name(pa_context *c, const char *name
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, name);
     pa_tagstruct_puts(t, port);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -752,7 +752,7 @@ pa_operation* pa_context_get_client_info(pa_context *c, uint32_t idx, pa_client_
 
     t = pa_tagstruct_command(c, PA_COMMAND_GET_CLIENT_INFO, &tag);
     pa_tagstruct_putu32(t, idx);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_client_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1010,7 +1010,7 @@ pa_operation* pa_context_get_card_info_by_index(pa_context *c, uint32_t idx, pa_
     t = pa_tagstruct_command(c, PA_COMMAND_GET_CARD_INFO, &tag);
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_puts(t, NULL);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_card_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1035,7 +1035,7 @@ pa_operation* pa_context_get_card_info_by_name(pa_context *c, const char*name, p
     t = pa_tagstruct_command(c, PA_COMMAND_GET_CARD_INFO, &tag);
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, name);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_card_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1066,7 +1066,7 @@ pa_operation* pa_context_set_card_profile_by_index(pa_context *c, uint32_t idx,
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_puts(t, NULL);
     pa_tagstruct_puts(t, profile);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1091,7 +1091,7 @@ pa_operation* pa_context_set_card_profile_by_name(pa_context *c, const char *nam
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, name);
     pa_tagstruct_puts(t, profile);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1172,7 +1172,7 @@ pa_operation* pa_context_get_module_info(pa_context *c, uint32_t idx, pa_module_
 
     t = pa_tagstruct_command(c, PA_COMMAND_GET_MODULE_INFO, &tag);
     pa_tagstruct_putu32(t, idx);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_module_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1277,7 +1277,7 @@ pa_operation* pa_context_get_sink_input_info(pa_context *c, uint32_t idx, pa_sin
 
     t = pa_tagstruct_command(c, PA_COMMAND_GET_SINK_INPUT_INFO, &tag);
     pa_tagstruct_putu32(t, idx);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_sink_input_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1382,7 +1382,7 @@ pa_operation* pa_context_get_source_output_info(pa_context *c, uint32_t idx, pa_
 
     t = pa_tagstruct_command(c, PA_COMMAND_GET_SOURCE_OUTPUT_INFO, &tag);
     pa_tagstruct_putu32(t, idx);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_source_output_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1413,7 +1413,7 @@ pa_operation* pa_context_set_sink_volume_by_index(pa_context *c, uint32_t idx, c
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_puts(t, NULL);
     pa_tagstruct_put_cvolume(t, volume);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1440,7 +1440,7 @@ pa_operation* pa_context_set_sink_volume_by_name(pa_context *c, const char *name
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, name);
     pa_tagstruct_put_cvolume(t, volume);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1463,7 +1463,7 @@ pa_operation* pa_context_set_sink_mute_by_index(pa_context *c, uint32_t idx, int
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_puts(t, NULL);
     pa_tagstruct_put_boolean(t, mute);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1488,7 +1488,7 @@ pa_operation* pa_context_set_sink_mute_by_name(pa_context *c, const char *name,
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, name);
     pa_tagstruct_put_boolean(t, mute);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1513,7 +1513,7 @@ pa_operation* pa_context_set_sink_input_volume(pa_context *c, uint32_t idx, cons
     t = pa_tagstruct_command(c, PA_COMMAND_SET_SINK_INPUT_VOLUME, &tag);
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_put_cvolume(t, volume);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1537,7 +1537,7 @@ pa_operation* pa_context_set_sink_input_mute(pa_context *c, uint32_t idx, int mu
     t = pa_tagstruct_command(c, PA_COMMAND_SET_SINK_INPUT_MUTE, &tag);
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_put_boolean(t, mute);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1562,7 +1562,7 @@ pa_operation* pa_context_set_source_volume_by_index(pa_context *c, uint32_t idx,
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_puts(t, NULL);
     pa_tagstruct_put_cvolume(t, volume);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1589,7 +1589,7 @@ pa_operation* pa_context_set_source_volume_by_name(pa_context *c, const char *na
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, name);
     pa_tagstruct_put_cvolume(t, volume);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1612,7 +1612,7 @@ pa_operation* pa_context_set_source_mute_by_index(pa_context *c, uint32_t idx, i
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_puts(t, NULL);
     pa_tagstruct_put_boolean(t, mute);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1637,7 +1637,7 @@ pa_operation* pa_context_set_source_mute_by_name(pa_context *c, const char *name
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, name);
     pa_tagstruct_put_boolean(t, mute);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1663,7 +1663,7 @@ pa_operation* pa_context_set_source_output_volume(pa_context *c, uint32_t idx, c
     t = pa_tagstruct_command(c, PA_COMMAND_SET_SOURCE_OUTPUT_VOLUME, &tag);
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_put_cvolume(t, volume);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1687,7 +1687,7 @@ pa_operation* pa_context_set_source_output_mute(pa_context *c, uint32_t idx, int
     t = pa_tagstruct_command(c, PA_COMMAND_SET_SOURCE_OUTPUT_MUTE, &tag);
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_put_boolean(t, mute);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1774,7 +1774,7 @@ pa_operation* pa_context_get_sample_info_by_name(pa_context *c, const char *name
     t = pa_tagstruct_command(c, PA_COMMAND_GET_SAMPLE_INFO, &tag);
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, name);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_sample_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1798,7 +1798,7 @@ pa_operation* pa_context_get_sample_info_by_index(pa_context *c, uint32_t idx, p
     t = pa_tagstruct_command(c, PA_COMMAND_GET_SAMPLE_INFO, &tag);
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_puts(t, NULL);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_sample_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1824,7 +1824,7 @@ static pa_operation* command_kill(pa_context *c, uint32_t command, uint32_t idx,
 
     t = pa_tagstruct_command(c, command, &tag);
     pa_tagstruct_putu32(t, idx);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1891,7 +1891,7 @@ pa_operation* pa_context_load_module(pa_context *c, const char*name, const char
     t = pa_tagstruct_command(c, PA_COMMAND_LOAD_MODULE, &tag);
     pa_tagstruct_puts(t, name);
     pa_tagstruct_puts(t, argument);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_index_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -1922,7 +1922,7 @@ pa_operation* pa_context_set_port_latency_offset(pa_context *c, const char *card
     pa_tagstruct_puts(t, card_name);
     pa_tagstruct_puts(t, port_name);
     pa_tagstruct_puts64(t, offset);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -2005,7 +2005,7 @@ pa_operation* pa_context_move_sink_input_by_name(pa_context *c, uint32_t idx, co
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, sink_name);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -2031,7 +2031,7 @@ pa_operation* pa_context_move_sink_input_by_index(pa_context *c, uint32_t idx, u
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_putu32(t, sink_idx);
     pa_tagstruct_puts(t, NULL);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -2057,7 +2057,7 @@ pa_operation* pa_context_move_source_output_by_name(pa_context *c, uint32_t idx,
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, source_name);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -2083,7 +2083,7 @@ pa_operation* pa_context_move_source_output_by_index(pa_context *c, uint32_t idx
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_putu32(t, source_idx);
     pa_tagstruct_puts(t, NULL);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -2108,7 +2108,7 @@ pa_operation* pa_context_suspend_sink_by_name(pa_context *c, const char *sink_na
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, sink_name);
     pa_tagstruct_put_boolean(t, suspend);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -2132,7 +2132,7 @@ pa_operation* pa_context_suspend_sink_by_index(pa_context *c, uint32_t idx, int
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_puts(t, idx == PA_INVALID_INDEX ? "" : NULL);
     pa_tagstruct_put_boolean(t, suspend);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -2157,7 +2157,7 @@ pa_operation* pa_context_suspend_source_by_name(pa_context *c, const char *sourc
     pa_tagstruct_putu32(t, PA_INVALID_INDEX);
     pa_tagstruct_puts(t, source_name);
     pa_tagstruct_put_boolean(t, suspend);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -2181,7 +2181,7 @@ pa_operation* pa_context_suspend_source_by_index(pa_context *c, uint32_t idx, in
     pa_tagstruct_putu32(t, idx);
     pa_tagstruct_puts(t, idx == PA_INVALID_INDEX ? "" : NULL);
     pa_tagstruct_put_boolean(t, suspend);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
diff --git a/src/pulse/scache.c b/src/pulse/scache.c
index 6a26ce5..7387314 100644
--- a/src/pulse/scache.c
+++ b/src/pulse/scache.c
@@ -70,7 +70,7 @@ int pa_stream_connect_upload(pa_stream *s, size_t length) {
     if (s->context->version >= 13)
         pa_tagstruct_put_proplist(t, s->proplist);
 
-    pa_pstream_send_tagstruct(s->context->pstream, t);
+    pa_pstream_send_tagstruct(s->context->pstream, t, NULL);
     pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_create_stream_callback, s, NULL);
 
     pa_stream_set_state(s, PA_STREAM_CREATING);
@@ -94,7 +94,7 @@ int pa_stream_finish_upload(pa_stream *s) {
 
     t = pa_tagstruct_command(s->context, PA_COMMAND_FINISH_UPLOAD_STREAM, &tag);
     pa_tagstruct_putu32(t, s->channel);
-    pa_pstream_send_tagstruct(s->context->pstream, t);
+    pa_pstream_send_tagstruct(s->context->pstream, t, NULL);
     pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_disconnect_callback, s, NULL);
 
     pa_stream_unref(s);
@@ -201,7 +201,7 @@ pa_operation *pa_context_play_sample(pa_context *c, const char *name, const char
         pa_proplist_free(p);
     }
 
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, play_sample_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -244,7 +244,7 @@ pa_operation *pa_context_play_sample_with_proplist(pa_context *c, const char *na
         pa_proplist_free(p);
     }
 
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, play_sample_with_proplist_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -267,7 +267,7 @@ pa_operation* pa_context_remove_sample(pa_context *c, const char *name, pa_conte
     t = pa_tagstruct_command(c, PA_COMMAND_REMOVE_SAMPLE, &tag);
     pa_tagstruct_puts(t, name);
 
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index f549036..408e569 100644
--- a/src/pulse/stream.c
+++ b/src/pulse/stream.c
@@ -1372,7 +1372,7 @@ static int create_stream(
         pa_tagstruct_put_boolean(t, flags & (PA_STREAM_PASSTHROUGH));
     }
 
-    pa_pstream_send_tagstruct(s->context->pstream, t);
+    pa_pstream_send_tagstruct(s->context->pstream, t, NULL);
     pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_create_stream_callback, s, NULL);
 
     pa_stream_set_state(s, PA_STREAM_CREATING);
@@ -1710,7 +1710,7 @@ pa_operation * pa_stream_drain(pa_stream *s, pa_stream_success_cb_t cb, void *us
 
     t = pa_tagstruct_command(s->context, PA_COMMAND_DRAIN_PLAYBACK_STREAM, &tag);
     pa_tagstruct_putu32(t, s->channel);
-    pa_pstream_send_tagstruct(s->context->pstream, t);
+    pa_pstream_send_tagstruct(s->context->pstream, t, NULL);
     pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     /* This might cause the read index to continue again, hence
@@ -1997,7 +1997,7 @@ pa_operation* pa_stream_update_timing_info(pa_stream *s, pa_stream_success_cb_t
     pa_tagstruct_putu32(t, s->channel);
     pa_tagstruct_put_timeval(t, pa_gettimeofday(&now));
 
-    pa_pstream_send_tagstruct(s->context->pstream, t);
+    pa_pstream_send_tagstruct(s->context->pstream, t, NULL);
     pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, stream_get_timing_info_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     if (s->direction == PA_STREAM_PLAYBACK) {
@@ -2060,7 +2060,7 @@ int pa_stream_disconnect(pa_stream *s) {
                         (s->direction == PA_STREAM_RECORD ? PA_COMMAND_DELETE_RECORD_STREAM : PA_COMMAND_DELETE_UPLOAD_STREAM)),
             &tag);
     pa_tagstruct_putu32(t, s->channel);
-    pa_pstream_send_tagstruct(s->context->pstream, t);
+    pa_pstream_send_tagstruct(s->context->pstream, t, NULL);
     pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_disconnect_callback, s, NULL);
 
     pa_stream_unref(s);
@@ -2279,7 +2279,7 @@ pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, voi
             &tag);
     pa_tagstruct_putu32(t, s->channel);
     pa_tagstruct_put_boolean(t, !!b);
-    pa_pstream_send_tagstruct(s->context->pstream, t);
+    pa_pstream_send_tagstruct(s->context->pstream, t, NULL);
     pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     check_smoother_status(s, false, false, false);
@@ -2306,7 +2306,7 @@ static pa_operation* stream_send_simple_command(pa_stream *s, uint32_t command,
 
     t = pa_tagstruct_command(s->context, command, &tag);
     pa_tagstruct_putu32(t, s->channel);
-    pa_pstream_send_tagstruct(s->context->pstream, t);
+    pa_pstream_send_tagstruct(s->context->pstream, t, NULL);
     pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -2435,7 +2435,7 @@ pa_operation* pa_stream_set_name(pa_stream *s, const char *name, pa_stream_succe
                 &tag);
         pa_tagstruct_putu32(t, s->channel);
         pa_tagstruct_puts(t, name);
-        pa_pstream_send_tagstruct(s->context->pstream, t);
+        pa_pstream_send_tagstruct(s->context->pstream, t, NULL);
         pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
     }
 
@@ -2693,7 +2693,7 @@ pa_operation* pa_stream_set_buffer_attr(pa_stream *s, const pa_buffer_attr *attr
     if (s->context->version >= 14)
         pa_tagstruct_put_boolean(t, !!(s->flags & PA_STREAM_EARLY_REQUESTS));
 
-    pa_pstream_send_tagstruct(s->context->pstream, t);
+    pa_pstream_send_tagstruct(s->context->pstream, t, NULL);
     pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, stream_set_buffer_attr_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     /* This might cause changes in the read/write index, hence let's
@@ -2814,7 +2814,7 @@ pa_operation *pa_stream_update_sample_rate(pa_stream *s, uint32_t rate, pa_strea
     pa_tagstruct_putu32(t, s->channel);
     pa_tagstruct_putu32(t, rate);
 
-    pa_pstream_send_tagstruct(s->context->pstream, t);
+    pa_pstream_send_tagstruct(s->context->pstream, t, NULL);
     pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, stream_update_sample_rate_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
@@ -2844,7 +2844,7 @@ pa_operation *pa_stream_proplist_update(pa_stream *s, pa_update_mode_t mode, pa_
     pa_tagstruct_putu32(t, (uint32_t) mode);
     pa_tagstruct_put_proplist(t, p);
 
-    pa_pstream_send_tagstruct(s->context->pstream, t);
+    pa_pstream_send_tagstruct(s->context->pstream, t, NULL);
     pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     /* Please note that we don't update s->proplist here, because we
@@ -2881,7 +2881,7 @@ pa_operation *pa_stream_proplist_remove(pa_stream *s, const char *const keys[],
 
     pa_tagstruct_puts(t, NULL);
 
-    pa_pstream_send_tagstruct(s->context->pstream, t);
+    pa_pstream_send_tagstruct(s->context->pstream, t, NULL);
     pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     /* Please note that we don't update s->proplist here, because we
diff --git a/src/pulse/subscribe.c b/src/pulse/subscribe.c
index a6ad238..90dc6d6 100644
--- a/src/pulse/subscribe.c
+++ b/src/pulse/subscribe.c
@@ -72,7 +72,7 @@ pa_operation* pa_context_subscribe(pa_context *c, pa_subscription_mask_t m, pa_c
 
     t = pa_tagstruct_command(c, PA_COMMAND_SUBSCRIBE, &tag);
     pa_tagstruct_putu32(t, m);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
     pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
 
     return o;
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index ae8982d..99164a4 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -763,7 +763,7 @@ static void record_stream_send_killed(record_stream *r) {
     pa_tagstruct_putu32(t, PA_COMMAND_RECORD_STREAM_KILLED);
     pa_tagstruct_putu32(t, (uint32_t) -1); /* tag */
     pa_tagstruct_putu32(t, r->index);
-    pa_pstream_send_tagstruct(r->connection->pstream, t);
+    pa_pstream_send_tagstruct(r->connection->pstream, t, NULL);
 }
 
 /* Called from main context */
@@ -825,7 +825,7 @@ static int playback_stream_process_msg(pa_msgobject *o, int code, void*userdata,
             pa_tagstruct_putu32(t, (uint32_t) -1); /* tag */
             pa_tagstruct_putu32(t, s->index);
             pa_tagstruct_putu32(t, (uint32_t) l);
-            pa_pstream_send_tagstruct(s->connection->pstream, t);
+            pa_pstream_send_tagstruct(s->connection->pstream, t, NULL);
 
 #ifdef PROTOCOL_NATIVE_DEBUG
             pa_log("Requesting %lu bytes", (unsigned long) l);
@@ -847,7 +847,7 @@ static int playback_stream_process_msg(pa_msgobject *o, int code, void*userdata,
             pa_tagstruct_putu32(t, s->index);
             if (s->connection->version >= 23)
                 pa_tagstruct_puts64(t, offset);
-            pa_pstream_send_tagstruct(s->connection->pstream, t);
+            pa_pstream_send_tagstruct(s->connection->pstream, t, NULL);
             break;
         }
 
@@ -859,7 +859,7 @@ static int playback_stream_process_msg(pa_msgobject *o, int code, void*userdata,
             pa_tagstruct_putu32(t, PA_COMMAND_OVERFLOW);
             pa_tagstruct_putu32(t, (uint32_t) -1); /* tag */
             pa_tagstruct_putu32(t, s->index);
-            pa_pstream_send_tagstruct(s->connection->pstream, t);
+            pa_pstream_send_tagstruct(s->connection->pstream, t, NULL);
             break;
         }
 
@@ -873,7 +873,7 @@ static int playback_stream_process_msg(pa_msgobject *o, int code, void*userdata,
                 pa_tagstruct_putu32(t, PA_COMMAND_STARTED);
                 pa_tagstruct_putu32(t, (uint32_t) -1); /* tag */
                 pa_tagstruct_putu32(t, s->index);
-                pa_pstream_send_tagstruct(s->connection->pstream, t);
+                pa_pstream_send_tagstruct(s->connection->pstream, t, NULL);
             }
 
             break;
@@ -898,7 +898,7 @@ static int playback_stream_process_msg(pa_msgobject *o, int code, void*userdata,
                 pa_tagstruct_putu32(t, s->buffer_attr.prebuf);
                 pa_tagstruct_putu32(t, s->buffer_attr.minreq);
                 pa_tagstruct_put_usec(t, s->configured_sink_latency);
-                pa_pstream_send_tagstruct(s->connection->pstream, t);
+                pa_pstream_send_tagstruct(s->connection->pstream, t, NULL);
             }
 
             break;
@@ -1291,7 +1291,7 @@ static void playback_stream_send_killed(playback_stream *p) {
     pa_tagstruct_putu32(t, PA_COMMAND_PLAYBACK_STREAM_KILLED);
     pa_tagstruct_putu32(t, (uint32_t) -1); /* tag */
     pa_tagstruct_putu32(t, p->index);
-    pa_pstream_send_tagstruct(p->connection->pstream, t);
+    pa_pstream_send_tagstruct(p->connection->pstream, t, NULL);
 }
 
 /* Called from main context */
@@ -1755,7 +1755,7 @@ static void sink_input_send_event_cb(pa_sink_input *i, const char *event, pa_pro
     pa_tagstruct_putu32(t, s->index);
     pa_tagstruct_puts(t, event);
     pa_tagstruct_put_proplist(t, pl);
-    pa_pstream_send_tagstruct(s->connection->pstream, t);
+    pa_pstream_send_tagstruct(s->connection->pstream, t, NULL);
 }
 
 /* Called from main context */
@@ -1775,7 +1775,7 @@ static void sink_input_suspend_cb(pa_sink_input *i, bool suspend) {
     pa_tagstruct_putu32(t, (uint32_t) -1); /* tag */
     pa_tagstruct_putu32(t, s->index);
     pa_tagstruct_put_boolean(t, suspend);
-    pa_pstream_send_tagstruct(s->connection->pstream, t);
+    pa_pstream_send_tagstruct(s->connection->pstream, t, NULL);
 }
 
 /* Called from main context */
@@ -1813,7 +1813,7 @@ static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) {
         pa_tagstruct_put_usec(t, s->configured_sink_latency);
     }
 
-    pa_pstream_send_tagstruct(s->connection->pstream, t);
+    pa_pstream_send_tagstruct(s->connection->pstream, t, NULL);
 }
 
 /*** source_output callbacks ***/
@@ -1893,7 +1893,7 @@ static void source_output_send_event_cb(pa_source_output *o, const char *event,
     pa_tagstruct_putu32(t, s->index);
     pa_tagstruct_puts(t, event);
     pa_tagstruct_put_proplist(t, pl);
-    pa_pstream_send_tagstruct(s->connection->pstream, t);
+    pa_pstream_send_tagstruct(s->connection->pstream, t, NULL);
 }
 
 /* Called from main context */
@@ -1913,7 +1913,7 @@ static void source_output_suspend_cb(pa_source_output *o, bool suspend) {
     pa_tagstruct_putu32(t, (uint32_t) -1); /* tag */
     pa_tagstruct_putu32(t, s->index);
     pa_tagstruct_put_boolean(t, suspend);
-    pa_pstream_send_tagstruct(s->connection->pstream, t);
+    pa_pstream_send_tagstruct(s->connection->pstream, t, NULL);
 }
 
 /* Called from main context */
@@ -1950,7 +1950,7 @@ static void source_output_moving_cb(pa_source_output *o, pa_source *dest) {
         pa_tagstruct_put_usec(t, s->configured_source_latency);
     }
 
-    pa_pstream_send_tagstruct(s->connection->pstream, t);
+    pa_pstream_send_tagstruct(s->connection->pstream, t, NULL);
 }
 
 /*** pdispatch callbacks ***/
@@ -2241,7 +2241,7 @@ static void command_create_playback_stream(pa_pdispatch *pd, uint32_t command, u
         }
     }
 
-    pa_pstream_send_tagstruct(c->pstream, reply);
+    pa_pstream_send_tagstruct(c->pstream, reply, NULL);
 
 finish:
     if (p)
@@ -2555,7 +2555,7 @@ static void command_create_record_stream(pa_pdispatch *pd, uint32_t command, uin
         }
     }
 
-    pa_pstream_send_tagstruct(c->pstream, reply);
+    pa_pstream_send_tagstruct(c->pstream, reply, NULL);
 
 finish:
     if (p)
@@ -2777,7 +2777,7 @@ static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta
     pa_pstream_send_tagstruct_with_creds(c->pstream, reply, &ucred);
 }
 #else
-    pa_pstream_send_tagstruct(c->pstream, reply);
+    pa_pstream_send_tagstruct(c->pstream, reply, NULL);
 #endif
 
     setup_srbchannel(c);
@@ -2818,7 +2818,7 @@ static void command_set_client_name(pa_pdispatch *pd, uint32_t command, uint32_t
     if (c->version >= 13)
         pa_tagstruct_putu32(reply, c->client->index);
 
-    pa_pstream_send_tagstruct(c->pstream, reply);
+    pa_pstream_send_tagstruct(c->pstream, reply, NULL);
 }
 
 static void command_lookup(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
@@ -2855,7 +2855,7 @@ static void command_lookup(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_
         pa_tagstruct *reply;
         reply = reply_new(tag);
         pa_tagstruct_putu32(reply, idx);
-        pa_pstream_send_tagstruct(c->pstream, reply);
+        pa_pstream_send_tagstruct(c->pstream, reply, NULL);
     }
 }
 
@@ -2904,7 +2904,7 @@ static void command_stat(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta
     pa_tagstruct_putu32(reply, (uint32_t) pa_atomic_load(&stat->n_accumulated));
     pa_tagstruct_putu32(reply, (uint32_t) pa_atomic_load(&stat->accumulated_size));
     pa_tagstruct_putu32(reply, (uint32_t) pa_scache_total_size(c->protocol->core));
-    pa_pstream_send_tagstruct(c->pstream, reply);
+    pa_pstream_send_tagstruct(c->pstream, reply, NULL);
 }
 
 static void command_get_playback_latency(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
@@ -2951,7 +2951,7 @@ static void command_get_playback_latency(pa_pdispatch *pd, uint32_t command, uin
         pa_tagstruct_putu64(reply, s->playing_for);
     }
 
-    pa_pstream_send_tagstruct(c->pstream, reply);
+    pa_pstream_send_tagstruct(c->pstream, reply, NULL);
 }
 
 static void command_get_record_latency(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
@@ -2990,7 +2990,7 @@ static void command_get_record_latency(pa_pdispatch *pd, uint32_t command, uint3
     pa_tagstruct_put_timeval(reply, pa_gettimeofday(&now));
     pa_tagstruct_puts64(reply, pa_memblockq_get_write_index(s->memblockq));
     pa_tagstruct_puts64(reply, pa_memblockq_get_read_index(s->memblockq));
-    pa_pstream_send_tagstruct(c->pstream, reply);
+    pa_pstream_send_tagstruct(c->pstream, reply, NULL);
 }
 
 static void command_create_upload_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
@@ -3050,7 +3050,7 @@ static void command_create_upload_stream(pa_pdispatch *pd, uint32_t command, uin
     reply = reply_new(tag);
     pa_tagstruct_putu32(reply, s->index);
     pa_tagstruct_putu32(reply, length);
-    pa_pstream_send_tagstruct(c->pstream, reply);
+    pa_pstream_send_tagstruct(c->pstream, reply, NULL);
 }
 
 static void command_finish_upload_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
@@ -3143,7 +3143,7 @@ static void command_play_sample(pa_pdispatch *pd, uint32_t command, uint32_t tag
     if (c->version >= 13)
         pa_tagstruct_putu32(reply, idx);
 
-    pa_pstream_send_tagstruct(c->pstream, reply);
+    pa_pstream_send_tagstruct(c->pstream, reply, NULL);
 }
 
 static void command_remove_sample(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
@@ -3627,7 +3627,7 @@ static void command_get_info(pa_pdispatch *pd, uint32_t command, uint32_t tag, p
         source_output_fill_tagstruct(c, reply, so);
     else
         scache_fill_tagstruct(c, reply, sce);
-    pa_pstream_send_tagstruct(c->pstream, reply);
+    pa_pstream_send_tagstruct(c->pstream, reply, NULL);
 }
 
 static void command_get_info_list(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
@@ -3691,7 +3691,7 @@ static void command_get_info_list(pa_pdispatch *pd, uint32_t command, uint32_t t
         }
     }
 
-    pa_pstream_send_tagstruct(c->pstream, reply);
+    pa_pstream_send_tagstruct(c->pstream, reply, NULL);
 }
 
 static void command_get_server_info(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
@@ -3737,7 +3737,7 @@ static void command_get_server_info(pa_pdispatch *pd, uint32_t command, uint32_t
     if (c->version >= 15)
         pa_tagstruct_put_channel_map(reply, &c->protocol->core->default_channel_map);
 
-    pa_pstream_send_tagstruct(c->pstream, reply);
+    pa_pstream_send_tagstruct(c->pstream, reply, NULL);
 }
 
 static void subscription_cb(pa_core *core, pa_subscription_event_type_t e, uint32_t idx, void *userdata) {
@@ -3751,7 +3751,7 @@ static void subscription_cb(pa_core *core, pa_subscription_event_type_t e, uint3
     pa_tagstruct_putu32(t, (uint32_t) -1);
     pa_tagstruct_putu32(t, e);
     pa_tagstruct_putu32(t, idx);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
 }
 
 static void command_subscribe(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
@@ -4176,7 +4176,7 @@ static void command_set_stream_buffer_attr(pa_pdispatch *pd, uint32_t command, u
             pa_tagstruct_put_usec(reply, s->configured_source_latency);
     }
 
-    pa_pstream_send_tagstruct(c->pstream, reply);
+    pa_pstream_send_tagstruct(c->pstream, reply, NULL);
 }
 
 static void command_update_stream_sample_rate(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
@@ -4536,7 +4536,7 @@ static void command_load_module(pa_pdispatch *pd, uint32_t command, uint32_t tag
 
     reply = reply_new(tag);
     pa_tagstruct_putu32(reply, m->index);
-    pa_pstream_send_tagstruct(c->pstream, reply);
+    pa_pstream_send_tagstruct(c->pstream, reply, NULL);
 }
 
 static void command_unload_module(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
@@ -5044,7 +5044,7 @@ static void client_send_event_cb(pa_client *client, const char*event, pa_proplis
     pa_tagstruct_putu32(t, (uint32_t) -1); /* tag */
     pa_tagstruct_puts(t, event);
     pa_tagstruct_put_proplist(t, pl);
-    pa_pstream_send_tagstruct(c->pstream, t);
+    pa_pstream_send_tagstruct(c->pstream, t, NULL);
 }
 
 /*** module entry points ***/
diff --git a/src/pulsecore/pstream-util.c b/src/pulsecore/pstream-util.c
index 6c710eb..818f0a1 100644
--- a/src/pulsecore/pstream-util.c
+++ b/src/pulsecore/pstream-util.c
@@ -29,22 +29,6 @@
 
 #include "pstream-util.h"
 
-static void pa_pstream_send_tagstruct_with_ancil_data(pa_pstream *p, pa_tagstruct *t, const pa_cmsg_ancil_data *ancil_data) {
-    size_t length;
-    const uint8_t *data;
-    pa_packet *packet;
-
-    pa_assert(p);
-    pa_assert(t);
-
-    pa_assert_se(data = pa_tagstruct_data(t, &length));
-    pa_assert_se(packet = pa_packet_new_data(data, length));
-    pa_tagstruct_free(t);
-
-    pa_pstream_send_packet(p, packet, ancil_data);
-    pa_packet_unref(packet);
-}
-
 #ifdef HAVE_CREDS
 
 void pa_pstream_send_tagstruct_with_creds(pa_pstream *p, pa_tagstruct *t, const pa_creds *creds) {
@@ -54,10 +38,10 @@ void pa_pstream_send_tagstruct_with_creds(pa_pstream *p, pa_tagstruct *t, const
         a.nfd = 0;
         a.creds_valid = true;
         a.creds = *creds;
-        pa_pstream_send_tagstruct_with_ancil_data(p, t, &a);
+        pa_pstream_send_tagstruct(p, t, &a);
     }
     else
-        pa_pstream_send_tagstruct_with_ancil_data(p, t, NULL);
+        pa_pstream_send_tagstruct(p, t, NULL);
 }
 
 void pa_pstream_send_tagstruct_with_fds(pa_pstream *p, pa_tagstruct *t, int nfd, const int *fds) {
@@ -68,16 +52,16 @@ void pa_pstream_send_tagstruct_with_fds(pa_pstream *p, pa_tagstruct *t, int nfd,
         a.creds_valid = false;
         pa_assert(nfd <= MAX_ANCIL_DATA_FDS);
         memcpy(a.fds, fds, sizeof(int) * nfd);
-        pa_pstream_send_tagstruct_with_ancil_data(p, t, &a);
+        pa_pstream_send_tagstruct(p, t, &a);
     }
     else
-        pa_pstream_send_tagstruct_with_ancil_data(p, t, NULL);
+        pa_pstream_send_tagstruct(p, t, NULL);
 }
 
 #else
 
 void pa_pstream_send_tagstruct_with_creds(pa_pstream *p, pa_tagstruct *t, const pa_creds *creds) {
-    pa_pstream_send_tagstruct_with_ancil_data(p, t, NULL);
+    pa_pstream_send_tagstruct(p, t, NULL);
 }
 
 void pa_pstream_send_tagstruct_with_fds(pa_pstream *p, pa_tagstruct *t, int nfd, const int *fds) {
@@ -93,7 +77,7 @@ void pa_pstream_send_error(pa_pstream *p, uint32_t tag, uint32_t error) {
     pa_tagstruct_putu32(t, PA_COMMAND_ERROR);
     pa_tagstruct_putu32(t, tag);
     pa_tagstruct_putu32(t, error);
-    pa_pstream_send_tagstruct(p, t);
+    pa_pstream_send_tagstruct(p, t, NULL);
 }
 
 void pa_pstream_send_simple_ack(pa_pstream *p, uint32_t tag) {
@@ -102,5 +86,5 @@ void pa_pstream_send_simple_ack(pa_pstream *p, uint32_t tag) {
     pa_assert_se(t = pa_tagstruct_new());
     pa_tagstruct_putu32(t, PA_COMMAND_REPLY);
     pa_tagstruct_putu32(t, tag);
-    pa_pstream_send_tagstruct(p, t);
+    pa_pstream_send_tagstruct(p, t, NULL);
 }
diff --git a/src/pulsecore/pstream-util.h b/src/pulsecore/pstream-util.h
index 7ea89ba..ab47050 100644
--- a/src/pulsecore/pstream-util.h
+++ b/src/pulsecore/pstream-util.h
@@ -31,8 +31,6 @@
 void pa_pstream_send_tagstruct_with_creds(pa_pstream *p, pa_tagstruct *t, const pa_creds *creds);
 void pa_pstream_send_tagstruct_with_fds(pa_pstream *p, pa_tagstruct *t, int nfd, const int *fds);
 
-#define pa_pstream_send_tagstruct(p, t) pa_pstream_send_tagstruct_with_creds((p), (t), NULL)
-
 void pa_pstream_send_error(pa_pstream *p, uint32_t tag, uint32_t error);
 void pa_pstream_send_simple_ack(pa_pstream *p, uint32_t tag);
 
diff --git a/src/pulsecore/pstream.c b/src/pulsecore/pstream.c
index f8217b3..4d0894c 100644
--- a/src/pulsecore/pstream.c
+++ b/src/pulsecore/pstream.c
@@ -87,6 +87,7 @@ PA_STATIC_FLIST_DECLARE(items, 0, pa_xfree);
 struct item_info {
     enum {
         PA_PSTREAM_ITEM_PACKET,
+        PA_PSTREAM_ITEM_TAGSTRUCT,
         PA_PSTREAM_ITEM_MEMBLOCK,
         PA_PSTREAM_ITEM_SHMRELEASE,
         PA_PSTREAM_ITEM_SHMREVOKE
@@ -96,6 +97,9 @@ struct item_info {
         /* packet info */
         pa_packet *packet;
 
+        /* tagstruct info */
+        pa_tagstruct *tagstruct;
+
         /* release/revoke info */
         uint32_t block_id;
 
@@ -295,6 +299,9 @@ static void item_free(void *item) {
     } else if (i->type == PA_PSTREAM_ITEM_PACKET) {
         pa_assert(i->per_type.packet);
         pa_packet_unref(i->per_type.packet);
+    } else if (i->type == PA_PSTREAM_ITEM_TAGSTRUCT) {
+        pa_assert(i->per_type.tagstruct);
+        pa_tagstruct_free(i->per_type.tagstruct);
     }
 
     if (pa_flist_push(PA_STATIC_FLIST_GET(items), i) < 0)
@@ -368,6 +375,20 @@ void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, const pa_cmsg_ancil
     pa_pstream_send_item(p, i, ancil_data);
 }
 
+void pa_pstream_send_tagstruct(pa_pstream*p, pa_tagstruct *tagstruct, const pa_cmsg_ancil_data *ancil_data) {
+    struct item_info *i;
+
+    pa_assert(tagstruct);
+
+    if (!(i = pa_flist_pop(PA_STATIC_FLIST_GET(items))))
+        i = pa_xnew(struct item_info, 1);
+
+    i->type = PA_PSTREAM_ITEM_TAGSTRUCT;
+    i->per_type.tagstruct = tagstruct;
+
+    pa_pstream_send_item(p, i, ancil_data);
+}
+
 void pa_pstream_send_memblock(pa_pstream*p, uint32_t channel, int64_t offset, pa_seek_mode_t seek_mode, const pa_memchunk *chunk) {
     size_t length, idx;
     size_t bsm;
@@ -518,6 +539,19 @@ static void prepare_next_write_item(pa_pstream *p) {
             p->write.minibuf_validsize = PA_PSTREAM_DESCRIPTOR_SIZE + plen;
         }
 
+    } else if (p->write.current->type == PA_PSTREAM_ITEM_TAGSTRUCT) {
+        size_t tlen;
+
+        pa_assert(p->write.current->per_type.tagstruct);
+
+        p->write.data = (void *) pa_tagstruct_data(p->write.current->per_type.tagstruct, &tlen);
+        p->write.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH] = htonl((uint32_t) tlen);
+
+        if (tlen <= MINIBUF_SIZE - PA_PSTREAM_DESCRIPTOR_SIZE) {
+            memcpy(&p->write.minibuf[PA_PSTREAM_DESCRIPTOR_SIZE], p->write.data, tlen);
+            p->write.minibuf_validsize = PA_PSTREAM_DESCRIPTOR_SIZE + tlen;
+        }
+
     } else if (p->write.current->type == PA_PSTREAM_ITEM_SHMRELEASE) {
 
         p->write.descriptor[PA_PSTREAM_DESCRIPTOR_FLAGS] = htonl(PA_FLAG_SHMRELEASE);
diff --git a/src/pulsecore/pstream.h b/src/pulsecore/pstream.h
index cbea237..3f489cc 100644
--- a/src/pulsecore/pstream.h
+++ b/src/pulsecore/pstream.h
@@ -29,6 +29,7 @@
 #include <pulse/def.h>
 
 #include <pulsecore/packet.h>
+#include <pulsecore/tagstruct.h>
 #include <pulsecore/memblock.h>
 #include <pulsecore/iochannel.h>
 #include <pulsecore/srbchannel.h>
@@ -50,6 +51,7 @@ void pa_pstream_unref(pa_pstream*p);
 
 void pa_pstream_unlink(pa_pstream *p);
 
+void pa_pstream_send_tagstruct(pa_pstream*p, pa_tagstruct *tagstruct, const pa_cmsg_ancil_data *ancil_data);
 void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet, const pa_cmsg_ancil_data *ancil_data);
 void pa_pstream_send_memblock(pa_pstream*p, uint32_t channel, int64_t offset, pa_seek_mode_t seek, const pa_memchunk *chunk);
 void pa_pstream_send_release(pa_pstream *p, uint32_t block_id);
-- 
1.9.1



More information about the pulseaudio-discuss mailing list