From 2e52cc8f2e58bd261586e991adbd0907e4d9ab3d Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 13 Oct 2014 16:42:44 +0200 Subject: [PATCH] audio/out: add "auto" pseudo-device Also, don't set an empty string for the fallback device if an AO doesn't list any devices. --- audio/out/ao.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/audio/out/ao.c b/audio/out/ao.c index 67691b5f4d..0b722eb57a 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -402,6 +402,8 @@ bool ao_untimed(struct ao *ao) struct ao_device_list *ao_get_device_list(struct mpv_global *global) { struct ao_device_list *list = talloc_zero(NULL, struct ao_device_list); + MP_TARRAY_APPEND(list, list->devices, list->num_devices, + (struct ao_device_desc){"auto", "Autoselect device"}); for (int n = 0; audio_out_drivers[n]; n++) { const struct ao_driver *d = audio_out_drivers[n]; if (d->encode) @@ -414,7 +416,7 @@ struct ao_device_list *ao_get_device_list(struct mpv_global *global) d->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){"", ""}); + ao_device_list_add(list, ao, &(struct ao_device_desc){"", "Default"}); talloc_free(ao); } return list;