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 */
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");
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;
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);
/* 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);
u->pdispatch = pa_pdispatch_new(u->core->mainloop, TRUE, command_table, PA_COMMAND_MAX);
pa_pstream_set_die_callback(u->pstream, pstream_die_callback, u);
- pa_pstream_set_recieve_packet_callback(u->pstream, pstream_packet_callback, u);
+ pa_pstream_set_receive_packet_callback(u->pstream, pstream_packet_callback, u);
#ifndef TUNNEL_SINK
- pa_pstream_set_recieve_memblock_callback(u->pstream, pstream_memblock_callback, u);
+ pa_pstream_set_receive_memblock_callback(u->pstream, pstream_memblock_callback, u);
#endif
t = pa_tagstruct_new(NULL, 0);
u->rtpoll = pa_rtpoll_new();
pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll);
- if (!(u->auth_cookie = pa_auth_cookie_get(u->core, pa_modargs_get_value(ma, "cookie", PA_NATIVE_COOKIE_FILE), PA_NATIVE_COOKIE_LENGTH)))
+ if (!(u->auth_cookie = pa_auth_cookie_get(u->core, pa_modargs_get_value(ma, "cookie", PA_NATIVE_COOKIE_FILE), TRUE, PA_NATIVE_COOKIE_LENGTH)))
goto fail;
if (!(u->server_name = pa_xstrdup(pa_modargs_get_value(ma, "server", NULL)))) {