rename core_proxy -> core

Rename core_proxy to core and move the introspect and interface
contents to core.h

In an effort to promote the proxy API.
This commit is contained in:
Wim Taymans 2019-12-11 07:46:59 +01:00
parent 8ea78c2e3f
commit ecc6b27cd7
54 changed files with 1068 additions and 1059 deletions

View file

@ -75,7 +75,7 @@ struct impl {
struct pw_main_loop *loop;
struct pw_context *context;
struct pw_core_proxy *core_proxy;
struct pw_core *core;
struct spa_hook core_listener;
struct spa_handle *handle;
@ -140,7 +140,7 @@ static struct node *create_node(struct object *obj, uint32_t id,
node->id = id;
node->handle = handle;
node->node = iface;
node->proxy = pw_core_proxy_export(impl->core_proxy,
node->proxy = pw_core_export(impl->core,
info->type, pw_properties_new_dict(info->props), node->node, 0);
if (node->proxy == NULL)
goto clean_node;
@ -248,7 +248,7 @@ static struct object *create_object(struct impl *impl, uint32_t id,
obj->id = id;
obj->handle = handle;
obj->device = iface;
obj->proxy = pw_core_proxy_export(impl->core_proxy,
obj->proxy = pw_core_export(impl->core,
info->type, pw_properties_new_dict(info->props), obj->device, 0);
if (obj->proxy == NULL)
goto clean_object;
@ -350,8 +350,8 @@ static void on_core_error(void *data, uint32_t id, int seq, int res, const char
}
}
static const struct pw_core_proxy_events core_events = {
PW_VERSION_CORE_PROXY_EVENTS,
static const struct pw_core_events core_events = {
PW_VERSION_CORE_EVENTS,
.error = on_core_error,
};
@ -371,13 +371,13 @@ int main(int argc, char *argv[])
spa_list_init(&impl.device_list);
impl.core_proxy = pw_context_connect(impl.context, NULL, 0);
if (impl.core_proxy == NULL) {
impl.core = pw_context_connect(impl.context, NULL, 0);
if (impl.core == NULL) {
pw_log_error(NAME" %p: can't connect %m", &impl);
return -1;
}
pw_core_proxy_add_listener(impl.core_proxy,
pw_core_add_listener(impl.core,
&impl.core_listener,
&core_events, &impl);

View file

@ -71,7 +71,7 @@ struct data {
struct pw_context *context;
struct pw_core_proxy *core_proxy;
struct pw_core *core;
struct spa_hook core_listener;
struct spa_node impl_node;
@ -474,7 +474,7 @@ static void make_node(struct data *data)
SPA_TYPE_INTERFACE_Node,
SPA_VERSION_NODE,
&impl_node, data);
pw_core_proxy_export(data->core_proxy, SPA_TYPE_INTERFACE_Node, props, &data->impl_node, 0);
pw_core_export(data->core, SPA_TYPE_INTERFACE_Node, props, &data->impl_node, 0);
}
static void set_permissions(struct data *data)
@ -490,7 +490,7 @@ static void set_permissions(struct data *data)
permissions[1].permissions = PW_PERM_R;
pw_client_proxy_update_permissions(
pw_core_proxy_get_client_proxy(data->core_proxy),
pw_core_get_client_proxy(data->core),
2, permissions);
}
@ -506,8 +506,8 @@ static void on_core_error(void *data, uint32_t id, int seq, int res, const char
}
}
static const struct pw_core_proxy_events core_events = {
PW_VERSION_CORE_PROXY_EVENTS,
static const struct pw_core_events core_events = {
PW_VERSION_CORE_EVENTS,
.error = on_core_error,
};
@ -548,12 +548,12 @@ int main(int argc, char *argv[])
return -1;
}
data.core_proxy = pw_context_connect(data.context, NULL, 0);
if (data.core_proxy == NULL) {
data.core = pw_context_connect(data.context, NULL, 0);
if (data.core == NULL) {
printf("can't connect: %m\n");
return -1;
}
pw_core_proxy_add_listener(data.core_proxy, &data.core_listener, &core_events, &data);
pw_core_add_listener(data.core, &data.core_listener, &core_events, &data);
set_permissions(&data);

View file

@ -56,7 +56,7 @@ struct data {
struct pw_context *context;
struct pw_core_proxy *core_proxy;
struct pw_core *core;
struct spa_hook core_listener;
uint64_t info_all;
@ -482,7 +482,7 @@ static void make_node(struct data *data)
SPA_TYPE_INTERFACE_Node,
SPA_VERSION_NODE,
&impl_node, data);
pw_core_proxy_export(data->core_proxy, SPA_TYPE_INTERFACE_Node, props, &data->impl_node, 0);
pw_core_export(data->core, SPA_TYPE_INTERFACE_Node, props, &data->impl_node, 0);
}
static void on_core_error(void *data, uint32_t id, int seq, int res, const char *message)
@ -497,8 +497,8 @@ static void on_core_error(void *data, uint32_t id, int seq, int res, const char
}
}
static const struct pw_core_proxy_events core_events = {
PW_VERSION_CORE_PROXY_EVENTS,
static const struct pw_core_events core_events = {
PW_VERSION_CORE_EVENTS,
.error = on_core_error,
};
@ -531,12 +531,12 @@ int main(int argc, char *argv[])
spa_list_init(&data.empty);
spa_hook_list_init(&data.hooks);
if ((data.core_proxy = pw_context_connect(data.context, NULL, 0)) == NULL) {
if ((data.core = pw_context_connect(data.context, NULL, 0)) == NULL) {
printf("can't connect: %m\n");
return -1;
}
pw_core_proxy_add_listener(data.core_proxy, &data.core_listener, &core_events, &data);
pw_core_add_listener(data.core, &data.core_listener, &core_events, &data);
make_node(&data);

View file

@ -37,7 +37,7 @@ struct data {
struct pw_context *context;
struct pw_core_proxy *core_proxy;
struct pw_core *core;
struct spa_hook core_listener;
struct pw_device *device;
@ -64,7 +64,7 @@ static int make_device(struct data *data)
PW_VERSION_DEVICE_PROXY,
props, SPA_ID_INVALID);
pw_core_proxy_export(data->core_proxy, SPA_TYPE_INTERFACE_Device, NULL,
pw_core_export(data->core, SPA_TYPE_INTERFACE_Device, NULL,
pw_device_get_implementation(data->device), 0);
return 0;
@ -82,8 +82,8 @@ static void on_core_error(void *data, uint32_t id, int seq, int res, const char
}
}
static const struct pw_core_proxy_events core_events = {
PW_VERSION_CORE_PROXY_EVENTS,
static const struct pw_core_events core_events = {
PW_VERSION_CORE_EVENTS,
.error = on_core_error,
};
@ -117,13 +117,13 @@ int main(int argc, char *argv[])
pw_module_load(data.context, "libpipewire-module-spa-device-factory", NULL, NULL);
data.core_proxy = pw_context_connect(data.context, NULL, 0);
if (data.core_proxy == NULL) {
data.core = pw_context_connect(data.context, NULL, 0);
if (data.core == NULL) {
pw_log_error("can't connect %m");
return -1;
}
pw_core_proxy_add_listener(data.core_proxy, &data.core_listener, &core_events, &data);
pw_core_add_listener(data.core, &data.core_listener, &core_events, &data);
if (make_device(&data) < 0) {
pw_log_error("can't make device");

View file

@ -37,7 +37,7 @@ struct data {
struct pw_context *context;
struct pw_core_proxy *core_proxy;
struct pw_core *core;
struct spa_hook core_listener;
struct spa_node *node;
@ -91,7 +91,7 @@ static int make_node(struct data *data)
pw_properties_set(props, PW_KEY_NODE_TARGET, data->path);
}
data->proxy = pw_core_proxy_export(data->core_proxy,
data->proxy = pw_core_export(data->core,
SPA_TYPE_INTERFACE_Node, props,
data->node, 0);
if (data->proxy == NULL)
@ -115,8 +115,8 @@ static void on_core_error(void *data, uint32_t id, int seq, int res, const char
}
}
static const struct pw_core_proxy_events core_events = {
PW_VERSION_CORE_PROXY_EVENTS,
static const struct pw_core_events core_events = {
PW_VERSION_CORE_EVENTS,
.error = on_core_error,
};
@ -152,12 +152,12 @@ int main(int argc, char *argv[])
pw_module_load(data.context, "libpipewire-module-spa-node-factory", NULL, NULL);
data.core_proxy = pw_context_connect(data.context, NULL, 0);
if (data.core_proxy == NULL) {
data.core = pw_context_connect(data.context, NULL, 0);
if (data.core == NULL) {
printf("can't connect: %m\n");
return -1;
}
pw_core_proxy_add_listener(data.core_proxy,
pw_core_add_listener(data.core,
&data.core_listener,
&core_events, &data);

View file

@ -50,7 +50,7 @@ struct data {
struct spa_source *timer;
struct pw_context *context;
struct pw_core_proxy *core_proxy;
struct pw_core *core;
struct spa_port_info port_info;
struct spa_node impl_node;
@ -349,7 +349,7 @@ static int make_nodes(struct data *data)
SPA_VERSION_NODE,
&impl_node, data);
in = pw_core_proxy_export(data->core_proxy,
in = pw_core_export(data->core,
SPA_TYPE_INTERFACE_Node,
NULL,
&data->impl_node,
@ -360,7 +360,7 @@ static int make_nodes(struct data *data)
SPA_KEY_FACTORY_NAME, SPA_NAME_API_V4L2_SOURCE,
NULL);
out = pw_core_proxy_create_object(data->core_proxy,
out = pw_core_create_object(data->core,
"spa-node-factory",
PW_TYPE_INTERFACE_Node,
PW_VERSION_NODE_PROXY,
@ -383,7 +383,7 @@ static int make_nodes(struct data *data)
pw_properties_setf(props,
PW_KEY_LINK_INPUT_NODE, "%d", pw_proxy_get_bound_id(in));
pw_core_proxy_create_object(data->core_proxy,
pw_core_create_object(data->core,
"link-factory",
PW_TYPE_INTERFACE_Link,
PW_VERSION_LINK_PROXY,
@ -423,8 +423,8 @@ int main(int argc, char *argv[])
return -1;
}
data.core_proxy = pw_context_connect_self(data.context, NULL, 0);
if (data.core_proxy == NULL) {
data.core = pw_context_connect_self(data.context, NULL, 0);
if (data.core == NULL) {
printf("can't connect to core: %m\n");
return -1;
}

View file

@ -91,10 +91,10 @@ struct impl {
struct pw_main_loop *loop;
struct spa_dbus *dbus;
struct pw_core_proxy *monitor_core;
struct pw_core *monitor_core;
struct spa_hook monitor_listener;
struct pw_core_proxy *policy_core;
struct pw_core *policy_core;
struct spa_hook policy_listener;
struct pw_registry_proxy *registry_proxy;
@ -1131,7 +1131,7 @@ int sm_media_session_schedule_rescan(struct sm_media_session *sess)
{
struct impl *impl = SPA_CONTAINER_OF(sess, struct impl, this);
if (impl->policy_core)
impl->rescan_seq = pw_core_proxy_sync(impl->policy_core, 0, impl->last_seq);
impl->rescan_seq = pw_core_sync(impl->policy_core, 0, impl->last_seq);
return impl->rescan_seq;
}
@ -1148,7 +1148,7 @@ int sm_media_session_sync(struct sm_media_session *sess,
spa_list_append(&impl->sync_list, &sync->link);
sync->callback = callback;
sync->data = data;
sync->seq = pw_core_proxy_sync(impl->policy_core, 0, impl->last_seq);
sync->seq = pw_core_sync(impl->policy_core, 0, impl->last_seq);
return sync->seq;
}
@ -1213,7 +1213,7 @@ struct pw_proxy *sm_media_session_export(struct sm_media_session *sess,
void *object, size_t user_data_size)
{
struct impl *impl = SPA_CONTAINER_OF(sess, struct impl, this);
return pw_core_proxy_export(impl->monitor_core, type,
return pw_core_export(impl->monitor_core, type,
properties, object, user_data_size);
}
@ -1226,7 +1226,7 @@ struct sm_device *sm_media_session_export_device(struct sm_media_session *sess,
pw_log_debug(NAME " %p: device %p", impl, object);
proxy = pw_core_proxy_export(impl->monitor_core, SPA_TYPE_INTERFACE_Device,
proxy = pw_core_export(impl->monitor_core, SPA_TYPE_INTERFACE_Device,
properties, object, sizeof(struct sm_device));
device = (struct sm_device *) create_object(impl, proxy, &properties->dict);
@ -1239,7 +1239,7 @@ struct pw_proxy *sm_media_session_create_object(struct sm_media_session *sess,
const struct spa_dict *props, size_t user_data_size)
{
struct impl *impl = SPA_CONTAINER_OF(sess, struct impl, this);
return pw_core_proxy_create_object(impl->policy_core,
return pw_core_create_object(impl->policy_core,
factory_name, type, version, props, user_data_size);
}
@ -1252,7 +1252,7 @@ struct sm_node *sm_media_session_create_node(struct sm_media_session *sess,
pw_log_debug(NAME " %p: node '%s'", impl, factory_name);
proxy = pw_core_proxy_create_object(impl->policy_core,
proxy = pw_core_create_object(impl->policy_core,
factory_name,
PW_TYPE_INTERFACE_Node,
PW_VERSION_NODE_PROXY,
@ -1328,7 +1328,7 @@ static int link_nodes(struct impl *impl, struct endpoint_link *link,
pw_properties_setf(props, PW_KEY_LINK_OUTPUT_PORT, "%d", outport->obj.id);
pw_properties_setf(props, PW_KEY_LINK_INPUT_PORT, "%d", inport->obj.id);
p = pw_core_proxy_create_object(impl->policy_core,
p = pw_core_create_object(impl->policy_core,
"link-factory",
PW_TYPE_INTERFACE_Link,
PW_VERSION_LINK_PROXY,
@ -1529,7 +1529,7 @@ static int start_session(struct impl *impl)
return -errno;
}
impl->client_session = pw_core_proxy_create_object(impl->monitor_core,
impl->client_session = pw_core_create_object(impl->monitor_core,
"client-session",
PW_TYPE_INTERFACE_ClientSession,
PW_VERSION_CLIENT_SESSION_PROXY,
@ -1578,8 +1578,8 @@ static void core_error(void *data, uint32_t id, int seq, int res, const char *me
}
static const struct pw_core_proxy_events core_events = {
PW_VERSION_CORE_PROXY_EVENTS,
static const struct pw_core_events core_events = {
PW_VERSION_CORE_EVENTS,
.done = core_done,
.error = core_error
};
@ -1592,10 +1592,10 @@ static int start_policy(struct impl *impl)
return -errno;
}
pw_core_proxy_add_listener(impl->policy_core,
pw_core_add_listener(impl->policy_core,
&impl->policy_listener,
&core_events, impl);
impl->registry_proxy = pw_core_proxy_get_registry(impl->policy_core,
impl->registry_proxy = pw_core_get_registry(impl->policy_core,
PW_VERSION_REGISTRY_PROXY, 0);
pw_registry_proxy_add_listener(impl->registry_proxy,
&impl->registry_listener,

View file

@ -47,7 +47,7 @@ struct data {
struct spa_source *timer;
struct pw_context *context;
struct pw_core_proxy *core_proxy;
struct pw_core *core;
struct pw_stream *stream;
struct spa_hook stream_listener;
@ -284,11 +284,11 @@ int main(int argc, char *argv[])
data.timer = pw_loop_add_timer(pw_main_loop_get_loop(data.loop), on_timeout, &data);
data.core_proxy = pw_context_connect(data.context, NULL, 0);
if (data.core_proxy == NULL)
data.core = pw_context_connect(data.context, NULL, 0);
if (data.core == NULL)
return -1;
data.stream = pw_stream_new(data.core_proxy, "video-src",
data.stream = pw_stream_new(data.core, "video-src",
pw_properties_new(
PW_KEY_MEDIA_CLASS, "Video/Source",
NULL));