mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
Assume that the ports hashmap of cards is always non-NULL.
The hashmap is created in pa_card_new_data_init().
This commit is contained in:
parent
d184b54d7c
commit
8239fca09f
3 changed files with 18 additions and 24 deletions
|
|
@ -142,7 +142,7 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port
|
|||
pa_log_debug("finding port %s", port->name);
|
||||
|
||||
PA_IDXSET_FOREACH(card, c->cards, state)
|
||||
if (card->ports && port == pa_hashmap_get(card->ports, port->name))
|
||||
if (port == pa_hashmap_get(card->ports, port->name))
|
||||
break;
|
||||
|
||||
if (!card) {
|
||||
|
|
@ -211,9 +211,6 @@ static void handle_all_unavailable(pa_core *core) {
|
|||
pa_device_port *port;
|
||||
void *state2;
|
||||
|
||||
if (!card->ports)
|
||||
continue;
|
||||
|
||||
PA_HASHMAP_FOREACH(port, card->ports, state2) {
|
||||
if (port->available == PA_PORT_AVAILABLE_NO)
|
||||
port_available_hook_callback(core, port, NULL);
|
||||
|
|
|
|||
|
|
@ -120,7 +120,9 @@ static void append_port_list(pa_strbuf *s, pa_hashmap *ports)
|
|||
pa_device_port *p;
|
||||
void *state;
|
||||
|
||||
if (!ports)
|
||||
pa_assert(ports);
|
||||
|
||||
if (pa_hashmap_isempty(ports))
|
||||
return;
|
||||
|
||||
pa_strbuf_puts(s, "\tports:\n");
|
||||
|
|
|
|||
|
|
@ -3230,6 +3230,7 @@ static void client_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_c
|
|||
static void card_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_card *card) {
|
||||
void *state = NULL;
|
||||
pa_card_profile *p;
|
||||
pa_device_port *port;
|
||||
|
||||
pa_assert(t);
|
||||
pa_assert(card);
|
||||
|
|
@ -3255,29 +3256,23 @@ static void card_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_car
|
|||
if (c->version < 26)
|
||||
return;
|
||||
|
||||
if (card->ports) {
|
||||
pa_device_port* port;
|
||||
pa_tagstruct_putu32(t, pa_hashmap_size(card->ports));
|
||||
|
||||
pa_tagstruct_putu32(t, pa_hashmap_size(card->ports));
|
||||
PA_HASHMAP_FOREACH(port, card->ports, state) {
|
||||
void *state2;
|
||||
|
||||
PA_HASHMAP_FOREACH(port, card->ports, state) {
|
||||
void *state2;
|
||||
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, port->proplist);
|
||||
|
||||
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, port->proplist);
|
||||
pa_tagstruct_putu32(t, pa_hashmap_size(port->profiles));
|
||||
|
||||
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_HASHMAP_FOREACH(p, port->profiles, state2)
|
||||
pa_tagstruct_puts(t, p->name);
|
||||
}
|
||||
}
|
||||
|
||||
static void module_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_module *module) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue