From c6953bfa8cfe595587913aef6c105e14187e5660 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 29 Jun 2016 17:40:04 +0200 Subject: ao_oss: do not add an entry to audio-device-list if device file missing This effectively makes it go away on Linux (unless you have OSS emulation loaded). --- audio/out/ao_oss.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'audio') diff --git a/audio/out/ao_oss.c b/audio/out/ao_oss.c index 3216d673e1..90d3b3e5c5 100644 --- a/audio/out/ao_oss.c +++ b/audio/out/ao_oss.c @@ -612,6 +612,12 @@ static int audio_wait(struct ao *ao, pthread_mutex_t *lock) return r; } +static void list_devs(struct ao *ao, struct ao_device_list *list) +{ + if (stat(PATH_DEV_DSP, &(struct stat){0}) == 0) + ao_device_list_add(list, ao, &(struct ao_device_desc){"", "Default"}); +} + #define OPT_BASE_STRUCT struct priv const struct ao_driver audio_out_oss = { @@ -629,6 +635,7 @@ const struct ao_driver audio_out_oss = { .drain = drain, .wait = audio_wait, .wakeup = ao_wakeup_poll, + .list_devs = list_devs, .priv_size = sizeof(struct priv), .priv_defaults = &(const struct priv) { .audio_fd = -1, -- cgit v1.2.3