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

@ -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,