mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa-ucm: Set icon names for mappings as well
Commit 88bb0bd7cc ("alsa: Allow to augment ucm port properties") adds
icon properties for some common port names, so that GUIs can show a
relevant icon to help disambiguate devices. However, these still do not
show up in pavucontrol, because it shows icons based on mappings'
properties. Add the relevant property to mappings as well.
Link: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/839
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
This commit is contained in:
parent
e726c5f6db
commit
35dbaa840b
2 changed files with 18 additions and 8 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue