summaryrefslogtreecommitdiffstats
path: root/src/pulse
diff options
context:
space:
mode:
authorArun Raghavan <arun.raghavan@collabora.co.uk>2011-03-08 23:30:24 +0530
committerArun Raghavan <arun.raghavan@collabora.co.uk>2011-05-02 11:55:39 +0530
commit322980e2e3844abf837dcc8cc5317406b3d8cb94 (patch)
tree3d18986461d595d75e88d826cc2dc77b2562582d /src/pulse
parentdedbc942ab2090320856c36d6673db12026efdc1 (diff)
introspect: Get formats for sinks
This gets the list of supported formats for a sink in pa_context_get_sink_info*(). Also prints these in 'pactl list'.
Diffstat (limited to 'src/pulse')
-rw-r--r--src/pulse/introspect.c34
-rw-r--r--src/pulse/introspect.h3
2 files changed, 37 insertions, 0 deletions
diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c
index c93fb062..28a6bf4a 100644
--- a/src/pulse/introspect.c
+++ b/src/pulse/introspect.c
@@ -240,6 +240,33 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
}
}
+ if (o->context->version >= 21) {
+ i.formats = NULL;
+
+ if (pa_tagstruct_getu8(t, &i.n_formats)) {
+ pa_context_fail(o->context, PA_ERR_PROTOCOL);
+ pa_proplist_free(i.proplist);
+ goto finish;
+ }
+
+ pa_assert(i.n_formats > 0);
+ i.formats = pa_xnew0(pa_format_info*, i.n_formats);
+
+ for (j = 0; j < i.n_formats; j++) {
+ i.formats[j] = pa_format_info_new();
+ if (pa_tagstruct_get_format_info(t, i.formats[j]) < 0) {
+ do {
+ pa_format_info_free(i.formats[j]);
+ } while (j--);
+ pa_xfree(i.formats);
+
+ pa_context_fail(o->context, PA_ERR_PROTOCOL);
+ pa_proplist_free(i.proplist);
+ goto finish;
+ }
+ }
+ }
+
i.mute = (int) mute;
i.flags = (pa_sink_flags_t) flags;
i.state = (pa_sink_state_t) state;
@@ -253,6 +280,13 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
pa_xfree(i.ports[0]);
pa_xfree(i.ports);
}
+
+ if (i.formats) {
+ for (j = 0; j < i.n_formats; j++)
+ pa_format_info_free(i.formats[j]);
+ pa_xfree(i.formats);
+ }
+
pa_proplist_free(i.proplist);
}
}
diff --git a/src/pulse/introspect.h b/src/pulse/introspect.h
index 297b4bac..49c1de63 100644
--- a/src/pulse/introspect.h
+++ b/src/pulse/introspect.h
@@ -32,6 +32,7 @@
#include <pulse/channelmap.h>
#include <pulse/volume.h>
#include <pulse/proplist.h>
+#include <pulse/format.h>
#include <pulse/version.h>
/** \page introspect Server Query and Control
@@ -230,6 +231,8 @@ typedef struct pa_sink_info {
uint32_t n_ports; /**< Number of entries in port array \since 0.9.16 */
pa_sink_port_info** ports; /**< Array of available ports, or NULL. Array is terminated by an entry set to NULL. The number of entries is stored in n_ports \since 0.9.16 */
pa_sink_port_info* active_port; /**< Pointer to active port in the array, or NULL \since 0.9.16 */
+ uint8_t n_formats; /**< Number of formats supported by the sink. \since 1.0 */
+ pa_format_info **formats; /**< Array of formats supported by the sink. \since 1.0 */
} pa_sink_info;
/** Callback prototype for pa_context_get_sink_info_by_name() and friends */