mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-10 13:30:05 -05:00
Cleanups
Only pass data to callbacks. Rename some structs Provide methods to access structs
This commit is contained in:
parent
1b79419554
commit
0602d76b9e
57 changed files with 716 additions and 422 deletions
|
|
@ -25,7 +25,6 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "pipewire/interfaces.h"
|
||||
#include "pipewire/private.h"
|
||||
#include "pipewire/core.h"
|
||||
#include "pipewire/module.h"
|
||||
|
||||
|
|
@ -70,17 +69,13 @@ static struct pw_node *create_node(void *_data,
|
|||
no_properties:
|
||||
pw_log_error("missing properties");
|
||||
if (resource) {
|
||||
pw_core_resource_error(resource->client->core_resource,
|
||||
resource->client->core_resource->id,
|
||||
SPA_RESULT_INVALID_ARGUMENTS, "missing properties");
|
||||
pw_resource_error(resource, SPA_RESULT_INVALID_ARGUMENTS, "missing properties");
|
||||
}
|
||||
return NULL;
|
||||
no_mem:
|
||||
pw_log_error("can't create node");
|
||||
if (resource) {
|
||||
pw_core_resource_error(resource->client->core_resource,
|
||||
resource->client->core_resource->id,
|
||||
SPA_RESULT_NO_MEMORY, "no memory");
|
||||
pw_resource_error(resource, SPA_RESULT_NO_MEMORY, "no memory");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -92,7 +87,7 @@ static const struct pw_node_factory_implementation impl_factory = {
|
|||
|
||||
static bool module_init(struct pw_module *module, struct pw_properties *properties)
|
||||
{
|
||||
struct pw_core *core = module->core;
|
||||
struct pw_core *core = pw_module_get_core(module);
|
||||
struct pw_node_factory *factory;
|
||||
struct factory_data *data;
|
||||
|
||||
|
|
@ -110,7 +105,7 @@ static bool module_init(struct pw_module *module, struct pw_properties *properti
|
|||
&impl_factory,
|
||||
data);
|
||||
|
||||
pw_node_factory_export(factory, NULL, module->global);
|
||||
pw_node_factory_export(factory, NULL, pw_module_get_global(module));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,9 +162,9 @@ static void remove_item(struct pw_spa_monitor *this, struct spa_monitor_item *it
|
|||
destroy_item(mitem);
|
||||
}
|
||||
|
||||
static void on_monitor_event(struct spa_monitor *monitor, struct spa_event *event, void *user_data)
|
||||
static void on_monitor_event(void *data, struct spa_event *event)
|
||||
{
|
||||
struct impl *impl = user_data;
|
||||
struct impl *impl = data;
|
||||
struct pw_spa_monitor *this = &impl->this;
|
||||
struct pw_type *t = pw_core_get_type(impl->core);
|
||||
|
||||
|
|
@ -213,7 +213,7 @@ static void update_monitor(struct pw_core *core, const char *name)
|
|||
|
||||
static const struct spa_monitor_callbacks callbacks = {
|
||||
SPA_VERSION_MONITOR_CALLBACKS,
|
||||
on_monitor_event,
|
||||
.event = on_monitor_event,
|
||||
};
|
||||
|
||||
struct pw_spa_monitor *pw_spa_monitor_load(struct pw_core *core,
|
||||
|
|
|
|||
|
|
@ -326,9 +326,9 @@ static void complete_init(struct impl *impl)
|
|||
pw_node_register(this);
|
||||
}
|
||||
|
||||
static void on_node_done(struct spa_node *node, int seq, int res, void *user_data)
|
||||
static void on_node_done(void *data, int seq, int res)
|
||||
{
|
||||
struct impl *impl = user_data;
|
||||
struct impl *impl = data;
|
||||
struct pw_node *this = impl->this;
|
||||
|
||||
if (impl->async_init) {
|
||||
|
|
@ -340,32 +340,32 @@ static void on_node_done(struct spa_node *node, int seq, int res, void *user_dat
|
|||
pw_listener_list_emit(&this->listener_list, struct pw_node_events, async_complete, seq, res);
|
||||
}
|
||||
|
||||
static void on_node_event(struct spa_node *node, struct spa_event *event, void *user_data)
|
||||
static void on_node_event(void *data, struct spa_event *event)
|
||||
{
|
||||
struct impl *impl = user_data;
|
||||
struct impl *impl = data;
|
||||
struct pw_node *this = impl->this;
|
||||
|
||||
pw_listener_list_emit(&this->listener_list, struct pw_node_events, event, event);
|
||||
}
|
||||
|
||||
static void on_node_need_input(struct spa_node *node, void *user_data)
|
||||
static void on_node_need_input(void *data)
|
||||
{
|
||||
struct impl *impl = user_data;
|
||||
struct impl *impl = data;
|
||||
struct pw_node *this = impl->this;
|
||||
pw_listener_list_emit_na(&this->listener_list, struct pw_node_events, need_input);
|
||||
}
|
||||
|
||||
static void on_node_have_output(struct spa_node *node, void *user_data)
|
||||
static void on_node_have_output(void *data)
|
||||
{
|
||||
struct impl *impl = user_data;
|
||||
struct impl *impl = data;
|
||||
struct pw_node *this = impl->this;
|
||||
pw_listener_list_emit_na(&this->listener_list, struct pw_node_events, have_output);
|
||||
}
|
||||
|
||||
static void
|
||||
on_node_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id, void *user_data)
|
||||
on_node_reuse_buffer(void *data, uint32_t port_id, uint32_t buffer_id)
|
||||
{
|
||||
struct impl *impl = user_data;
|
||||
struct impl *impl = data;
|
||||
struct pw_node *this = impl->this;
|
||||
struct spa_graph_port *p, *pp;
|
||||
|
||||
|
|
@ -374,8 +374,8 @@ on_node_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id
|
|||
continue;
|
||||
|
||||
pp = p->peer;
|
||||
if (pp && pp->methods->reuse_buffer)
|
||||
pp->methods->reuse_buffer(pp, buffer_id, pp->user_data);
|
||||
if (pp && pp->callbacks->reuse_buffer)
|
||||
pp->callbacks->reuse_buffer(pp->callbacks_data, buffer_id);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue