From eec844a06e13f582fdfd3b73cbd37899991d9029 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 27 Nov 2015 14:42:10 +0100 Subject: 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.) --- audio/out/ao.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'audio') 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) -- cgit v1.2.3