diff options
author | Thomas Weißschuh <thomas@t-8ch.de> | 2022-08-29 21:08:43 +0200 |
---|---|---|
committer | Philip Langdale <github.philipl@overt.org> | 2022-09-11 20:24:42 -0700 |
commit | f36eeaf4e8bc937928b36bf7067976c30e83dfb5 (patch) | |
tree | d7005c3fca05c83e664b3febf8a51f83e4fb639e /audio | |
parent | aa7223cd8c483db1606e5890360cb33763437d68 (diff) | |
download | mpv-f36eeaf4e8bc937928b36bf7067976c30e83dfb5.tar.bz2 mpv-f36eeaf4e8bc937928b36bf7067976c30e83dfb5.tar.xz |
ao_pipewire: use proper hotplug init APIs
Diffstat (limited to 'audio')
-rw-r--r-- | audio/out/ao_pipewire.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/audio/out/ao_pipewire.c b/audio/out/ao_pipewire.c index c94d411262..8fba681030 100644 --- a/audio/out/ao_pipewire.c +++ b/audio/out/ao_pipewire.c @@ -646,19 +646,22 @@ static void add_device_to_list(struct ao *ao, uint32_t id, const struct spa_dict ao_device_list_add(list, ao, &(struct ao_device_desc){name, description}); } -static void list_devs(struct ao *ao, struct ao_device_list *list) +static int hotplug_init(struct ao *ao) { - // we are not using hotplug_{,un}init() because the AO core will only call - // the hotplug functions of a single AO. That will probably be ao_pulse. - if (pipewire_init_boilerplate(ao) < 0) - return; + return pipewire_init_boilerplate(ao); +} + +static void hotplug_uninit(struct ao *ao) +{ + uninit(ao); +} +static void list_devs(struct ao *ao, struct ao_device_list *list) +{ ao_device_list_add(list, ao, &(struct ao_device_desc){}); if (for_each_sink(ao, add_device_to_list, list) < 0) MP_WARN(ao, "Could not list devices, list may be incomplete\n"); - - uninit(ao); } #define OPT_BASE_STRUCT struct priv @@ -674,7 +677,9 @@ const struct ao_driver audio_out_pipewire = { .control = control, - .list_devs = list_devs, + .hotplug_init = hotplug_init, + .hotplug_uninit = hotplug_uninit, + .list_devs = list_devs, .priv_size = sizeof(struct priv), .priv_defaults = &(const struct priv) |