introspect: Expose port info per card to clients

For volume control UIs to be able to show ports in inactive profiles,
expose all ports together with the card info. This includes updating
the protocol and the client API to show the connection between ports
and for which profiles the ports are relevant.

Update protocol to 26.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
David Henningsson 2012-02-23 07:17:06 +01:00 committed by Arun Raghavan
parent 752ae7285e
commit 793f46320e
7 changed files with 207 additions and 7 deletions

View file

@ -3258,6 +3258,36 @@ static void card_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_car
pa_tagstruct_puts(t, card->active_profile ? card->active_profile->name : NULL);
pa_tagstruct_put_proplist(t, card->proplist);
if (c->version < 26)
return;
if (card->ports) {
pa_device_port* port;
pa_proplist* proplist = pa_proplist_new(); /* For now - push an empty proplist */
pa_tagstruct_putu32(t, pa_hashmap_size(card->ports));
PA_HASHMAP_FOREACH(port, card->ports, state) {
pa_tagstruct_puts(t, port->name);
pa_tagstruct_puts(t, port->description);
pa_tagstruct_putu32(t, port->priority);
pa_tagstruct_putu32(t, port->available);
pa_tagstruct_putu8(t, /* FIXME: port->direction */ (port->is_input ? PA_DIRECTION_INPUT : 0) | (port->is_output ? PA_DIRECTION_OUTPUT : 0));
pa_tagstruct_put_proplist(t, proplist);
if (port->profiles) {
void* state2;
pa_tagstruct_putu32(t, pa_hashmap_size(port->profiles));
PA_HASHMAP_FOREACH(p, port->profiles, state2)
pa_tagstruct_puts(t, p->name);
} else
pa_tagstruct_putu32(t, 0);
}
pa_proplist_free(proplist);
} else
pa_tagstruct_putu32(t, 0);
}
static void module_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_module *module) {