mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
hooks: use hook to implement the callbacks
This way we get the version check implemented and save some code.
This commit is contained in:
parent
a78617c6a8
commit
6ee192dff5
26 changed files with 121 additions and 111 deletions
|
|
@ -60,8 +60,7 @@ struct spa_bt_monitor {
|
|||
struct spa_dbus_connection *dbus_connection;
|
||||
DBusConnection *conn;
|
||||
|
||||
const struct spa_monitor_callbacks *callbacks;
|
||||
void *callbacks_data;
|
||||
struct spa_hook callbacks;
|
||||
|
||||
uint32_t count;
|
||||
|
||||
|
|
@ -532,7 +531,7 @@ static int device_add(struct spa_bt_monitor *monitor, struct spa_bt_device *devi
|
|||
fill_item(monitor, device, &item, &b);
|
||||
|
||||
device->added = true;
|
||||
monitor->callbacks->event(monitor->callbacks_data, event);
|
||||
spa_monitor_call_event(&monitor->callbacks, event);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -552,7 +551,7 @@ static int device_remove(struct spa_bt_monitor *monitor, struct spa_bt_device *d
|
|||
fill_item(monitor, device, &item, &b);
|
||||
|
||||
device->added = false;
|
||||
monitor->callbacks->event(monitor->callbacks_data, event);
|
||||
spa_monitor_call_event(&monitor->callbacks, event);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -2051,8 +2050,7 @@ impl_monitor_set_callbacks(struct spa_monitor *monitor,
|
|||
|
||||
this = SPA_CONTAINER_OF(monitor, struct spa_bt_monitor, monitor);
|
||||
|
||||
this->callbacks = callbacks;
|
||||
this->callbacks_data = data;
|
||||
this->callbacks = SPA_HOOK_INIT(callbacks, data);
|
||||
|
||||
if (callbacks) {
|
||||
get_managed_objects(this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue