Make structure private

Make structs private. Expose methods for things we need.
Signals only work on exposed structures so make a new callback helper to
signal events.
This commit is contained in:
Wim Taymans 2017-08-04 10:18:54 +02:00
parent e24c934a1b
commit b898eb46cd
72 changed files with 2980 additions and 2120 deletions

View file

@ -25,6 +25,7 @@
#include "config.h"
#include "pipewire/interfaces.h"
#include "pipewire/private.h"
#include "pipewire/core.h"
#include "pipewire/module.h"
@ -32,12 +33,12 @@
struct pw_protocol *pw_protocol_native_ext_client_node_init(struct pw_core *core);
struct impl {
struct pw_node_factory this;
struct factory_data {
struct pw_node_factory *this;
struct pw_properties *properties;
};
static struct pw_node *create_node(struct pw_node_factory *factory,
static struct pw_node *create_node(void *_data,
struct pw_resource *resource,
const char *name,
struct pw_properties *properties)
@ -59,32 +60,34 @@ static struct pw_node *create_node(struct pw_node_factory *factory,
return NULL;
}
static const struct pw_node_factory_implementation impl_factory = {
PW_VERSION_NODE_FACRORY_IMPLEMENTATION,
.create_node = create_node,
};
static bool module_init(struct pw_module *module, struct pw_properties *properties)
{
struct pw_core *core = module->core;
struct impl *impl;
struct pw_node_factory *factory;
struct factory_data *data;
impl = calloc(1, sizeof(struct impl));
if (impl == NULL)
factory = pw_node_factory_new(core, "client-node", sizeof(*data));
if (factory == NULL)
return false;
pw_log_debug("module %p: new", impl);
data = pw_node_factory_get_user_data(factory);
data->this = factory;
data->properties = properties;
impl->properties = properties;
pw_log_debug("module %p: new", module);
impl->this.core = core;
impl->this.name = "client-node";
pw_signal_init(&impl->this.destroy_signal);
impl->this.create_node = create_node;
pw_node_factory_set_implementation(factory,
&impl_factory,
data);
pw_protocol_native_ext_client_node_init(core);
spa_list_insert(core->node_factory_list.prev, &impl->this.link);
impl->this.global = pw_core_add_global(core, NULL, module->global,
core->type.node_factory, 0,
NULL, impl);
pw_node_factory_export(factory, NULL, module->global);
return true;
}