diff --git a/spa/plugins/alsa/acp/alsa-ucm.c b/spa/plugins/alsa/acp/alsa-ucm.c index d648fe8a1..c55ec4e13 100644 --- a/spa/plugins/alsa/acp/alsa-ucm.c +++ b/spa/plugins/alsa/acp/alsa-ucm.c @@ -1092,14 +1092,14 @@ fail: } } -static void ucm_add_port_props( - pa_device_port *port, - bool is_sink) -{ +static void proplist_set_icon_name( + pa_proplist *proplist, + pa_device_port_type_t type, + bool is_sink) { const char *icon; if (is_sink) { - switch (port->type) { + switch (type) { case PA_DEVICE_PORT_TYPE_HEADPHONES: icon = "audio-headphones"; break; @@ -1112,7 +1112,7 @@ static void ucm_add_port_props( break; } } else { - switch (port->type) { + switch (type) { case PA_DEVICE_PORT_TYPE_HEADSET: icon = "audio-headset"; break; @@ -1123,7 +1123,7 @@ static void ucm_add_port_props( } } - pa_proplist_sets(port->proplist, "device.icon_name", icon); + pa_proplist_sets(proplist, "device.icon_name", icon); } static char *devset_name(pa_idxset *devices, const char *sep) { @@ -1229,6 +1229,13 @@ static unsigned devset_capture_priority(pa_idxset *devices, bool invert) { return (unsigned) priority; } +static void ucm_add_port_props( + pa_device_port *port, + bool is_sink) +{ + proplist_set_icon_name(port->proplist, port->type, is_sink); +} + void pa_alsa_ucm_add_port( pa_hashmap *hash, pa_alsa_ucm_mapping_context *context, @@ -1675,6 +1682,8 @@ static void alsa_mapping_add_ucm_device(pa_alsa_mapping *m, pa_alsa_ucm_device * else device->capture_mapping = m; + proplist_set_icon_name(m->proplist, device->type, is_sink); + mdev = get_mixer_device(device, is_sink); if (mdev) pa_proplist_sets(m->proplist, "alsa.mixer_device", mdev); diff --git a/spa/plugins/alsa/alsa-acp-device.c b/spa/plugins/alsa/alsa-acp-device.c index 8a7836e0a..b145ecf78 100644 --- a/spa/plugins/alsa/alsa-acp-device.c +++ b/spa/plugins/alsa/alsa-acp-device.c @@ -175,7 +175,7 @@ static int emit_node(struct impl *this, struct acp_device *dev) info.change_mask = SPA_DEVICE_OBJECT_CHANGE_MASK_PROPS; - items = alloca((dev->props.n_items + 10) * sizeof(*items)); + items = alloca((dev->props.n_items + 11) * sizeof(*items)); n_items = 0; snprintf(card_index, sizeof(card_index), "%d", card->index); @@ -192,6 +192,7 @@ static int emit_node(struct impl *this, struct acp_device *dev) items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_API_ALSA_PCM_CARD, card_index); items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_API_ALSA_PCM_STREAM, stream); items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_GROUP, stream); + items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_ICON_NAME, "audio-card-analog"); snprintf(channels, sizeof(channels), "%d", dev->format.channels); items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_AUDIO_CHANNELS, channels);