summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-02-18 22:11:50 +0100
committerLennart Poettering <lennart@poettering.net>2009-02-18 22:11:50 +0100
commit6db307360b7ef95211aff13548206464e8909882 (patch)
tree2267ee57ac8a2fa1738aea134cb5d503cf8abe62 /src
parent7b8bed3e285f31537aa39f88600e59b749ac6508 (diff)
export card information for sinks/sources and number of sinks/sources a profile would create to clients
Diffstat (limited to 'src')
-rw-r--r--src/pulse/introspect.c12
-rw-r--r--src/pulse/introspect.h4
-rw-r--r--src/pulsecore/protocol-native.c4
3 files changed, 17 insertions, 3 deletions
diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c
index 1d50939c..04bcd4f5 100644
--- a/src/pulse/introspect.c
+++ b/src/pulse/introspect.c
@@ -162,6 +162,7 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
i.n_volume_steps = PA_VOLUME_NORM+1;
mute = FALSE;
state = PA_SINK_INVALID_STATE;
+ i.card = PA_INVALID_INDEX;
if (pa_tagstruct_getu32(t, &i.index) < 0 ||
pa_tagstruct_gets(t, &i.name) < 0 ||
@@ -182,7 +183,8 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
(o->context->version >= 15 &&
(pa_tagstruct_get_volume(t, &i.base_volume) < 0 ||
pa_tagstruct_getu32(t, &state) < 0 ||
- pa_tagstruct_getu32(t, &i.n_volume_steps) < 0))) {
+ pa_tagstruct_getu32(t, &i.n_volume_steps) < 0 ||
+ pa_tagstruct_getu32(t, &i.card) < 0))) {
pa_context_fail(o->context, PA_ERR_PROTOCOL);
pa_proplist_free(i.proplist);
@@ -293,6 +295,7 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
i.n_volume_steps = PA_VOLUME_NORM+1;
mute = FALSE;
state = PA_SOURCE_INVALID_STATE;
+ i.card = PA_INVALID_INDEX;
if (pa_tagstruct_getu32(t, &i.index) < 0 ||
pa_tagstruct_gets(t, &i.name) < 0 ||
@@ -313,7 +316,8 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
(o->context->version >= 15 &&
(pa_tagstruct_get_volume(t, &i.base_volume) < 0 ||
pa_tagstruct_getu32(t, &state) < 0 ||
- pa_tagstruct_getu32(t, &i.n_volume_steps) < 0))) {
+ pa_tagstruct_getu32(t, &i.n_volume_steps) < 0 ||
+ pa_tagstruct_getu32(t, &i.card) < 0))) {
pa_context_fail(o->context, PA_ERR_PROTOCOL);
pa_proplist_free(i.proplist);
@@ -517,7 +521,9 @@ static void context_get_card_info_callback(pa_pdispatch *pd, uint32_t command, u
for (j = 0; j < i.n_profiles; j++) {
if (pa_tagstruct_gets(t, &i.profiles[j].name) < 0 ||
- pa_tagstruct_gets(t, &i.profiles[j].description) < 0) {
+ pa_tagstruct_gets(t, &i.profiles[j].description) < 0 ||
+ pa_tagstruct_getu32(t, &i.profiles[j].n_sinks) < 0 ||
+ pa_tagstruct_getu32(t, &i.profiles[j].n_sources)< 0) {
pa_context_fail(o->context, PA_ERR_PROTOCOL);
pa_xfree(i.profiles);
diff --git a/src/pulse/introspect.h b/src/pulse/introspect.h
index badc787e..b873a84a 100644
--- a/src/pulse/introspect.h
+++ b/src/pulse/introspect.h
@@ -215,6 +215,7 @@ typedef struct pa_sink_info {
pa_volume_t base_volume; /**< Some kind of "base" volume that refers to unamplified/unattenuated volume in the context of the output device. \since 0.9.15 */
pa_sink_state_t state; /**< State \since 0.9.15 */
uint32_t n_volume_steps; /**< Number of volume steps for sinks which do not support arbitrary volumes. \since 0.9.15 */
+ uint32_t card; /**< Card index, or PA_INVALID_INDEX. \since 0.9.15 */
} pa_sink_info;
/** Callback prototype for pa_context_get_sink_info_by_name() and friends */
@@ -273,6 +274,7 @@ typedef struct pa_source_info {
pa_volume_t base_volume; /**< Some kind of "base" volume that refers to unamplified/unattenuated volume in the context of the input device. \since 0.9.15 */
pa_source_state_t state; /**< State \since 0.9.15 */
uint32_t n_volume_steps; /**< Number of volume steps for sources which do not support arbitrary volumes. \since 0.9.15 */
+ uint32_t card; /**< Card index, or PA_INVALID_INDEX. \since 0.9.15 */
} pa_source_info;
/** Callback prototype for pa_context_get_source_info_by_name() and friends */
@@ -396,6 +398,8 @@ pa_operation* pa_context_kill_client(pa_context *c, uint32_t idx, pa_context_suc
typedef struct pa_card_profile_info {
const char *name; /**< Name of this profile */
const char *description; /**< Description of this profile */
+ uint32_t n_sinks; /**< Number of sinks this profile would create */
+ uint32_t n_sources; /**< Number of sources this profile would create */
} pa_card_profile_info;
/** Stores information about cards. Please note that this structure
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index fd7d9368..79b9b069 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -2749,6 +2749,7 @@ static void sink_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_sin
pa_log_error("Internal sink state is invalid.");
pa_tagstruct_putu32(t, pa_sink_get_state(sink));
pa_tagstruct_putu32(t, sink->n_volume_steps);
+ pa_tagstruct_putu32(t, sink->card ? sink->card->index : PA_INVALID_INDEX);
}
}
@@ -2788,6 +2789,7 @@ static void source_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_s
pa_log_error("Internal source state is invalid.");
pa_tagstruct_putu32(t, pa_source_get_state(source));
pa_tagstruct_putu32(t, source->n_volume_steps);
+ pa_tagstruct_putu32(t, source->card ? source->card->index : PA_INVALID_INDEX);
}
}
@@ -2822,6 +2824,8 @@ static void card_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_car
while ((p = pa_hashmap_iterate(card->profiles, &state, NULL))) {
pa_tagstruct_puts(t, p->name);
pa_tagstruct_puts(t, p->description);
+ pa_tagstruct_putu32(t, p->n_sinks);
+ pa_tagstruct_putu32(t, p->n_sources);
}
}