diff options
authorwm4 <wm4@nowhere>2014-10-22 16:16:35 +0200
committerwm4 <wm4@nowhere>2014-10-22 16:16:35 +0200
commit67d63bc948d7cfe9409162297c4e6bc0efa8b025 (patch)
parent2a74704d76c5235d046d6957f9e78ebdc59e0939 (diff)
audio/out: don't add special devices to --audio-device list
Since the list associated with --audio-device is supposed to enable simple user-selection, it doesn't make much sense to include overly special things like ao_pcm or ao_null in the list. Specifically, ao_pcm is harmful, because it will just dump all audio to a file named audiodump.wav in the current working directory. The user can't choose the filename (it can be customized, but not through this option), and the working directory might be essentially random, especially if this is used from a GUI. Exclude "strange" entries. We reuse the fact that there's already a simple list ordered by auto-probe priority in order to avoid having to add an additional flag. This is also why coreaudio_exclusive was moved above ao_null: ao_null ends auto-probing and marks the start of "special" outputs, which don't show up on the device, but we want coreaudio_exclusive to be selectable (I think).
1 files changed, 2 insertions, 2 deletions
diff --git a/audio/out/ao.c b/audio/out/ao.c
index bd83aa3635..f56a083719 100644
--- a/audio/out/ao.c
+++ b/audio/out/ao.c
@@ -406,8 +406,8 @@ struct ao_device_list *ao_get_device_list(struct mpv_global *global)
(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)
- continue;
+ if (d == &audio_out_null)
+ break; // don't add unsafe/special entries
struct ao *ao = ao_alloc(true, global, NULL, (char *)d->name, NULL);
if (!ao)