From c1ae1def85846584c04525d8dbb061191f08ff2d Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 14 Nov 2016 13:41:25 +0100 Subject: ao_alsa: explicitly add default device manually The "default" entry (which is and always was mpv/mplayer's default) does not have a description set in the ALSA API. (While "sysdefault" strangely has.) Instead of an empty description, this should show something nice, so reuse the ao.c code for naming default devices (see previous commit). It's still a bit ugly that audio-device-list will have a default entry for "Autoselect device" and "Default (alsa)", but then again we probably want to allow the user to force ALSA (i.e. prevent fallbacks to other AOs) just because ALSA is so flaky and makes this a legitimate feature. --- audio/out/ao_alsa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'audio') diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c index f30417ff68..201557697d 100644 --- a/audio/out/ao_alsa.c +++ b/audio/out/ao_alsa.c @@ -1145,7 +1145,8 @@ static bool is_useless_device(char *name) { char *crap[] = {"front", "rear", "center_lfe", "side", "surround21", "surround40", "surround41", "surround50", "surround51", "surround71", - "sysdefault", "pulse", "null", "dsnoop", "dmix", "hw", "iec958"}; + "sysdefault", "pulse", "null", "dsnoop", "dmix", "hw", "iec958", + "default"}; for (int i = 0; i < MP_ARRAY_SIZE(crap); i++) { int l = strlen(crap[i]); if (name && strncmp(name, crap[i], l) == 0 && @@ -1161,6 +1162,8 @@ static void list_devs(struct ao *ao, struct ao_device_list *list) if (snd_device_name_hint(-1, "pcm", &hints) < 0) return; + ao_device_list_add(list, ao, &(struct ao_device_desc){"", ""}); + for (int n = 0; hints[n]; n++) { char *name = snd_device_name_get_hint(hints[n], "NAME"); char *desc = snd_device_name_get_hint(hints[n], "DESC"); -- cgit v1.2.3