mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
Merge branch 'alsa-ucm-device-icons' into 'master'
alsa-ucm: Set icon names for port and mappings See merge request pulseaudio/pulseaudio!839
This commit is contained in:
commit
970e485661
1 changed files with 44 additions and 0 deletions
|
|
@ -1208,6 +1208,47 @@ static unsigned devset_capture_priority(pa_idxset *devices, bool invert) {
|
|||
return (unsigned) priority;
|
||||
}
|
||||
|
||||
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 (type) {
|
||||
case PA_DEVICE_PORT_TYPE_HEADPHONES:
|
||||
icon = "audio-headphones";
|
||||
break;
|
||||
case PA_DEVICE_PORT_TYPE_HDMI:
|
||||
icon = "video-display";
|
||||
break;
|
||||
case PA_DEVICE_PORT_TYPE_SPEAKER:
|
||||
default:
|
||||
icon = "audio-speakers";
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (type) {
|
||||
case PA_DEVICE_PORT_TYPE_HEADSET:
|
||||
icon = "audio-headset";
|
||||
break;
|
||||
case PA_DEVICE_PORT_TYPE_MIC:
|
||||
default:
|
||||
icon = "audio-input-microphone";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pa_proplist_sets(proplist, PA_PROP_DEVICE_ICON_NAME, icon);
|
||||
}
|
||||
|
||||
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,
|
||||
|
|
@ -1261,6 +1302,7 @@ void pa_alsa_ucm_add_port(
|
|||
|
||||
pa_hashmap_put(ports, port->name, port);
|
||||
pa_log_debug("Add port %s: %s", port->name, port->description);
|
||||
ucm_add_port_props(port, is_sink);
|
||||
|
||||
PA_HASHMAP_FOREACH_KV(verb_name, vol, is_sink ? dev->playback_volumes : dev->capture_volumes, state) {
|
||||
pa_alsa_path *path = pa_alsa_path_synthesize(vol->mixer_elem,
|
||||
|
|
@ -1655,6 +1697,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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue