summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-06-29 17:40:04 +0200
committerwm4 <wm4@nowhere>2016-06-29 17:40:04 +0200
commitc6953bfa8cfe595587913aef6c105e14187e5660 (patch)
treea746dbeda403f393f5709d117ffbb3884c4c01e2 /audio
parentdeb1c3c7a87ff9933b7950b561caee1132194e1e (diff)
downloadmpv-c6953bfa8cfe595587913aef6c105e14187e5660.tar.bz2
mpv-c6953bfa8cfe595587913aef6c105e14187e5660.tar.xz
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).
Diffstat (limited to 'audio')
-rw-r--r--audio/out/ao_oss.c7
1 files changed, 7 insertions, 0 deletions
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,