mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05: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
|
|
@ -48,8 +48,7 @@ struct impl {
|
|||
struct spa_log *log;
|
||||
struct spa_loop *main_loop;
|
||||
|
||||
const struct spa_monitor_callbacks *callbacks;
|
||||
void *callbacks_data;
|
||||
struct spa_hook callbacks;
|
||||
|
||||
struct udev *udev;
|
||||
struct udev_monitor *umonitor;
|
||||
|
|
@ -175,7 +174,7 @@ static int emit_device(struct impl *this, uint32_t id, struct udev_device *dev)
|
|||
event = spa_pod_builder_add_object(&b, SPA_TYPE_EVENT_Monitor, id);
|
||||
fill_item(this, dev, &item, &b);
|
||||
|
||||
this->callbacks->event(this->callbacks_data, event);
|
||||
spa_monitor_call_event(&this->callbacks, event);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -284,8 +283,8 @@ impl_monitor_set_callbacks(struct spa_monitor *monitor,
|
|||
|
||||
this = SPA_CONTAINER_OF(monitor, struct impl, monitor);
|
||||
|
||||
this->callbacks = callbacks;
|
||||
this->callbacks_data = data;
|
||||
this->callbacks = SPA_HOOK_INIT(callbacks, data);
|
||||
|
||||
if (callbacks) {
|
||||
if ((res = impl_udev_open(this)) < 0)
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -134,8 +134,7 @@ struct impl {
|
|||
struct props props;
|
||||
|
||||
struct spa_hook_list hooks;
|
||||
const struct spa_node_callbacks *callbacks;
|
||||
void *callbacks_data;
|
||||
struct spa_hook callbacks;
|
||||
|
||||
struct port out_ports[1];
|
||||
|
||||
|
|
@ -384,8 +383,7 @@ static int impl_node_set_callbacks(struct spa_node *node,
|
|||
|
||||
this = SPA_CONTAINER_OF(node, struct impl, node);
|
||||
|
||||
this->callbacks = callbacks;
|
||||
this->callbacks_data = data;
|
||||
this->callbacks = SPA_HOOK_INIT(callbacks, data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1206,7 +1206,7 @@ static int mmap_read(struct impl *this)
|
|||
}
|
||||
|
||||
spa_log_trace(this->log, "v4l2 %p: now queued %d", this, b->id);
|
||||
this->callbacks->ready(this->callbacks_data, SPA_STATUS_HAVE_BUFFER);
|
||||
spa_node_call_ready(&this->callbacks, SPA_STATUS_HAVE_BUFFER);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue