ao_pipewire: use proper hotplug init APIs

This commit is contained in:
Thomas Weißschuh 2022-08-29 21:08:43 +02:00 committed by Philip Langdale
parent aa7223cd8c
commit f36eeaf4e8
1 changed files with 13 additions and 8 deletions

View File

@ -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 int hotplug_init(struct ao *ao)
{
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)
{
// 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;
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,6 +677,8 @@ const struct ao_driver audio_out_pipewire = {
.control = control,
.hotplug_init = hotplug_init,
.hotplug_uninit = hotplug_uninit,
.list_devs = list_devs,
.priv_size = sizeof(struct priv),