diff options
author | Arun Raghavan <arun.raghavan@collabora.co.uk> | 2011-05-15 09:54:17 +0530 |
---|---|---|
committer | Arun Raghavan <arun.raghavan@collabora.co.uk> | 2011-05-15 10:09:35 +0530 |
commit | 7ebc5033637d7f0ca8ece80259d8a5dc6b30557b (patch) | |
tree | c351eda70c5e2bf33b2f5d4f6476bd72663a0865 /src/modules/module-tunnel.c | |
parent | cebb4e031d3ec5c99b1d633d6582d35b3379a6cc (diff) |
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.
Diffstat (limited to 'src/modules/module-tunnel.c')
-rw-r--r-- | src/modules/module-tunnel.c | 59 |
1 files changed, 59 insertions, 0 deletions
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); |