pw_core -> pw_context

The proxy API is the one that we would like to expose for applications
and the other API is used internally when implementing modules or
factories.

The current pw_core object is really a context for all objects so
name it that way. It also makes it possible to rename pw_core_proxy
to pw_proxy later.
This commit is contained in:
Wim Taymans 2019-12-10 18:19:56 +01:00
parent 42103a8218
commit 8ea78c2e3f
113 changed files with 905 additions and 906 deletions

View file

@ -43,10 +43,10 @@ static const struct spa_dict_item module_props[] = {
};
struct impl {
struct pw_core *core;
struct pw_context *context;
struct pw_properties *properties;
struct spa_hook core_listener;
struct spa_hook context_listener;
struct spa_hook module_listener;
};
@ -112,7 +112,7 @@ static int check_flatpak(struct pw_client *client, int pid)
}
static void
core_check_access(void *data, struct pw_client *client)
context_check_access(void *data, struct pw_client *client)
{
struct impl *impl = data;
struct pw_permission permissions[1];
@ -190,16 +190,16 @@ blacklisted:
return;
}
static const struct pw_core_events core_events = {
PW_VERSION_CORE_EVENTS,
.check_access = core_check_access,
static const struct pw_context_events context_events = {
PW_VERSION_CONTEXT_EVENTS,
.check_access = context_check_access,
};
static void module_destroy(void *data)
{
struct impl *impl = data;
spa_hook_remove(&impl->core_listener);
spa_hook_remove(&impl->context_listener);
spa_hook_remove(&impl->module_listener);
if (impl->properties)
@ -216,7 +216,7 @@ static const struct pw_module_events module_events = {
SPA_EXPORT
int pipewire__module_init(struct pw_module *module, const char *args)
{
struct pw_core *core = pw_module_get_core(module);
struct pw_context *context = pw_module_get_context(module);
struct pw_properties *props;
struct impl *impl;
@ -231,10 +231,10 @@ int pipewire__module_init(struct pw_module *module, const char *args)
else
props = NULL;
impl->core = core;
impl->context = context;
impl->properties = props;
pw_core_add_listener(core, &impl->core_listener, &core_events, impl);
pw_context_add_listener(context, &impl->context_listener, &context_events, impl);
pw_module_add_listener(module, &impl->module_listener, &module_events, impl);
pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props));

View file

@ -55,7 +55,7 @@ struct factory_data {
struct spa_list node_list;
struct pw_core *core;
struct pw_context *context;
struct pw_module *module;
struct spa_hook module_listener;
};
@ -175,7 +175,7 @@ static void *create_object(void *_data,
if (factory_name == NULL)
goto error_properties;
slave = pw_spa_node_load(d->core,
slave = pw_spa_node_load(d->context,
factory_name,
PW_SPA_NODE_FLAG_ACTIVATE |
PW_SPA_NODE_FLAG_NO_REGISTER,
@ -184,7 +184,7 @@ static void *create_object(void *_data,
goto error_no_mem;
}
adapter = pw_adapter_new(pw_module_get_core(d->module),
adapter = pw_adapter_new(pw_module_get_context(d->module),
slave,
properties,
sizeof(struct node_data));
@ -283,11 +283,11 @@ static const struct pw_module_events module_events = {
SPA_EXPORT
int pipewire__module_init(struct pw_module *module, const char *args)
{
struct pw_core *core = pw_module_get_core(module);
struct pw_context *context = pw_module_get_context(module);
struct pw_factory *factory;
struct factory_data *data;
factory = pw_factory_new(core,
factory = pw_factory_new(context,
"adapter",
PW_TYPE_INTERFACE_Node,
PW_VERSION_NODE_PROXY,
@ -300,7 +300,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
data = pw_factory_get_user_data(factory);
data->this = factory;
data->core = core;
data->context = context;
data->module = module;
spa_list_init(&data->node_list);

View file

@ -56,7 +56,7 @@ struct buffer {
};
struct node {
struct pw_core *core;
struct pw_context *context;
struct pw_node *node;
struct spa_hook node_listener;
@ -186,7 +186,7 @@ static int find_format(struct pw_node *node, enum pw_direction direction,
}
struct pw_node *pw_adapter_new(struct pw_core *core,
struct pw_node *pw_adapter_new(struct pw_context *context,
struct pw_node *slave,
struct pw_properties *props,
size_t user_data_size)
@ -255,7 +255,7 @@ struct pw_node *pw_adapter_new(struct pw_core *core,
goto error;
}
node = pw_spa_node_load(core,
node = pw_spa_node_load(context,
factory_name,
PW_SPA_NODE_FLAG_ACTIVATE | PW_SPA_NODE_FLAG_NO_REGISTER,
pw_properties_copy(props),
@ -267,7 +267,7 @@ struct pw_node *pw_adapter_new(struct pw_core *core,
}
n = pw_spa_node_get_user_data(node);
n->core = core;
n->context = context;
n->node = node;
n->slave = slave;
n->direction = direction;

View file

@ -34,7 +34,7 @@ extern "C" {
#define ADAPTER_USAGE PW_KEY_NODE_NAME"=<string> "
struct pw_node *
pw_adapter_new(struct pw_core *core,
pw_adapter_new(struct pw_context *context,
struct pw_node *slave,
struct pw_properties *properties,
size_t user_data_size);

View file

@ -47,7 +47,7 @@ struct pw_proxy *pw_core_proxy_spa_device_export(struct pw_core_proxy *core_prox
uint32_t type, struct pw_properties *props, void *object,
size_t user_data_size);
struct pw_protocol *pw_protocol_native_ext_client_device_init(struct pw_core *core);
struct pw_protocol *pw_protocol_native_ext_client_device_init(struct pw_context *context);
struct factory_data {
struct pw_factory *this;
@ -160,11 +160,11 @@ static const struct pw_module_events module_events = {
SPA_EXPORT
int pipewire__module_init(struct pw_module *module, const char *args)
{
struct pw_core *core = pw_module_get_core(module);
struct pw_context *context = pw_module_get_context(module);
struct pw_factory *factory;
struct factory_data *data;
factory = pw_factory_new(core,
factory = pw_factory_new(context,
"client-device",
SPA_TYPE_INTERFACE_Device,
SPA_VERSION_DEVICE,
@ -185,11 +185,11 @@ int pipewire__module_init(struct pw_module *module, const char *args)
&impl_factory,
data);
pw_protocol_native_ext_client_device_init(core);
pw_protocol_native_ext_client_device_init(context);
data->export_spadevice.type = SPA_TYPE_INTERFACE_Device;
data->export_spadevice.func = pw_core_proxy_spa_device_export;
pw_core_register_export_type(core, &data->export_spadevice);
pw_context_register_export_type(context, &data->export_spadevice);
pw_module_add_listener(module, &data->module_listener, &module_events, data);

View file

@ -535,11 +535,11 @@ static const struct pw_protocol_marshal pw_protocol_native_client_device_marshal
.client_demarshal = pw_protocol_native_device_method_demarshal,
};
struct pw_protocol *pw_protocol_native_ext_client_device_init(struct pw_core *core)
struct pw_protocol *pw_protocol_native_ext_client_device_init(struct pw_context *context)
{
struct pw_protocol *protocol;
protocol = pw_core_find_protocol(core, PW_TYPE_INFO_PROTOCOL_Native);
protocol = pw_context_find_protocol(context, PW_TYPE_INFO_PROTOCOL_Native);
if (protocol == NULL)
return NULL;

View file

@ -39,7 +39,7 @@
#include "pipewire/private.h"
struct impl {
struct pw_core *core;
struct pw_context *context;
struct pw_device *device;
struct spa_hook device_listener;
@ -119,7 +119,7 @@ struct pw_device *pw_client_device_new(struct pw_resource *resource,
struct impl *impl;
struct pw_device *device;
struct pw_client *client = pw_resource_get_client(resource);
struct pw_core *core = pw_client_get_core(client);
struct pw_context *context = pw_client_get_context(client);
if (properties == NULL)
properties = pw_properties_new(NULL, NULL);
@ -128,13 +128,13 @@ struct pw_device *pw_client_device_new(struct pw_resource *resource,
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d", client->global->id);
device = pw_device_new(core, properties, sizeof(struct impl));
device = pw_device_new(context, properties, sizeof(struct impl));
if (device == NULL)
return NULL;
impl = pw_device_get_user_data(device);
impl->device = device;
impl->core = core;
impl->context = context;
impl->resource = resource;
pw_device_add_listener(impl->device,

View file

@ -49,8 +49,8 @@ struct pw_proxy *pw_core_proxy_node_export(struct pw_core_proxy *core_proxy,
struct pw_proxy *pw_core_proxy_spa_node_export(struct pw_core_proxy *core_proxy,
uint32_t type, struct pw_properties *props, void *object, size_t user_data_size);
struct pw_protocol *pw_protocol_native_ext_client_node_init(struct pw_core *core);
struct pw_protocol *pw_protocol_native_ext_client_node0_init(struct pw_core *core);
struct pw_protocol *pw_protocol_native_ext_client_node_init(struct pw_context *context);
struct pw_protocol *pw_protocol_native_ext_client_node0_init(struct pw_context *context);
struct factory_data {
struct pw_factory *this;
@ -151,11 +151,11 @@ static const struct pw_module_events module_events = {
SPA_EXPORT
int pipewire__module_init(struct pw_module *module, const char *args)
{
struct pw_core *core = pw_module_get_core(module);
struct pw_context *context = pw_module_get_context(module);
struct pw_factory *factory;
struct factory_data *data;
factory = pw_factory_new(core,
factory = pw_factory_new(context,
"client-node",
PW_TYPE_INTERFACE_ClientNode,
PW_VERSION_CLIENT_NODE,
@ -174,16 +174,16 @@ int pipewire__module_init(struct pw_module *module, const char *args)
&impl_factory,
data);
pw_protocol_native_ext_client_node_init(core);
pw_protocol_native_ext_client_node0_init(core);
pw_protocol_native_ext_client_node_init(context);
pw_protocol_native_ext_client_node0_init(context);
data->export_node.type = PW_TYPE_INTERFACE_Node;
data->export_node.func = pw_core_proxy_node_export;
pw_core_register_export_type(core, &data->export_node);
pw_context_register_export_type(context, &data->export_node);
data->export_spanode.type = SPA_TYPE_INTERFACE_Node;
data->export_spanode.func = pw_core_proxy_spa_node_export;
pw_core_register_export_type(core, &data->export_spanode);
pw_context_register_export_type(context, &data->export_spanode);
pw_module_add_listener(module, &data->module_listener, &module_events, data);

View file

@ -138,7 +138,7 @@ struct node {
struct impl {
struct pw_client_node this;
struct pw_core *core;
struct pw_context *context;
struct node node;
@ -341,7 +341,7 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
if (data) {
mm = pw_mempool_import_map(this->client->pool,
impl->core->pool, data, size, tag);
impl->context->pool, data, size, tag);
if (mm == NULL)
return -errno;
@ -659,7 +659,7 @@ static int do_port_set_io(struct impl *impl,
if (data) {
mm = pw_mempool_import_map(this->client->pool,
impl->core->pool, data, size, tag);
impl->context->pool, data, size, tag);
if (mm == NULL)
return -errno;
@ -756,7 +756,7 @@ do_port_use_buffers(struct impl *impl,
else
return -EINVAL;
if ((mem = pw_mempool_find_ptr(impl->core->pool, baseptr)) == NULL)
if ((mem = pw_mempool_find_ptr(impl->context->pool, baseptr)) == NULL)
return -EINVAL;
data_size = buffers[i]->n_datas * sizeof(struct spa_chunk);
@ -1252,7 +1252,7 @@ static void node_initialized(void *data)
size = sizeof(struct spa_io_buffers) * MAX_AREAS;
impl->io_areas = pw_mempool_alloc(impl->core->pool,
impl->io_areas = pw_mempool_alloc(impl->context->pool,
PW_MEMBLOCK_FLAG_READWRITE |
PW_MEMBLOCK_FLAG_MAP |
PW_MEMBLOCK_FLAG_SEAL,
@ -1619,7 +1619,7 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
struct impl *impl;
struct pw_client_node *this;
struct pw_client *client = pw_resource_get_client(resource);
struct pw_core *core = pw_client_get_core(client);
struct pw_context *context = pw_client_get_context(client);
const struct spa_support *support;
uint32_t n_support;
int res;
@ -1641,11 +1641,11 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
this = &impl->this;
impl->core = core;
impl->context = context;
impl->fds[0] = impl->fds[1] = -1;
pw_log_debug(NAME " %p: new", &impl->node);
support = pw_core_get_support(impl->core, &n_support);
support = pw_context_get_support(impl->context, &n_support);
node_init(&impl->node, NULL, support, n_support);
impl->node.impl = impl;
impl->node.resource = resource;
@ -1655,7 +1655,7 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource,
pw_map_init(&impl->io_map, 64, 64);
this->resource = resource;
this->node = pw_spa_node_new(core,
this->node = pw_spa_node_new(context,
PW_SPA_NODE_FLAG_ASYNC |
(do_register ? 0 : PW_SPA_NODE_FLAG_NO_REGISTER),
(struct spa_node *)&impl->node.node,

View file

@ -1157,11 +1157,11 @@ static const struct pw_protocol_marshal pw_protocol_native_client_node_marshal =
.client_demarshal = pw_protocol_native_client_node_event_demarshal,
};
struct pw_protocol *pw_protocol_native_ext_client_node_init(struct pw_core *core)
struct pw_protocol *pw_protocol_native_ext_client_node_init(struct pw_context *context)
{
struct pw_protocol *protocol;
protocol = pw_core_find_protocol(core, PW_TYPE_INFO_PROTOCOL_Native);
protocol = pw_context_find_protocol(context, PW_TYPE_INFO_PROTOCOL_Native);
if (protocol == NULL)
return NULL;

View file

@ -68,7 +68,7 @@ struct link {
};
struct node_data {
struct pw_core *core;
struct pw_context *context;
struct pw_mempool *pool;
@ -168,7 +168,7 @@ deactivate_mix(struct node_data *data, struct mix *mix)
{
if (mix->active) {
pw_log_debug("node %p: mix %p deactivate", data, mix);
pw_loop_invoke(data->core->data_loop,
pw_loop_invoke(data->context->data_loop,
do_deactivate_mix, SPA_ID_INVALID, NULL, 0, true, mix);
mix->active = false;
}
@ -190,7 +190,7 @@ activate_mix(struct node_data *data, struct mix *mix)
{
if (!mix->active) {
pw_log_debug("node %p: mix %p activate", data, mix);
pw_loop_invoke(data->core->data_loop,
pw_loop_invoke(data->context->data_loop,
do_activate_mix, SPA_ID_INVALID, NULL, 0, false, mix);
mix->active = true;
}
@ -1128,7 +1128,7 @@ static struct pw_proxy *node_export(struct pw_core_proxy *core_proxy, void *obje
data->pool = pw_core_proxy_get_mempool(core_proxy);
data->node = node;
data->do_free = do_free;
data->core = pw_node_get_core(node);
data->context = pw_node_get_context(node);
data->client_node = (struct pw_client_node_proxy *)client_node;
data->remote_id = SPA_ID_INVALID;
@ -1183,7 +1183,7 @@ struct pw_proxy *pw_core_proxy_spa_node_export(struct pw_core_proxy *core_proxy,
{
struct pw_node *node;
node = pw_node_new(pw_core_proxy_get_core(core_proxy), props, 0);
node = pw_node_new(pw_core_proxy_get_context(core_proxy), props, 0);
if (node == NULL)
return NULL;

View file

@ -36,7 +36,7 @@
#include "pipewire/interfaces.h"
#include "pipewire/private.h"
#include "pipewire/core.h"
#include "pipewire/context.h"
#include "modules/spa/spa-node.h"
#include "client-node.h"
#include "transport.h"
@ -136,7 +136,7 @@ struct impl {
bool client_reuse;
struct pw_core *core;
struct pw_context *context;
struct node node;
@ -600,7 +600,7 @@ impl_node_port_set_io(void *object,
if (data) {
if ((mem = pw_mempool_find_ptr(impl->core->pool, data)) == NULL)
if ((mem = pw_mempool_find_ptr(impl->context->pool, data)) == NULL)
return -EINVAL;
mem_offset = SPA_PTRDIFF(data, mem->map->ptr);
@ -683,7 +683,7 @@ impl_node_port_use_buffers(void *object,
else
return -EINVAL;
if ((mem = pw_mempool_find_ptr(impl->core->pool, baseptr)) == NULL)
if ((mem = pw_mempool_find_ptr(impl->context->pool, baseptr)) == NULL)
return -EINVAL;
data_size = 0;
@ -910,7 +910,7 @@ static void setup_transport(struct impl *impl)
n_outputs = this->n_outputs;
max_outputs = this->info.max_output_ports == 0 ? this->n_outputs : this->info.max_output_ports;
impl->transport = pw_client_node0_transport_new(impl->core, max_inputs, max_outputs);
impl->transport = pw_client_node0_transport_new(impl->context, max_inputs, max_outputs);
impl->transport->area->n_input_ports = n_inputs;
impl->transport->area->n_output_ports = n_outputs;
}
@ -1256,7 +1256,7 @@ struct pw_client_node0 *pw_client_node0_new(struct pw_resource *resource,
struct impl *impl;
struct pw_client_node0 *this;
struct pw_client *client = pw_resource_get_client(resource);
struct pw_core *core = pw_client_get_core(client);
struct pw_context *context = pw_client_get_context(client);
const struct spa_support *support;
uint32_t n_support;
const char *name;
@ -1279,11 +1279,11 @@ struct pw_client_node0 *pw_client_node0_new(struct pw_resource *resource,
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d", client->global->id);
impl->core = core;
impl->context = context;
impl->fds[0] = impl->fds[1] = -1;
pw_log_debug("client-node %p: new", impl);
support = pw_core_get_support(impl->core, &n_support);
support = pw_context_get_support(impl->context, &n_support);
node_init(&impl->node, NULL, support, n_support);
impl->node.impl = impl;
@ -1297,7 +1297,7 @@ struct pw_client_node0 *pw_client_node0_new(struct pw_resource *resource,
impl->node.resource = resource;
this->resource = resource;
this->node = pw_spa_node_new(core,
this->node = pw_spa_node_new(context,
PW_SPA_NODE_FLAG_ASYNC,
&impl->node.node,
NULL,

View file

@ -503,11 +503,11 @@ static const struct pw_protocol_marshal pw_protocol_native_client_node_marshal =
NULL,
};
struct pw_protocol *pw_protocol_native_ext_client_node0_init(struct pw_core *core)
struct pw_protocol *pw_protocol_native_ext_client_node0_init(struct pw_context *context)
{
struct pw_protocol *protocol;
protocol = pw_core_find_protocol(core, PW_TYPE_INFO_PROTOCOL_Native);
protocol = pw_context_find_protocol(context, PW_TYPE_INFO_PROTOCOL_Native);
if (protocol == NULL)
return NULL;

View file

@ -186,7 +186,7 @@ static int parse_message(struct pw_client_node0_transport *trans, void *message)
* \memberof pw_client_node0_transport
*/
struct pw_client_node0_transport *
pw_client_node0_transport_new(struct pw_core *core,
pw_client_node0_transport_new(struct pw_context *context,
uint32_t max_input_ports, uint32_t max_output_ports)
{
struct transport *impl;
@ -207,7 +207,7 @@ pw_client_node0_transport_new(struct pw_core *core,
trans = &impl->trans;
impl->offset = 0;
impl->mem = pw_mempool_alloc(core->pool,
impl->mem = pw_mempool_alloc(context->pool,
PW_MEMBLOCK_FLAG_READWRITE |
PW_MEMBLOCK_FLAG_MAP |
PW_MEMBLOCK_FLAG_SEAL,

View file

@ -38,7 +38,7 @@ struct pw_client_node0_transport_info {
};
struct pw_client_node0_transport *
pw_client_node0_transport_new(struct pw_core *core, uint32_t max_input_ports, uint32_t max_output_ports);
pw_client_node0_transport_new(struct pw_context *context, uint32_t max_input_ports, uint32_t max_output_ports);
struct pw_client_node0_transport *
pw_client_node0_transport_new_from_info(struct pw_client_node0_transport_info *info);

View file

@ -181,7 +181,7 @@ static void *create_object(void *_data,
struct pw_client *client = NULL;
struct pw_node *output_node, *input_node;
struct pw_port *outport, *inport;
struct pw_core *core;
struct pw_context *context;
struct pw_global *global;
struct pw_link *link;
uint32_t output_node_id, input_node_id;
@ -192,7 +192,7 @@ static void *create_object(void *_data,
bool linger;
client = pw_resource_get_client(resource);
core = pw_client_get_core(client);
context = pw_client_get_context(client);
if (properties == NULL)
goto error_properties;
@ -213,13 +213,13 @@ static void *create_object(void *_data,
str = pw_properties_get(properties, PW_KEY_LINK_INPUT_PORT);
input_port_id = str ? pw_properties_parse_int(str) : -1;
global = pw_core_find_global(core, output_node_id);
global = pw_context_find_global(context, output_node_id);
if (global == NULL || pw_global_get_type(global) != PW_TYPE_INTERFACE_Node)
goto error_output;
output_node = pw_global_get_object(global);
global = pw_core_find_global(core, input_node_id);
global = pw_context_find_global(context, input_node_id);
if (global == NULL || pw_global_get_type(global) != PW_TYPE_INTERFACE_Node)
goto error_input;
@ -229,7 +229,7 @@ static void *create_object(void *_data,
outport = get_port(output_node, SPA_DIRECTION_OUTPUT);
}
else {
global = pw_core_find_global(core, output_port_id);
global = pw_context_find_global(context, output_port_id);
if (global == NULL || pw_global_get_type(global) != PW_TYPE_INTERFACE_Port)
goto error_output_port;
@ -241,7 +241,7 @@ static void *create_object(void *_data,
if (input_port_id == SPA_ID_INVALID)
inport = get_port(input_node, SPA_DIRECTION_INPUT);
else {
global = pw_core_find_global(core, input_port_id);
global = pw_context_find_global(context, input_port_id);
if (global == NULL || pw_global_get_type(global) != PW_TYPE_INTERFACE_Port)
goto error_input_port;
@ -258,7 +258,7 @@ static void *create_object(void *_data,
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d", client->global->id);
link = pw_link_new(core, outport, inport, NULL, properties, sizeof(struct link_data));
link = pw_link_new(context, outport, inport, NULL, properties, sizeof(struct link_data));
properties = NULL;
if (link == NULL) {
res = -errno;
@ -364,11 +364,11 @@ static const struct pw_module_events module_events = {
SPA_EXPORT
int pipewire__module_init(struct pw_module *module, const char *args)
{
struct pw_core *core = pw_module_get_core(module);
struct pw_context *context = pw_module_get_context(module);
struct pw_factory *factory;
struct factory_data *data;
factory = pw_factory_new(core,
factory = pw_factory_new(context,
"link-factory",
PW_TYPE_INTERFACE_Link,
PW_VERSION_LINK_PROXY,

View file

@ -43,13 +43,13 @@ static const struct spa_dict_item module_props[] = {
};
void * pw_metadata_new(struct pw_core *core, struct pw_resource *resource,
void * pw_metadata_new(struct pw_context *context, struct pw_resource *resource,
struct pw_properties *properties);
struct pw_proxy *pw_core_proxy_metadata_export(struct pw_core_proxy *core_proxy,
uint32_t type, struct pw_properties *props, void *object, size_t user_data_size);
int pw_protocol_native_ext_metadata_init(struct pw_core *core);
int pw_protocol_native_ext_metadata_init(struct pw_context *context);
struct factory_data {
struct pw_factory *this;
@ -79,7 +79,7 @@ static void *create_object(void *_data,
}
pw_log_debug(".");
result = pw_metadata_new(pw_client_get_core(client), metadata_resource, properties);
result = pw_metadata_new(pw_client_get_context(client), metadata_resource, properties);
if (result == NULL) {
res = -errno;
goto error_node;
@ -146,15 +146,15 @@ static const struct pw_module_events module_events = {
SPA_EXPORT
int pipewire__module_init(struct pw_module *module, const char *args)
{
struct pw_core *core = pw_module_get_core(module);
struct pw_context *context = pw_module_get_context(module);
struct pw_factory *factory;
struct factory_data *data;
int res;
if ((res = pw_protocol_native_ext_metadata_init(core)) < 0)
if ((res = pw_protocol_native_ext_metadata_init(context)) < 0)
return res;
factory = pw_factory_new(core,
factory = pw_factory_new(context,
"metadata",
PW_TYPE_INTERFACE_Metadata,
PW_VERSION_METADATA,
@ -175,7 +175,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
data->export_metadata.type = PW_TYPE_INTERFACE_Metadata;
data->export_metadata.func = pw_core_proxy_metadata_export;
pw_core_register_export_type(core, &data->export_metadata);
pw_context_register_export_type(context, &data->export_metadata);
pw_module_add_listener(module, &data->module_listener, &module_events, data);

View file

@ -142,7 +142,7 @@ global_bind(void *_data, struct pw_client *client, uint32_t permissions,
}
void *
pw_metadata_new(struct pw_core *core, struct pw_resource *resource,
pw_metadata_new(struct pw_context *context, struct pw_resource *resource,
struct pw_properties *properties)
{
struct impl *impl;
@ -162,7 +162,7 @@ pw_metadata_new(struct pw_core *core, struct pw_resource *resource,
pw_resource_install_marshal(resource, true);
impl->global = pw_global_new(core,
impl->global = pw_global_new(context,
PW_TYPE_INTERFACE_Metadata,
PW_VERSION_METADATA,
properties,

View file

@ -321,11 +321,11 @@ static const struct pw_protocol_marshal pw_protocol_native_metadata_impl_marshal
.client_demarshal = pw_protocol_native_metadata_client_method_demarshal,
};
int pw_protocol_native_ext_metadata_init(struct pw_core *core)
int pw_protocol_native_ext_metadata_init(struct pw_context *context)
{
struct pw_protocol *protocol;
protocol = pw_core_find_protocol(core, PW_TYPE_INFO_PROTOCOL_Native);
protocol = pw_context_find_protocol(context, PW_TYPE_INFO_PROTOCOL_Native);
if (protocol == NULL)
return -EPROTO;

View file

@ -39,7 +39,7 @@
#include "pipewire/private.h"
struct impl {
struct pw_core *core;
struct pw_context *context;
struct pw_device *device;
struct spa_hook device_listener;
@ -108,7 +108,7 @@ struct pw_device *pw_client_device_new(struct pw_resource *resource,
struct impl *impl;
struct pw_device *device;
struct pw_client *client = pw_resource_get_client(resource);
struct pw_core *core = pw_client_get_core(client);
struct pw_context *context = pw_client_get_context(client);
if (properties == NULL)
properties = pw_properties_new(NULL, NULL);
@ -117,13 +117,13 @@ struct pw_device *pw_client_device_new(struct pw_resource *resource,
pw_properties_setf(properties, PW_KEY_CLIENT_ID, "%d", client->global->id);
device = pw_device_new(core, properties, sizeof(struct impl));
device = pw_device_new(context, properties, sizeof(struct impl));
if (device == NULL)
return NULL;
impl = pw_device_get_user_data(device);
impl->device = device;
impl->core = core;
impl->context = context;
impl->resource = resource;
pw_resource_install_marshal(resource, true);

View file

@ -81,7 +81,7 @@ struct protocol_data {
struct client {
struct pw_protocol_client this;
struct pw_core *core;
struct pw_context *context;
struct spa_source *source;
@ -124,12 +124,12 @@ process_messages(struct client_data *data)
{
struct pw_protocol_native_connection *conn = data->connection;
struct pw_client *client = data->client;
struct pw_core *core = client->core;
struct pw_context *context = client->context;
const struct pw_protocol_native_message *msg;
struct pw_resource *resource;
int res;
core->current_client = client;
context->current_client = client;
/* when the client is busy processing an async action, stop processing messages
* for the client until it finishes the action */
@ -197,7 +197,7 @@ process_messages(struct client_data *data)
goto invalid_message;
}
done:
core->current_client = NULL;
context->current_client = NULL;
return;
invalid_method:
@ -233,7 +233,7 @@ client_busy_changed(void *data, bool busy)
SPA_FLAG_UPDATE(mask, SPA_IO_IN, !busy);
pw_log_debug(NAME" %p: busy changed %d", client->protocol, busy);
pw_loop_update_io(client->core->main_loop, c->source, mask);
pw_loop_update_io(client->context->main_loop, c->source, mask);
if (!busy)
process_messages(c);
@ -262,7 +262,7 @@ connection_data(void *data, int fd, uint32_t mask)
if (res >= 0) {
int mask = this->source->mask;
SPA_FLAG_CLEAR(mask, SPA_IO_OUT);
pw_loop_update_io(client->protocol->core->main_loop,
pw_loop_update_io(client->protocol->context->main_loop,
this->source, mask);
} else if (res != EAGAIN) {
pw_log_error("client %p: could not flush: %s",
@ -283,7 +283,7 @@ static void client_free(void *data)
spa_list_remove(&client->protocol_link);
if (this->source)
pw_loop_destroy_source(client->protocol->core->main_loop, this->source);
pw_loop_destroy_source(client->protocol->context->main_loop, this->source);
if (this->connection)
pw_protocol_native_connection_destroy(this->connection);
@ -300,11 +300,11 @@ static void on_start(void *data, uint32_t version)
{
struct client_data *this = data;
struct pw_client *client = this->client;
struct pw_core *core = client->core;
struct pw_context *context = client->context;
pw_log_debug("version %d", version);
if (pw_global_bind(pw_core_get_global(core), client,
if (pw_global_bind(pw_context_get_global(context), client,
PW_PERM_RWX, version, 0) < 0)
return;
@ -326,7 +326,7 @@ static struct client_data *client_new(struct server *s, int fd)
struct pw_protocol *protocol = s->this.protocol;
socklen_t len;
struct ucred ucred;
struct pw_core *core = protocol->core;
struct pw_context *context = protocol->context;
struct pw_properties *props;
char buffer[1024];
struct protocol_data *d = pw_protocol_get_user_data(protocol);
@ -356,7 +356,7 @@ static struct client_data *client_new(struct server *s, int fd)
pw_properties_setf(props, PW_KEY_MODULE_ID, "%d", d->module->global->id);
client = pw_client_new(protocol->core,
client = pw_client_new(protocol->context,
props,
sizeof(struct client_data));
if (client == NULL)
@ -368,7 +368,7 @@ static struct client_data *client_new(struct server *s, int fd)
spa_list_append(&s->this.client_list, &client->protocol_link);
this->client = client;
this->source = pw_loop_add_io(pw_core_get_main_loop(core),
this->source = pw_loop_add_io(pw_context_get_main_loop(context),
fd, SPA_IO_ERR | SPA_IO_HUP, true,
connection_data, this);
if (this->source == NULL) {
@ -376,7 +376,7 @@ static struct client_data *client_new(struct server *s, int fd)
goto cleanup_client;
}
this->connection = pw_protocol_native_connection_new(protocol->core, fd);
this->connection = pw_protocol_native_connection_new(protocol->context, fd);
if (this->connection == NULL) {
res = -errno;
goto cleanup_client;
@ -395,7 +395,7 @@ static struct client_data *client_new(struct server *s, int fd)
goto cleanup_client;
if (!client->busy)
pw_loop_update_io(pw_core_get_main_loop(core),
pw_loop_update_io(pw_context_get_main_loop(context),
this->source, this->source->mask | SPA_IO_IN);
return this;
@ -554,7 +554,7 @@ static int add_socket(struct pw_protocol *protocol, struct server *s)
}
s->activated = activated;
s->loop = pw_core_get_main_loop(protocol->core);
s->loop = pw_context_get_main_loop(protocol->context);
if (s->loop == NULL) {
res = -errno;
goto error_close;
@ -595,8 +595,8 @@ on_remote_data(void *data, int fd, uint32_t mask)
struct client *impl = data;
struct pw_core_proxy *this = impl->this.core_proxy;
struct pw_protocol_native_connection *conn = impl->connection;
struct pw_core *core = pw_core_proxy_get_core(this);
struct pw_loop *loop = pw_core_get_main_loop(core);
struct pw_context *context = pw_core_proxy_get_context(this);
struct pw_loop *loop = pw_context_get_main_loop(context);
int res;
if (mask & (SPA_IO_ERR | SPA_IO_HUP)) {
@ -698,7 +698,7 @@ static void on_need_flush(void *data)
int mask = impl->source->mask;
impl->flushing = true;
SPA_FLAG_SET(mask, SPA_IO_OUT);
pw_loop_update_io(impl->core->main_loop,
pw_loop_update_io(impl->context->main_loop,
impl->source, mask);
}
}
@ -717,7 +717,7 @@ static int impl_connect_fd(struct pw_protocol_client *client, int fd, bool do_cl
pw_protocol_native_connection_set_fd(impl->connection, fd);
impl->flushing = true;
impl->source = pw_loop_add_io(impl->core->main_loop,
impl->source = pw_loop_add_io(impl->context->main_loop,
fd,
SPA_IO_IN | SPA_IO_OUT | SPA_IO_HUP | SPA_IO_ERR,
do_close, on_remote_data, impl);
@ -747,7 +747,7 @@ static void impl_disconnect(struct pw_protocol_client *client)
impl->disconnecting = true;
if (impl->source)
pw_loop_destroy_source(impl->core->main_loop, impl->source);
pw_loop_destroy_source(impl->context->main_loop, impl->source);
impl->source = NULL;
if (impl->connection)
@ -825,8 +825,8 @@ impl_new_client(struct pw_protocol *protocol,
this = &impl->this;
this->protocol = protocol;
impl->core = protocol->core;
impl->connection = pw_protocol_native_connection_new(protocol->core, -1);
impl->context = protocol->context;
impl->connection = pw_protocol_native_connection_new(protocol->context, -1);
if (impl->connection == NULL) {
res = -errno;
goto error_free;
@ -836,7 +836,7 @@ impl_new_client(struct pw_protocol *protocol,
str = pw_properties_get(properties, PW_KEY_REMOTE_INTENTION);
if (str == NULL &&
(str = pw_properties_get(properties, PW_KEY_REMOTE_NAME)) != NULL &&
strcmp(str, impl->core->info.name) == 0)
strcmp(str, impl->context->info.name) == 0)
str = "internal";
}
if (str == NULL)
@ -905,7 +905,7 @@ static void on_before_hook(void *_data)
if (res == -EAGAIN) {
int mask = data->source->mask;
SPA_FLAG_SET(mask, SPA_IO_OUT);
pw_loop_update_io(client->protocol->core->main_loop,
pw_loop_update_io(client->protocol->context->main_loop,
data->source, mask);
} else if (res < 0) {
pw_log_warn("client %p: could not flush: %s",
@ -940,7 +940,7 @@ create_server(struct pw_protocol *protocol,
const struct pw_properties *properties)
{
struct pw_protocol_server *this;
struct pw_core *core = protocol->core;
struct pw_context *context = protocol->context;
struct server *s;
if ((s = calloc(1, sizeof(struct server))) == NULL)
@ -955,7 +955,7 @@ create_server(struct pw_protocol *protocol,
spa_list_append(&protocol->server_list, &this->link);
pw_loop_add_hook(pw_core_get_main_loop(core), &s->hook, &impl_hooks, s);
pw_loop_add_hook(pw_context_get_main_loop(context), &s->hook, &impl_hooks, s);
pw_log_info(NAME" %p: created server %p", protocol, this);
@ -1085,17 +1085,17 @@ static const struct pw_module_events module_events = {
SPA_EXPORT
int pipewire__module_init(struct pw_module *module, const char *args)
{
struct pw_core *core = pw_module_get_core(module);
struct pw_context *context = pw_module_get_context(module);
struct pw_protocol *this;
const char *val;
struct protocol_data *d;
const struct pw_properties *props;
int res;
if (pw_core_find_protocol(core, PW_TYPE_INFO_PROTOCOL_Native) != NULL)
if (pw_context_find_protocol(context, PW_TYPE_INFO_PROTOCOL_Native) != NULL)
return 0;
this = pw_protocol_new(core, PW_TYPE_INFO_PROTOCOL_Native, sizeof(struct protocol_data));
this = pw_protocol_new(context, PW_TYPE_INFO_PROTOCOL_Native, sizeof(struct protocol_data));
if (this == NULL)
return -errno;
@ -1115,7 +1115,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
d->local = create_server(this, props);
props = pw_core_get_properties(core);
props = pw_context_get_properties(context);
val = getenv("PIPEWIRE_DAEMON");
if (val == NULL)

View file

@ -63,7 +63,7 @@ struct buffer {
struct impl {
struct pw_protocol_native_connection this;
struct pw_core *core;
struct pw_context *context;
struct buffer in, out;
struct spa_pod_builder builder;
@ -225,7 +225,7 @@ static void clear_buffer(struct buffer *buf)
*
* \memberof pw_protocol_native_connection
*/
struct pw_protocol_native_connection *pw_protocol_native_connection_new(struct pw_core *core, int fd)
struct pw_protocol_native_connection *pw_protocol_native_connection_new(struct pw_context *context, int fd)
{
struct impl *impl;
struct pw_protocol_native_connection *this;
@ -235,7 +235,7 @@ struct pw_protocol_native_connection *pw_protocol_native_connection_new(struct p
return NULL;
debug_messages = pw_debug_is_category_enabled("connection");
impl->core = core;
impl->context = context;
this = &impl->this;

View file

@ -70,7 +70,7 @@ pw_protocol_native_connection_add_listener(struct pw_protocol_native_connection
}
struct pw_protocol_native_connection *
pw_protocol_native_connection_new(struct pw_core *core, int fd);
pw_protocol_native_connection_new(struct pw_context *context, int fd);
int pw_protocol_native_connection_set_fd(struct pw_protocol_native_connection *conn, int fd);

View file

@ -123,23 +123,23 @@ static void test_read_write(struct pw_protocol_native_connection *in,
int main(int argc, char *argv[])
{
struct pw_main_loop *loop;
struct pw_core *core;
struct pw_context *context;
struct pw_protocol_native_connection *in, *out;
int fds[2];
pw_init(&argc, &argv);
loop = pw_main_loop_new(NULL);
core = pw_core_new(pw_main_loop_get_loop(loop), NULL, 0);
context = pw_context_new(pw_main_loop_get_loop(loop), NULL, 0);
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) {
spa_assert_not_reached();
return -1;
}
in = pw_protocol_native_connection_new(core, fds[0]);
in = pw_protocol_native_connection_new(context, fds[0]);
spa_assert(in != NULL);
out = pw_protocol_native_connection_new(core, fds[1]);
out = pw_protocol_native_connection_new(context, fds[1]);
spa_assert(out != NULL);
test_create(in);

View file

@ -51,7 +51,7 @@ static const struct spa_dict_item module_props[] = {
};
struct impl {
struct pw_core *core;
struct pw_context *context;
struct spa_loop *loop;
struct spa_system *system;
@ -486,7 +486,7 @@ static void idle_func(struct spa_source *source)
SPA_EXPORT
int pipewire__module_init(struct pw_module *module, const char *args)
{
struct pw_core *core = pw_module_get_core(module);
struct pw_context *context = pw_module_get_context(module);
struct impl *impl;
struct spa_loop *loop;
struct spa_system *system;
@ -494,7 +494,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
uint32_t n_support;
int res;
support = pw_core_get_support(core, &n_support);
support = pw_context_get_support(context, &n_support);
loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
if (loop == NULL)
@ -510,7 +510,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
pw_log_debug("module %p: new", impl);
impl->core = core;
impl->context = context;
impl->loop = loop;
impl->system = system;

View file

@ -32,7 +32,7 @@ int client_endpoint_factory_init(struct pw_module *module);
/* client-session.c */
int client_session_factory_init(struct pw_module *module);
/* protocol-native.c */
struct pw_protocol *pw_protocol_native_ext_session_manager_init(struct pw_core *core);
struct pw_protocol *pw_protocol_native_ext_session_manager_init(struct pw_context *context);
static const struct spa_dict_item module_props[] = {
{ PW_KEY_MODULE_AUTHOR, "George Kiagiadakis <george.kiagiadakis@collabora.com>" },
@ -43,12 +43,12 @@ static const struct spa_dict_item module_props[] = {
SPA_EXPORT
int pipewire__module_init(struct pw_module *module, const char *args)
{
struct pw_core *core = pw_module_get_core(module);
struct pw_context *context = pw_module_get_context(module);
client_endpoint_factory_init(module);
client_session_factory_init(module);
pw_protocol_native_ext_session_manager_init(core);
pw_protocol_native_ext_session_manager_init(context);
pw_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props));

View file

@ -78,7 +78,7 @@ static int client_endpoint_stream_update(void *object,
struct pw_properties *props = NULL;
if (!stream) {
struct pw_core *core = pw_global_get_core(endpoint->global);
struct pw_context *context = pw_global_get_context(endpoint->global);
const char *keys[] = {
PW_KEY_FACTORY_ID,
PW_KEY_CLIENT_ID,
@ -103,7 +103,7 @@ static int client_endpoint_stream_update(void *object,
pw_properties_update_keys(props, info->props, keys);
if (endpoint_stream_init(stream, stream_id, endpoint->info.id,
this, core, props) < 0)
this, context, props) < 0)
goto no_mem;
spa_list_append(&this->streams, &stream->link);
@ -169,7 +169,7 @@ static void *create_object(void *data,
struct pw_factory *factory = d->factory;
struct client_endpoint *this;
struct pw_client *owner = pw_resource_get_client(owner_resource);
struct pw_core *core = pw_client_get_core(owner);
struct pw_context *context = pw_client_get_context(owner);
this = calloc(1, sizeof(struct client_endpoint));
if (this == NULL)
@ -191,7 +191,7 @@ static void *create_object(void *data,
if (this->resource == NULL)
goto no_mem;
if (endpoint_init(&this->endpoint, this, core, properties) < 0)
if (endpoint_init(&this->endpoint, this, context, properties) < 0)
goto no_mem;
pw_resource_add_listener(this->resource, &this->resource_listener,
@ -252,11 +252,11 @@ static const struct pw_module_events module_events = {
int client_endpoint_factory_init(struct pw_module *module)
{
struct pw_core *core = pw_module_get_core(module);
struct pw_context *context = pw_module_get_context(module);
struct pw_factory *factory;
struct factory_data *data;
factory = pw_factory_new(core,
factory = pw_factory_new(context,
"client-endpoint",
PW_TYPE_INTERFACE_ClientEndpoint,
PW_VERSION_CLIENT_ENDPOINT_PROXY,

View file

@ -78,7 +78,7 @@ static int client_session_link_update(void *object,
struct pw_properties *props = NULL;
if (!link) {
struct pw_core *core = pw_global_get_core(session->global);
struct pw_context *context = pw_global_get_context(session->global);
const char *keys[] = {
PW_KEY_FACTORY_ID,
PW_KEY_CLIENT_ID,
@ -102,7 +102,7 @@ static int client_session_link_update(void *object,
pw_properties_update_keys(props, info->props, keys);
if (endpoint_link_init(link, link_id, session->info.id,
this, core, props) < 0)
this, context, props) < 0)
goto no_mem;
spa_list_append(&this->links, &link->link);
@ -168,7 +168,7 @@ static void *create_object(void *data,
struct pw_factory *factory = d->factory;
struct client_session *this;
struct pw_client *owner = pw_resource_get_client(owner_resource);
struct pw_core *core = pw_client_get_core(owner);
struct pw_context *context = pw_client_get_context(owner);
this = calloc(1, sizeof(struct client_session));
if (this == NULL)
@ -190,7 +190,7 @@ static void *create_object(void *data,
if (this->resource == NULL)
goto no_mem;
if (session_init(&this->session, this, core, properties) < 0)
if (session_init(&this->session, this, context, properties) < 0)
goto no_mem;
pw_resource_add_listener(this->resource, &this->resource_listener,
@ -251,11 +251,11 @@ static const struct pw_module_events module_events = {
int client_session_factory_init(struct pw_module *module)
{
struct pw_core *core = pw_module_get_core(module);
struct pw_context *context = pw_module_get_context(module);
struct pw_factory *factory;
struct factory_data *data;
factory = pw_factory_new(core,
factory = pw_factory_new(context,
"client-session",
PW_TYPE_INTERFACE_ClientSession,
PW_VERSION_CLIENT_SESSION_PROXY,

View file

@ -294,7 +294,7 @@ static int endpoint_link_bind(void *_data, struct pw_client *client,
int endpoint_link_init(struct endpoint_link *this,
uint32_t id, uint32_t session_id,
struct client_session *client_sess,
struct pw_core *core,
struct pw_context *context,
struct pw_properties *properties)
{
pw_log_debug(NAME" %p: new", this);
@ -309,7 +309,7 @@ int endpoint_link_init(struct endpoint_link *this,
if (!properties)
goto no_mem;
this->global = pw_global_new (core,
this->global = pw_global_new(context,
PW_TYPE_INTERFACE_EndpointLink,
PW_VERSION_ENDPOINT_LINK_PROXY,
properties, endpoint_link_bind, this);

View file

@ -46,7 +46,7 @@ struct endpoint_link {
int endpoint_link_init(struct endpoint_link *this,
uint32_t id, uint32_t session_id,
struct client_session *client_sess,
struct pw_core *core,
struct pw_context *context,
struct pw_properties *properties);
void endpoint_link_clear(struct endpoint_link *this);

View file

@ -276,7 +276,7 @@ static int endpoint_stream_bind(void *_data, struct pw_client *client,
int endpoint_stream_init(struct endpoint_stream *this,
uint32_t id, uint32_t endpoint_id,
struct client_endpoint *client_ep,
struct pw_core *core,
struct pw_context *context,
struct pw_properties *properties)
{
pw_log_debug(NAME" %p: new", this);
@ -291,7 +291,7 @@ int endpoint_stream_init(struct endpoint_stream *this,
if (!properties)
goto no_mem;
this->global = pw_global_new (core,
this->global = pw_global_new (context,
PW_TYPE_INTERFACE_EndpointStream,
PW_VERSION_ENDPOINT_STREAM_PROXY,
properties, endpoint_stream_bind, this);

View file

@ -46,7 +46,7 @@ struct endpoint_stream {
int endpoint_stream_init(struct endpoint_stream *this,
uint32_t id, uint32_t endpoint_id,
struct client_endpoint *client_ep,
struct pw_core *core,
struct pw_context *context,
struct pw_properties *properties);
void endpoint_stream_clear(struct endpoint_stream *this);

View file

@ -297,7 +297,7 @@ static int endpoint_bind(void *_data, struct pw_client *client,
int endpoint_init(struct endpoint *this,
struct client_endpoint *client_ep,
struct pw_core *core,
struct pw_context *context,
struct pw_properties *properties)
{
const char *keys[] = {
@ -326,7 +326,7 @@ int endpoint_init(struct endpoint *this,
pw_properties_update_keys(properties, &this->props->dict, keys);
this->global = pw_global_new (core,
this->global = pw_global_new (context,
PW_TYPE_INTERFACE_Endpoint,
PW_VERSION_ENDPOINT_PROXY,
properties, endpoint_bind, this);

View file

@ -43,7 +43,7 @@ struct endpoint {
int endpoint_init(struct endpoint *this,
struct client_endpoint *client_ep,
struct pw_core *core,
struct pw_context *context,
struct pw_properties *properties);
void endpoint_clear(struct endpoint *this);

View file

@ -2001,11 +2001,11 @@ static const struct pw_protocol_marshal pw_protocol_native_session_marshal = {
&pw_protocol_native_session_event_demarshal,
};
struct pw_protocol *pw_protocol_native_ext_session_manager_init(struct pw_core *core)
struct pw_protocol *pw_protocol_native_ext_session_manager_init(struct pw_context *context)
{
struct pw_protocol *protocol;
protocol = pw_core_find_protocol(core, PW_TYPE_INFO_PROTOCOL_Native);
protocol = pw_context_find_protocol(context, PW_TYPE_INFO_PROTOCOL_Native);
if (protocol == NULL)
return NULL;

View file

@ -267,7 +267,7 @@ static int session_bind(void *_data, struct pw_client *client,
int session_init(struct session *this,
struct client_session *client_sess,
struct pw_core *core,
struct pw_context *context,
struct pw_properties *properties)
{
const char *keys[] = {
@ -287,7 +287,7 @@ int session_init(struct session *this,
pw_properties_update_keys(properties, &this->props->dict, keys);
this->global = pw_global_new (core,
this->global = pw_global_new (context,
PW_TYPE_INTERFACE_Session,
PW_VERSION_SESSION_PROXY,
properties, session_bind, this);

View file

@ -43,7 +43,7 @@ struct session {
int session_init(struct session *this,
struct client_session *client_sess,
struct pw_core *core,
struct pw_context *context,
struct pw_properties *properties);
void session_clear(struct session *this);

View file

@ -47,7 +47,7 @@ static const struct spa_dict_item module_props[] = {
};
struct factory_data {
struct pw_core *core;
struct pw_context *context;
struct pw_module *module;
struct pw_factory *this;
@ -83,7 +83,7 @@ static void *create_object(void *_data,
uint32_t new_id)
{
struct factory_data *data = _data;
struct pw_core *core = data->core;
struct pw_context *context = data->context;
struct pw_device *device;
const char *factory_name;
struct device_data *nd;
@ -107,7 +107,7 @@ static void *create_object(void *_data,
pw_global_get_id(pw_client_get_global(client)));
}
device = pw_spa_device_load(core,
device = pw_spa_device_load(context,
factory_name,
0,
properties,
@ -201,11 +201,11 @@ static const struct pw_module_events module_events = {
SPA_EXPORT
int pipewire__module_init(struct pw_module *module, const char *args)
{
struct pw_core *core = pw_module_get_core(module);
struct pw_context *context = pw_module_get_context(module);
struct pw_factory *factory;
struct factory_data *data;
factory = pw_factory_new(core,
factory = pw_factory_new(context,
"spa-device-factory",
PW_TYPE_INTERFACE_Device,
PW_VERSION_DEVICE_PROXY,
@ -217,7 +217,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
data = pw_factory_get_user_data(factory);
data->this = factory;
data->module = module;
data->core = core;
data->context = context;
spa_list_init(&data->device_list);
pw_factory_add_listener(factory, &data->factory_listener, &factory_events, data);

View file

@ -29,7 +29,7 @@
#include <getopt.h>
#include <limits.h>
#include <pipewire/core.h>
#include <pipewire/context.h>
#include <pipewire/log.h>
#include <pipewire/module.h>
#include <pipewire/utils.h>
@ -48,7 +48,7 @@ static const struct spa_dict_item module_props[] = {
struct device_data {
struct pw_device *this;
struct pw_core *core;
struct pw_context *context;
struct spa_hook module_listener;
};
@ -73,7 +73,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
struct pw_properties *props = NULL;
char **argv = NULL;
int n_tokens;
struct pw_core *core = pw_module_get_core(module);
struct pw_context *context = pw_module_get_context(module);
struct pw_device *device;
struct device_data *data;
int res;
@ -93,7 +93,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
}
}
device = pw_spa_device_load(core,
device = pw_spa_device_load(context,
argv[0],
0,
props,
@ -107,7 +107,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
data = pw_spa_device_get_user_data(device);
data->this = device;
data->core = core;
data->context = context;
pw_log_debug("module %p: new", module);
pw_module_add_listener(module, &data->module_listener, &module_events, data);

View file

@ -47,7 +47,7 @@ static const struct spa_dict_item module_props[] = {
};
struct factory_data {
struct pw_core *core;
struct pw_context *context;
struct pw_factory *this;
struct pw_module *module;
@ -101,7 +101,7 @@ static void *create_object(void *_data,
uint32_t new_id)
{
struct factory_data *data = _data;
struct pw_core *core = data->core;
struct pw_context *context = data->context;
struct pw_node *node;
const char *factory_name;
struct node_data *nd;
@ -125,7 +125,7 @@ static void *create_object(void *_data,
pw_global_get_id(pw_client_get_global(client)));
}
node = pw_spa_node_load(core,
node = pw_spa_node_load(context,
factory_name,
PW_SPA_NODE_FLAG_ACTIVATE,
properties,
@ -235,11 +235,11 @@ static const struct pw_module_events module_events = {
SPA_EXPORT
int pipewire__module_init(struct pw_module *module, const char *args)
{
struct pw_core *core = pw_module_get_core(module);
struct pw_context *context = pw_module_get_context(module);
struct pw_factory *factory;
struct factory_data *data;
factory = pw_factory_new(core,
factory = pw_factory_new(context,
"spa-node-factory",
PW_TYPE_INTERFACE_Node,
PW_VERSION_NODE_PROXY,
@ -250,7 +250,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
data = pw_factory_get_user_data(factory);
data->this = factory;
data->core = core;
data->context = context;
data->module = module;
spa_list_init(&data->node_list);

View file

@ -31,7 +31,7 @@
#include <getopt.h>
#include <limits.h>
#include <pipewire/core.h>
#include <pipewire/context.h>
#include <pipewire/keys.h>
#include <pipewire/log.h>
#include <pipewire/module.h>
@ -50,7 +50,7 @@ static const struct spa_dict_item module_props[] = {
struct node_data {
struct pw_node *this;
struct pw_core *core;
struct pw_context *context;
struct pw_properties *properties;
struct spa_hook module_listener;
@ -74,7 +74,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
struct pw_properties *props = NULL;
char **argv = NULL;
int n_tokens, res;
struct pw_core *core = pw_module_get_core(module);
struct pw_context *context = pw_module_get_context(module);
struct pw_node *node;
struct node_data *data;
@ -93,7 +93,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
}
}
node = pw_spa_node_load(core,
node = pw_spa_node_load(context,
argv[0],
PW_SPA_NODE_FLAG_ACTIVATE,
props,
@ -108,7 +108,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
data = pw_spa_node_get_user_data(node);
data->this = node;
data->core = core;
data->context = context;
data->properties = props;
pw_log_debug("module %p: new", module);

View file

@ -73,7 +73,7 @@ static const struct pw_device_events device_events = {
};
struct pw_device *
pw_spa_device_new(struct pw_core *core,
pw_spa_device_new(struct pw_context *context,
enum pw_spa_device_flags flags,
struct spa_device *device,
struct spa_handle *handle,
@ -84,7 +84,7 @@ pw_spa_device_new(struct pw_core *core,
struct impl *impl;
int res;
this = pw_device_new(core, properties, sizeof(struct impl) + user_data_size);
this = pw_device_new(context, properties, sizeof(struct impl) + user_data_size);
if (this == NULL)
return NULL;
@ -118,7 +118,7 @@ void *pw_spa_device_get_user_data(struct pw_device *device)
return impl->user_data;
}
struct pw_device *pw_spa_device_load(struct pw_core *core,
struct pw_device *pw_spa_device_load(struct pw_context *context,
const char *factory_name,
enum pw_spa_device_flags flags,
struct pw_properties *properties,
@ -129,7 +129,7 @@ struct pw_device *pw_spa_device_load(struct pw_core *core,
void *iface;
int res;
handle = pw_core_load_spa_handle(core, factory_name,
handle = pw_context_load_spa_handle(context, factory_name,
properties ? &properties->dict : NULL);
if (handle == NULL)
goto error_load;
@ -137,7 +137,7 @@ struct pw_device *pw_spa_device_load(struct pw_core *core,
if ((res = spa_handle_get_interface(handle, SPA_TYPE_INTERFACE_Device, &iface)) < 0)
goto error_interface;
this = pw_spa_device_new(core, flags,
this = pw_spa_device_new(context, flags,
iface, handle, properties, user_data_size);
if (this == NULL)
goto error_device;

View file

@ -27,7 +27,7 @@
#include <spa/monitor/device.h>
#include <pipewire/core.h>
#include <pipewire/context.h>
#include <pipewire/device.h>
#ifdef __cplusplus
@ -40,7 +40,7 @@ enum pw_spa_device_flags {
};
struct pw_device *
pw_spa_device_new(struct pw_core *core,
pw_spa_device_new(struct pw_context *context,
enum pw_spa_device_flags flags,
struct spa_device *device,
struct spa_handle *handle,
@ -48,7 +48,7 @@ pw_spa_device_new(struct pw_core *core,
size_t user_data_size);
struct pw_device *
pw_spa_device_load(struct pw_core *core,
pw_spa_device_load(struct pw_context *context,
const char *factory_name,
enum pw_spa_device_flags flags,
struct pw_properties *properties,

View file

@ -106,7 +106,7 @@ static const struct pw_node_events node_events = {
};
struct pw_node *
pw_spa_node_new(struct pw_core *core,
pw_spa_node_new(struct pw_context *context,
enum pw_spa_node_flags flags,
struct spa_node *node,
struct spa_handle *handle,
@ -117,7 +117,7 @@ pw_spa_node_new(struct pw_core *core,
struct impl *impl;
int res;
this = pw_node_new(core, properties, sizeof(struct impl) + user_data_size);
this = pw_node_new(context, properties, sizeof(struct impl) + user_data_size);
if (this == NULL) {
res = -errno;
goto error_exit;
@ -161,7 +161,7 @@ void *pw_spa_node_get_user_data(struct pw_node *node)
}
static int
setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_properties *pw_props)
setup_props(struct pw_context *context, struct spa_node *spa_node, struct pw_properties *pw_props)
{
int res;
struct spa_pod *props;
@ -234,7 +234,7 @@ setup_props(struct pw_core *core, struct spa_node *spa_node, struct pw_propertie
}
struct pw_node *pw_spa_node_load(struct pw_core *core,
struct pw_node *pw_spa_node_load(struct pw_context *context,
const char *factory_name,
enum pw_spa_node_flags flags,
struct pw_properties *properties,
@ -247,7 +247,7 @@ struct pw_node *pw_spa_node_load(struct pw_core *core,
struct spa_handle *handle;
void *iface;
handle = pw_core_load_spa_handle(core,
handle = pw_context_load_spa_handle(context,
factory_name,
properties ? &properties->dict : NULL);
if (handle == NULL) {
@ -265,12 +265,12 @@ struct pw_node *pw_spa_node_load(struct pw_core *core,
spa_node = iface;
if (properties != NULL) {
if (setup_props(core, spa_node, properties) < 0) {
if (setup_props(context, spa_node, properties) < 0) {
pw_log_warn("can't setup properties: %s", spa_strerror(res));
}
}
this = pw_spa_node_new(core, flags,
this = pw_spa_node_new(context, flags,
spa_node, handle, properties, user_data_size);
if (this == NULL) {
res = -errno;

View file

@ -27,7 +27,7 @@
#include <spa/node/node.h>
#include <pipewire/core.h>
#include <pipewire/context.h>
#include <pipewire/node.h>
#ifdef __cplusplus
@ -41,7 +41,7 @@ enum pw_spa_node_flags {
};
struct pw_node *
pw_spa_node_new(struct pw_core *core,
pw_spa_node_new(struct pw_context *context,
enum pw_spa_node_flags flags,
struct spa_node *node,
struct spa_handle *handle,
@ -49,7 +49,7 @@ pw_spa_node_new(struct pw_core *core,
size_t user_data_size);
struct pw_node *
pw_spa_node_load(struct pw_core *core,
pw_spa_node_load(struct pw_context *context,
const char *factory_name,
enum pw_spa_node_flags flags,
struct pw_properties *properties,