summaryrefslogtreecommitdiff
path: root/src/modules/module-client-node/client-node.c
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2019-05-15 11:19:23 +0200
committerWim Taymans <wtaymans@redhat.com>2019-05-15 11:19:23 +0200
commit6ee192dff5a19f95b25b5eaf11be42cf7b9990b5 (patch)
treea7c1630b6681dfc6cbd7f214829d26250d113223 /src/modules/module-client-node/client-node.c
parenta78617c6a82a08027f86a8e388875a6e9735063f (diff)
hooks: use hook to implement the callbacks
This way we get the version check implemented and save some code.
Diffstat (limited to 'src/modules/module-client-node/client-node.c')
-rw-r--r--src/modules/module-client-node/client-node.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/modules/module-client-node/client-node.c b/src/modules/module-client-node/client-node.c
index 7a4548bb..3be61fc3 100644
--- a/src/modules/module-client-node/client-node.c
+++ b/src/modules/module-client-node/client-node.c
@@ -128,8 +128,7 @@ struct node {
struct spa_loop *data_loop;
struct spa_hook_list hooks;
- const struct spa_node_callbacks *callbacks;
- void *callbacks_data;
+ struct spa_hook callbacks;
struct io ios[MAX_IO];
struct pw_resource *resource;
@@ -521,8 +520,7 @@ impl_node_set_callbacks(struct spa_node *node,
spa_return_val_if_fail(node != NULL, -EINVAL);
this = SPA_CONTAINER_OF(node, struct node, node);
- this->callbacks = callbacks;
- this->callbacks_data = data;
+ this->callbacks = SPA_HOOK_INIT(callbacks, data);
return 0;
}
@@ -1115,8 +1113,7 @@ static void node_on_data_fd_events(struct spa_source *source)
spa_log_warn(this->log, "node %p: read %"PRIu64" failed %m", this, cmd);
spa_log_trace_fp(this->log, "node %p: got ready", this);
- if (this->callbacks && this->callbacks->ready)
- this->callbacks->ready(this->callbacks_data, SPA_STATUS_HAVE_BUFFER);
+ spa_node_call_ready(&this->callbacks, SPA_STATUS_HAVE_BUFFER);
}
}