summaryrefslogtreecommitdiffstats
path: root/audio/out/ao.c
diff options
context:
space:
mode:
Diffstat (limited to 'audio/out/ao.c')
-rw-r--r--audio/out/ao.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/audio/out/ao.c b/audio/out/ao.c
index 9846869f2c..b624f4196c 100644
--- a/audio/out/ao.c
+++ b/audio/out/ao.c
@@ -529,14 +529,10 @@ struct ao_hotplug *ao_hotplug_create(struct mpv_global *global,
static void get_devices(struct ao *ao, struct ao_device_list *list)
{
- int num = list->num_devices;
if (ao->driver->list_devs) {
ao->driver->list_devs(ao, list);
} else {
- 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});
+ ao_device_list_add(list, ao, &(struct ao_device_desc){"", ""});
}
}
@@ -599,8 +595,19 @@ void ao_device_list_add(struct ao_device_list *list, struct ao *ao,
{
struct ao_device_desc c = *e;
const char *dname = ao->driver->name;
- if ((!c.desc || !c.desc[0]) && c.name)
- c.desc = c.name;
+ char buf[80];
+ if (!c.desc || !c.desc[0]) {
+ if (c.name && c.name[0]) {
+ c.desc = c.name;
+ } else if (list->num_devices) {
+ // Assume this is the default device.
+ snprintf(buf, sizeof(buf), "Default (%s)", dname);
+ c.desc = buf;
+ } else {
+ // First default device (and maybe the only one).
+ c.desc = "Default";
+ }
+ }
c.name = c.name[0] ? talloc_asprintf(list, "%s/%s", dname, c.name)
: talloc_strdup(list, dname);
c.desc = talloc_strdup(list, c.desc);