From 7ebc5033637d7f0ca8ece80259d8a5dc6b30557b Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Sun, 15 May 2011 09:54:17 +0530 Subject: module-tunnel: Update for recent protocol changes This updates the tunnel module for protocol version >= 19. module-tunnel-sink does not proxy server-side passthrough support (yet). This would require a few more changes, namely keeping track of what formats are available and if any other sink inputs are connected on the server-side. --- src/modules/module-tunnel.c | 59 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'src/modules') diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c index 6cb22e03..1b2d3a1a 100644 --- a/src/modules/module-tunnel.c +++ b/src/modules/module-tunnel.c @@ -1095,6 +1095,23 @@ static void sink_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_t } } + 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++) { + if (pa_tagstruct_get_format_info(t, &format)) { /* format info */ + pa_log("Parse failure"); + goto fail; + } + } + } + if (!pa_tagstruct_eof(t)) { pa_log("Packet too long"); goto fail; @@ -1128,6 +1145,7 @@ static void sink_input_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag pa_channel_map channel_map; pa_cvolume volume; pa_proplist *pl; + pa_bool_t b; pa_assert(pd); pa_assert(u); @@ -1175,6 +1193,33 @@ static void sink_input_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag } } + if (u->version >= 19) { + if (pa_tagstruct_get_boolean(t, &b) < 0) { + + pa_log("Parse failure"); + goto fail; + } + } + + if (u->version >= 20) { + if (pa_tagstruct_get_boolean(t, &b) < 0 || + pa_tagstruct_get_boolean(t, &b) < 0) { + + pa_log("Parse failure"); + goto fail; + } + } + + if (u->version >= 21) { + pa_format_info format; + + if (pa_tagstruct_get_format_info(t, &format) < 0) { + + pa_log("Parse failure"); + goto fail; + } + } + if (!pa_tagstruct_eof(t)) { pa_log("Packet too long"); goto fail; @@ -1491,6 +1536,13 @@ static void create_stream_callback(pa_pdispatch *pd, uint32_t command, uint32_t /* #endif */ } + if (u->version >= 21) { + pa_format_info format; + + if (pa_tagstruct_get_format_info(t, &format) < 0) + goto parse_error; + } + if (!pa_tagstruct_eof(t)) goto parse_error; @@ -1693,6 +1745,13 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t pa_tagstruct_put_boolean(reply, FALSE); /* passthrough stream */ #endif +#ifdef TUNNEL_SINK + if (u->version >= 21) { + /* We're not using the extended API, so n_formats = 0 and that's that */ + pa_tagstruct_putu8(t, 0); + } +#endif + pa_pstream_send_tagstruct(u->pstream, reply); pa_pdispatch_register_reply(u->pdispatch, tag, DEFAULT_TIMEOUT, create_stream_callback, u, NULL); -- cgit