summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas@t-8ch.de>2022-08-29 20:52:02 +0200
committerPhilip Langdale <github.philipl@overt.org>2022-09-11 20:24:42 -0700
commit013ec877f6e0d2483a864e963d7f5ccfc1f31973 (patch)
tree68c4dc1ccff6e609230e2e276f49886ad4aa195d /player
parenta9155c6f97e02b09c93ff940e76db422cab7f894 (diff)
downloadmpv-013ec877f6e0d2483a864e963d7f5ccfc1f31973.tar.bz2
mpv-013ec877f6e0d2483a864e963d7f5ccfc1f31973.tar.xz
audio: try to use playback AO as hotplug AO first
When a platform has multiple valid AOs that can provide hotplug events we should try to use the one that also provides playback. Concretely this will help when introducing hotplug support for ao_pipewire. Currently ao_pulse is probed by ao_hotplug_get_device_list() before ao_pipewire and on the common setups where both AOs could work pulse will be selected for hotplug handling. This means that hotplug_init() of ao_pipewire will never be called and list_devs() has to do its own initialization. But if ao_pulse is non-functional or not compiled-in suddenly ao_pipewire *must* implement hotplug_init() for hotplugging events to work for all. Also if the hotplug ao_pulse connects to a PulseAudio instance that is not emulated by the same PipeWire instance as the playback ao_pipewire the hotplug events are useless.
Diffstat (limited to 'player')
-rw-r--r--player/command.c4
-rw-r--r--player/main.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/player/command.c b/player/command.c
index 943f7e887d..2e6b9875d7 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1702,7 +1702,7 @@ static int mp_property_audio_device(void *ctx, struct m_property *prop,
if (mp_property_generic_option(mpctx, prop, M_PROPERTY_GET, &name) < 1)
name = NULL;
- struct ao_device_list *list = ao_hotplug_get_device_list(cmd->hotplug);
+ struct ao_device_list *list = ao_hotplug_get_device_list(cmd->hotplug, mpctx->ao);
for (int n = 0; n < list->num_devices; n++) {
struct ao_device_desc *dev = &list->devices[n];
if (dev->name && name && strcmp(dev->name, name) == 0) {
@@ -1724,7 +1724,7 @@ static int mp_property_audio_devices(void *ctx, struct m_property *prop,
struct command_ctx *cmd = mpctx->command_ctx;
create_hotplug(mpctx);
- struct ao_device_list *list = ao_hotplug_get_device_list(cmd->hotplug);
+ struct ao_device_list *list = ao_hotplug_get_device_list(cmd->hotplug, mpctx->ao);
return m_property_read_list(action, arg, list->num_devices,
get_device_entry, list);
}
diff --git a/player/main.c b/player/main.c
index 7c1f5d8831..1c1cdf9f29 100644
--- a/player/main.c
+++ b/player/main.c
@@ -204,7 +204,7 @@ static bool handle_help_options(struct MPContext *mpctx)
if (opts->ao_opts->audio_device &&
strcmp(opts->ao_opts->audio_device, "help") == 0)
{
- ao_print_devices(mpctx->global, log);
+ ao_print_devices(mpctx->global, log, mpctx->ao);
return true;
}
if (opts->property_print_help) {