1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-04 05:07:51 +00:00

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).
This commit is contained in:
wm4 2016-06-29 17:40:04 +02:00
parent deb1c3c7a8
commit c6953bfa8c

View File

@ -612,6 +612,12 @@ static int audio_wait(struct ao *ao, pthread_mutex_t *lock)
return r; 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 #define OPT_BASE_STRUCT struct priv
const struct ao_driver audio_out_oss = { const struct ao_driver audio_out_oss = {
@ -629,6 +635,7 @@ const struct ao_driver audio_out_oss = {
.drain = drain, .drain = drain,
.wait = audio_wait, .wait = audio_wait,
.wakeup = ao_wakeup_poll, .wakeup = ao_wakeup_poll,
.list_devs = list_devs,
.priv_size = sizeof(struct priv), .priv_size = sizeof(struct priv),
.priv_defaults = &(const struct priv) { .priv_defaults = &(const struct priv) {
.audio_fd = -1, .audio_fd = -1,