diff options
author | wm4 <wm4@nowhere> | 2015-11-27 14:42:10 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-11-27 14:42:10 +0100 |
commit | eec844a06e13f582fdfd3b73cbd37899991d9029 (patch) | |
tree | f91812caafd4a3bece07a1bd07b96a1e60e70d80 | |
parent | 50bb209a80dd4db423e6efff14df02a5624721d1 (diff) | |
download | mpv-eec844a06e13f582fdfd3b73cbd37899991d9029.tar.bz2 mpv-eec844a06e13f582fdfd3b73cbd37899991d9029.tar.xz |
ao: disambiguate default device list entries
If there were many AO drivers without device selection, this added a
"Default" entry for each AO. These entries were not distinguishable, as
the device list feature is meant not to require to display the "raw"
device name in GUIs.
Disambiguate them by adding the driver name. If the AO is the first, the
name will remain just "Default". (The condition checks "num > 1",
because the very first entry is the dummy for AO autoselection.)
-rw-r--r-- | audio/out/ao.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/audio/out/ao.c b/audio/out/ao.c index 02dff063ff..daa9c306b5 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -493,8 +493,12 @@ static void get_devices(struct ao *ao, struct ao_device_list *list) if (ao->driver->list_devs) ao->driver->list_devs(ao, list); // Add at least a default entry - if (list->num_devices == num) - ao_device_list_add(list, ao, &(struct ao_device_desc){"", "Default"}); + if (list->num_devices == num) { + char name[80] = "Default"; + if (num > 1) + mp_snprintf_cat(name, sizeof(name), " (%s)", ao->driver->name); + ao_device_list_add(list, ao, &(struct ao_device_desc){"", name}); + } } bool ao_hotplug_check_update(struct ao_hotplug *hp) |