summaryrefslogtreecommitdiffstats
path: root/src/pulse/introspect.c
diff options
context:
space:
mode:
authorTanu Kaskinen <tanuk@iki.fi>2009-08-16 21:25:48 +0300
committerTanu Kaskinen <tanuk@iki.fi>2009-08-16 21:25:48 +0300
commitbcaba0b1b43d6a1b32aadfa98860f40b2c93e136 (patch)
tree6bd0d60a8fa822bfd688b90d062d0f73eee2e47e /src/pulse/introspect.c
parent2bb3eef414f80189cf6af6cd66c519630e4c0a43 (diff)
parent01e4b61a910afdd21f860fadbe98075735c2bf51 (diff)
Merge branch 'master' of git://0pointer.de/pulseaudio into dbus-work
Conflicts: src/Makefile.am src/daemon/daemon-conf.c src/daemon/daemon.conf.in src/modules/module-stream-restore.c src/pulse/client-conf.c src/pulsecore/namereg.c
Diffstat (limited to 'src/pulse/introspect.c')
-rw-r--r--src/pulse/introspect.c132
1 files changed, 72 insertions, 60 deletions
diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c
index ab67f596..27a587cb 100644
--- a/src/pulse/introspect.c
+++ b/src/pulse/introspect.c
@@ -201,42 +201,44 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
goto finish;
}
- if (i.n_ports > 0) {
- i.ports = pa_xnew(pa_sink_port_info*, i.n_ports+1);
- i.ports[0] = pa_xnew(pa_sink_port_info, i.n_ports);
-
- for (j = 0; j < i.n_ports; j++) {
- if (pa_tagstruct_gets(t, &i.ports[0][j].name) < 0 ||
- pa_tagstruct_gets(t, &i.ports[0][j].description) < 0 ||
- pa_tagstruct_getu32(t, &i.ports[0][j].priority) < 0) {
-
- pa_context_fail(o->context, PA_ERR_PROTOCOL);
- pa_xfree(i.ports);
- pa_xfree(i.ports[0]);
- pa_proplist_free(i.proplist);
- goto finish;
+ if (o->context->version >= 16) {
+ if (i.n_ports > 0) {
+ i.ports = pa_xnew(pa_sink_port_info*, i.n_ports+1);
+ i.ports[0] = pa_xnew(pa_sink_port_info, i.n_ports);
+
+ for (j = 0; j < i.n_ports; j++) {
+ if (pa_tagstruct_gets(t, &i.ports[0][j].name) < 0 ||
+ pa_tagstruct_gets(t, &i.ports[0][j].description) < 0 ||
+ pa_tagstruct_getu32(t, &i.ports[0][j].priority) < 0) {
+
+ pa_context_fail(o->context, PA_ERR_PROTOCOL);
+ pa_xfree(i.ports[0]);
+ pa_xfree(i.ports);
+ pa_proplist_free(i.proplist);
+ goto finish;
+ }
+
+ i.ports[j] = &i.ports[0][j];
}
- i.ports[j] = &i.ports[0][j];
+ i.ports[j] = NULL;
}
- i.ports[j] = NULL;
- }
-
- if (pa_tagstruct_gets(t, &ap) < 0) {
- pa_context_fail(o->context, PA_ERR_PROTOCOL);
- pa_xfree(i.ports[0]);
- pa_xfree(i.ports);
- pa_proplist_free(i.proplist);
- goto finish;
- }
+ if (pa_tagstruct_gets(t, &ap) < 0) {
+ pa_context_fail(o->context, PA_ERR_PROTOCOL);
+ pa_xfree(i.ports[0]);
+ pa_xfree(i.ports);
+ pa_proplist_free(i.proplist);
+ goto finish;
+ }
- if (ap) {
- for (j = 0; j < i.n_ports; j++)
- if (pa_streq(i.ports[j]->name, ap)) {
- i.active_port = i.ports[j];
- break;
- }
+ if (ap) {
+ for (j = 0; j < i.n_ports; j++)
+ if (pa_streq(i.ports[j]->name, ap)) {
+ i.active_port = i.ports[j];
+ break;
+ }
+ }
}
i.mute = (int) mute;
@@ -248,6 +250,10 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
cb(o->context, &i, 0, o->userdata);
}
+ if (i.ports) {
+ pa_xfree(i.ports[0]);
+ pa_xfree(i.ports);
+ }
pa_proplist_free(i.proplist);
}
}
@@ -428,42 +434,44 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
goto finish;
}
- if (i.n_ports > 0) {
- i.ports = pa_xnew(pa_source_port_info*, i.n_ports+1);
- i.ports[0] = pa_xnew(pa_source_port_info, i.n_ports);
+ if (o->context->version >= 16) {
+ if (i.n_ports > 0) {
+ i.ports = pa_xnew(pa_source_port_info*, i.n_ports+1);
+ i.ports[0] = pa_xnew(pa_source_port_info, i.n_ports);
- for (j = 0; j < i.n_ports; j++) {
- if (pa_tagstruct_gets(t, &i.ports[0][j].name) < 0 ||
- pa_tagstruct_gets(t, &i.ports[0][j].description) < 0 ||
- pa_tagstruct_getu32(t, &i.ports[0][j].priority) < 0) {
+ for (j = 0; j < i.n_ports; j++) {
+ if (pa_tagstruct_gets(t, &i.ports[0][j].name) < 0 ||
+ pa_tagstruct_gets(t, &i.ports[0][j].description) < 0 ||
+ pa_tagstruct_getu32(t, &i.ports[0][j].priority) < 0) {
- pa_context_fail(o->context, PA_ERR_PROTOCOL);
- pa_xfree(i.ports[0]);
- pa_xfree(i.ports);
- pa_proplist_free(i.proplist);
- goto finish;
+ pa_context_fail(o->context, PA_ERR_PROTOCOL);
+ pa_xfree(i.ports[0]);
+ pa_xfree(i.ports);
+ pa_proplist_free(i.proplist);
+ goto finish;
+ }
+
+ i.ports[j] = &i.ports[0][j];
}
- i.ports[j] = &i.ports[0][j];
+ i.ports[j] = NULL;
}
- i.ports[j] = NULL;
- }
-
- if (pa_tagstruct_gets(t, &ap) < 0) {
- pa_context_fail(o->context, PA_ERR_PROTOCOL);
- pa_xfree(i.ports[0]);
- pa_xfree(i.ports);
- pa_proplist_free(i.proplist);
- goto finish;
- }
+ if (pa_tagstruct_gets(t, &ap) < 0) {
+ pa_context_fail(o->context, PA_ERR_PROTOCOL);
+ pa_xfree(i.ports[0]);
+ pa_xfree(i.ports);
+ pa_proplist_free(i.proplist);
+ goto finish;
+ }
- if (ap) {
- for (j = 0; j < i.n_ports; j++)
- if (pa_streq(i.ports[j]->name, ap)) {
- i.active_port = i.ports[j];
- break;
- }
+ if (ap) {
+ for (j = 0; j < i.n_ports; j++)
+ if (pa_streq(i.ports[j]->name, ap)) {
+ i.active_port = i.ports[j];
+ break;
+ }
+ }
}
i.mute = (int) mute;
@@ -475,6 +483,10 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
cb(o->context, &i, 0, o->userdata);
}
+ if (i.ports) {
+ pa_xfree(i.ports[0]);
+ pa_xfree(i.ports);
+ }
pa_proplist_free(i.proplist);
}
}