mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-09-06 16:56:00 +00:00
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:
parent
8ea78c2e3f
commit
ecc6b27cd7
|
@ -70,7 +70,7 @@ typedef struct {
|
|||
|
||||
struct pw_context *context;
|
||||
|
||||
struct pw_core_proxy *core_proxy;
|
||||
struct pw_core *core;
|
||||
struct spa_hook core_listener;
|
||||
|
||||
uint32_t flags;
|
||||
|
@ -410,7 +410,7 @@ static int snd_pcm_pipewire_prepare(snd_pcm_ioplug_t *io)
|
|||
"Playback" : "Capture");
|
||||
pw_properties_set(props, PW_KEY_MEDIA_ROLE, "Music");
|
||||
|
||||
pw->stream = pw_stream_new(pw->core_proxy, pw->node_name, props);
|
||||
pw->stream = pw_stream_new(pw->core, pw->node_name, props);
|
||||
if (pw->stream == NULL)
|
||||
goto error;
|
||||
|
||||
|
@ -765,8 +765,8 @@ static void on_core_error(void *data, uint32_t id, int seq, int res, const char
|
|||
pw_thread_loop_signal(pw->main_loop, false);
|
||||
}
|
||||
|
||||
static const struct pw_core_proxy_events core_proxy_events = {
|
||||
PW_VERSION_CORE_PROXY_EVENTS,
|
||||
static const struct pw_core_events core_events = {
|
||||
PW_VERSION_CORE_EVENTS,
|
||||
.error = on_core_error,
|
||||
};
|
||||
|
||||
|
@ -827,13 +827,13 @@ static int snd_pcm_pipewire_open(snd_pcm_t **pcmp, const char *name,
|
|||
goto error;
|
||||
|
||||
pw_thread_loop_lock(pw->main_loop);
|
||||
pw->core_proxy = pw_context_connect(pw->context, props, 0);
|
||||
if (pw->core_proxy == NULL) {
|
||||
pw->core = pw_context_connect(pw->context, props, 0);
|
||||
if (pw->core == NULL) {
|
||||
err = -errno;
|
||||
pw_thread_loop_unlock(pw->main_loop);
|
||||
goto error;
|
||||
}
|
||||
pw_core_proxy_add_listener(pw->core_proxy, &pw->core_listener, &core_proxy_events, pw);
|
||||
pw_core_add_listener(pw->core, &pw->core_listener, &core_events, pw);
|
||||
pw_thread_loop_unlock(pw->main_loop);
|
||||
|
||||
pw->fd = spa_system_eventfd_create(pw->loop->system, SPA_FD_CLOEXEC | SPA_FD_NONBLOCK);
|
||||
|
|
|
@ -230,7 +230,7 @@ struct client {
|
|||
|
||||
struct pw_data_loop *loop;
|
||||
|
||||
struct pw_core_proxy *core_proxy;
|
||||
struct pw_core *core;
|
||||
struct spa_hook core_listener;
|
||||
struct pw_mempool *pool;
|
||||
int last_sync;
|
||||
|
@ -559,8 +559,8 @@ static void on_error(void *data, uint32_t id, int seq, int res, const char *mess
|
|||
pw_thread_loop_signal(client->context.loop, false);
|
||||
}
|
||||
|
||||
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 = on_sync_reply,
|
||||
.error = on_error,
|
||||
};
|
||||
|
@ -569,7 +569,7 @@ static int do_sync(struct client *client)
|
|||
{
|
||||
int seq;
|
||||
|
||||
seq = pw_proxy_sync((struct pw_proxy*)client->core_proxy, client->last_sync);
|
||||
seq = pw_proxy_sync((struct pw_proxy*)client->core, client->last_sync);
|
||||
|
||||
while (true) {
|
||||
pw_thread_loop_wait(client->context.loop);
|
||||
|
@ -2142,21 +2142,21 @@ jack_client_t * jack_client_open (const char *client_name,
|
|||
|
||||
pw_thread_loop_lock(client->context.loop);
|
||||
|
||||
client->core_proxy = pw_context_connect(client->context.context,
|
||||
client->core = pw_context_connect(client->context.context,
|
||||
pw_properties_new(
|
||||
PW_KEY_CLIENT_NAME, client_name,
|
||||
PW_KEY_CLIENT_API, "jack",
|
||||
NULL),
|
||||
0);
|
||||
if (client->core_proxy == NULL)
|
||||
if (client->core == NULL)
|
||||
goto server_failed;
|
||||
|
||||
client->pool = pw_core_proxy_get_mempool(client->core_proxy);
|
||||
client->pool = pw_core_get_mempool(client->core);
|
||||
|
||||
pw_core_proxy_add_listener(client->core_proxy,
|
||||
pw_core_add_listener(client->core,
|
||||
&client->core_listener,
|
||||
&core_events, client);
|
||||
client->registry_proxy = pw_core_proxy_get_registry(client->core_proxy,
|
||||
client->registry_proxy = pw_core_get_registry(client->core,
|
||||
PW_VERSION_REGISTRY_PROXY, 0);
|
||||
pw_registry_proxy_add_listener(client->registry_proxy,
|
||||
&client->registry_listener,
|
||||
|
@ -2172,7 +2172,7 @@ jack_client_t * jack_client_open (const char *client_name,
|
|||
items[props.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_NODE_LATENCY, str);
|
||||
items[props.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_NODE_ALWAYS_PROCESS, "1");
|
||||
|
||||
client->node_proxy = pw_core_proxy_create_object(client->core_proxy,
|
||||
client->node_proxy = pw_core_create_object(client->core,
|
||||
"client-node",
|
||||
PW_TYPE_INTERFACE_ClientNode,
|
||||
PW_VERSION_CLIENT_NODE,
|
||||
|
@ -3419,7 +3419,7 @@ int jack_connect (jack_client_t *client,
|
|||
items[props.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_LINK_INPUT_PORT, val[3]);
|
||||
items[props.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_OBJECT_LINGER, "1");
|
||||
|
||||
pw_core_proxy_create_object(c->core_proxy,
|
||||
pw_core_create_object(c->core,
|
||||
"link-factory",
|
||||
PW_TYPE_INTERFACE_Link,
|
||||
PW_VERSION_LINK_PROXY,
|
||||
|
|
|
@ -844,8 +844,8 @@ static void core_done(void *data, uint32_t id, int seq)
|
|||
complete_operations(c, seq);
|
||||
}
|
||||
|
||||
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,
|
||||
.info = core_info,
|
||||
.done = core_done,
|
||||
.error = core_error
|
||||
|
@ -880,7 +880,7 @@ pa_operation* pa_context_subscribe(pa_context *c, pa_subscription_mask_t m, pa_c
|
|||
c->subscribe_mask = m;
|
||||
|
||||
if (c->registry_proxy == NULL) {
|
||||
c->registry_proxy = pw_core_proxy_get_registry(c->core_proxy,
|
||||
c->registry_proxy = pw_core_get_registry(c->core,
|
||||
PW_VERSION_REGISTRY_PROXY, 0);
|
||||
pw_registry_proxy_add_listener(c->registry_proxy,
|
||||
&c->registry_listener,
|
||||
|
@ -1056,13 +1056,13 @@ int pa_context_connect(pa_context *c, const char *server, pa_context_flags_t fla
|
|||
|
||||
pa_context_set_state(c, PA_CONTEXT_CONNECTING);
|
||||
|
||||
c->core_proxy = pw_context_connect(c->context, pw_properties_copy(c->props), 0);
|
||||
if (c->core_proxy == NULL) {
|
||||
c->core = pw_context_connect(c->context, pw_properties_copy(c->props), 0);
|
||||
if (c->core == NULL) {
|
||||
context_fail(c, PA_ERR_CONNECTIONREFUSED);
|
||||
res = -1;
|
||||
goto exit;
|
||||
}
|
||||
pw_core_proxy_add_listener(c->core_proxy, &c->core_listener, &core_events, c);
|
||||
pw_core_add_listener(c->core, &c->core_listener, &core_events, c);
|
||||
|
||||
exit:
|
||||
pa_context_unref(c);
|
||||
|
@ -1077,9 +1077,9 @@ void pa_context_disconnect(pa_context *c)
|
|||
pa_assert(c->refcount >= 1);
|
||||
|
||||
c->disconnect = true;
|
||||
if (c->core_proxy) {
|
||||
pw_core_proxy_disconnect(c->core_proxy);
|
||||
c->core_proxy = NULL;
|
||||
if (c->core) {
|
||||
pw_core_disconnect(c->core);
|
||||
c->core = NULL;
|
||||
}
|
||||
if (PA_CONTEXT_IS_GOOD(c->state))
|
||||
pa_context_set_state(c, PA_CONTEXT_TERMINATED);
|
||||
|
@ -1198,7 +1198,7 @@ pa_operation* pa_context_set_name(pa_context *c, const char *name, pa_context_su
|
|||
if (changed) {
|
||||
struct pw_client_proxy *client_proxy;
|
||||
|
||||
client_proxy = pw_core_proxy_get_client_proxy(c->core_proxy);
|
||||
client_proxy = pw_core_get_client_proxy(c->core);
|
||||
pw_client_proxy_update_properties(client_proxy, &c->props->dict);
|
||||
}
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ struct pa_context {
|
|||
|
||||
struct pw_properties *props;
|
||||
|
||||
struct pw_core_proxy *core_proxy;
|
||||
struct pw_core *core;
|
||||
struct spa_hook core_listener;
|
||||
struct pw_core_info *core_info;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ pa_operation *pa_operation_new(pa_context *c, pa_stream *s, pa_operation_cb_t cb
|
|||
int pa_operation_sync(pa_operation *o)
|
||||
{
|
||||
pa_context *c = o->context;
|
||||
o->seq = pw_core_proxy_sync(c->core_proxy, 0, 0);
|
||||
o->seq = pw_core_sync(c->core, 0, 0);
|
||||
pw_log_debug("operation %p: sync %d", o, o->seq);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -872,7 +872,7 @@ static int create_stream(pa_stream_direction_t direction,
|
|||
|
||||
name = pa_proplist_gets(s->proplist, PA_PROP_MEDIA_NAME);
|
||||
|
||||
s->stream = pw_stream_new(c->core_proxy,
|
||||
s->stream = pw_stream_new(c->core,
|
||||
name, pw_properties_copy(c->props));
|
||||
pw_stream_add_listener(s->stream, &s->stream_listener, &stream_events, s);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -285,7 +285,7 @@ static void add_pending(GstPipeWireDeviceProvider *self, struct pending *p,
|
|||
p->callback = callback;
|
||||
p->data = data;
|
||||
pw_log_debug("add pending %d", p->seq);
|
||||
self->seq = p->seq = pw_core_proxy_sync(self->core_proxy, 0, self->seq);
|
||||
self->seq = p->seq = pw_core_sync(self->core, 0, self->seq);
|
||||
}
|
||||
|
||||
static void remove_pending(struct pending *p)
|
||||
|
@ -360,8 +360,8 @@ on_core_error(void *data, uint32_t id, int seq, int res, const char *message)
|
|||
pw_thread_loop_signal(self->main_loop, FALSE);
|
||||
}
|
||||
|
||||
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,
|
||||
.info = on_core_info,
|
||||
.done = on_core_done,
|
||||
.error = on_core_error,
|
||||
|
@ -541,21 +541,21 @@ gst_pipewire_device_provider_probe (GstDeviceProvider * provider)
|
|||
spa_list_init(&data->ports);
|
||||
|
||||
spa_list_init(&self->pending);
|
||||
self->core_proxy = pw_context_connect (c, NULL, 0);
|
||||
if (self->core_proxy == NULL)
|
||||
self->core = pw_context_connect (c, NULL, 0);
|
||||
if (self->core == NULL)
|
||||
goto failed;
|
||||
|
||||
GST_DEBUG_OBJECT (self, "connected");
|
||||
pw_core_proxy_add_listener(self->core_proxy, &data->core_listener, &core_events, self);
|
||||
pw_core_add_listener(self->core, &data->core_listener, &core_events, self);
|
||||
|
||||
self->end = FALSE;
|
||||
self->list_only = TRUE;
|
||||
self->devices = NULL;
|
||||
|
||||
data->registry = pw_core_proxy_get_registry(self->core_proxy, PW_VERSION_REGISTRY_PROXY, 0);
|
||||
data->registry = pw_core_get_registry(self->core, PW_VERSION_REGISTRY_PROXY, 0);
|
||||
pw_registry_proxy_add_listener(data->registry, &data->registry_listener, ®istry_events, data);
|
||||
|
||||
pw_core_proxy_sync(self->core_proxy, 0, self->seq++);
|
||||
pw_core_sync(self->core, 0, self->seq++);
|
||||
|
||||
for (;;) {
|
||||
if (self->error < 0)
|
||||
|
@ -566,7 +566,7 @@ gst_pipewire_device_provider_probe (GstDeviceProvider * provider)
|
|||
}
|
||||
|
||||
GST_DEBUG_OBJECT (self, "disconnect");
|
||||
pw_core_proxy_disconnect (self->core_proxy);
|
||||
pw_core_disconnect (self->core);
|
||||
pw_context_destroy (c);
|
||||
pw_loop_destroy (l);
|
||||
|
||||
|
@ -606,7 +606,7 @@ gst_pipewire_device_provider_start (GstDeviceProvider * provider)
|
|||
|
||||
pw_thread_loop_lock (self->main_loop);
|
||||
|
||||
if ((self->core_proxy = pw_context_connect (self->context, NULL, 0)) == NULL) {
|
||||
if ((self->core = pw_context_connect (self->context, NULL, 0)) == NULL) {
|
||||
GST_ERROR_OBJECT (self, "Failed to connect");
|
||||
goto failed_connect;
|
||||
}
|
||||
|
@ -618,13 +618,13 @@ gst_pipewire_device_provider_start (GstDeviceProvider * provider)
|
|||
spa_list_init(&data->nodes);
|
||||
spa_list_init(&data->ports);
|
||||
|
||||
pw_core_proxy_add_listener(self->core_proxy, &data->core_listener, &core_events, self);
|
||||
pw_core_add_listener(self->core, &data->core_listener, &core_events, self);
|
||||
|
||||
self->registry = pw_core_proxy_get_registry(self->core_proxy, PW_VERSION_REGISTRY_PROXY, 0);
|
||||
self->registry = pw_core_get_registry(self->core, PW_VERSION_REGISTRY_PROXY, 0);
|
||||
data->registry = self->registry;
|
||||
pw_registry_proxy_add_listener(self->registry, &data->registry_listener, ®istry_events, data);
|
||||
|
||||
pw_core_proxy_sync(self->core_proxy, 0, self->seq++);
|
||||
pw_core_sync(self->core, 0, self->seq++);
|
||||
|
||||
for (;;) {
|
||||
if (self->error < 0)
|
||||
|
@ -661,9 +661,9 @@ gst_pipewire_device_provider_stop (GstDeviceProvider * provider)
|
|||
|
||||
GST_DEBUG_OBJECT (self, "stopping provider");
|
||||
|
||||
if (self->core_proxy) {
|
||||
pw_core_proxy_disconnect (self->core_proxy);
|
||||
self->core_proxy = NULL;
|
||||
if (self->core) {
|
||||
pw_core_disconnect (self->core);
|
||||
self->core = NULL;
|
||||
}
|
||||
if (self->context) {
|
||||
pw_context_destroy (self->context);
|
||||
|
|
|
@ -88,7 +88,7 @@ struct _GstPipeWireDeviceProvider {
|
|||
|
||||
struct pw_context *context;
|
||||
|
||||
struct pw_core_proxy *core_proxy;
|
||||
struct pw_core *core;
|
||||
struct spa_list pending;
|
||||
int seq;
|
||||
|
||||
|
|
|
@ -665,7 +665,7 @@ gst_pipewire_sink_start (GstBaseSink * basesink)
|
|||
}
|
||||
|
||||
pw_thread_loop_lock (pwsink->main_loop);
|
||||
pwsink->stream = pw_stream_new (pwsink->core_proxy, pwsink->client_name, props);
|
||||
pwsink->stream = pw_stream_new (pwsink->core, pwsink->client_name, props);
|
||||
pwsink->pool->stream = pwsink->stream;
|
||||
|
||||
pw_stream_add_listener(pwsink->stream,
|
||||
|
@ -706,11 +706,11 @@ gst_pipewire_sink_open (GstPipeWireSink * pwsink)
|
|||
pw_thread_loop_lock (pwsink->main_loop);
|
||||
|
||||
if (pwsink->fd == -1)
|
||||
pwsink->core_proxy = pw_context_connect (pwsink->context, NULL, 0);
|
||||
pwsink->core = pw_context_connect (pwsink->context, NULL, 0);
|
||||
else
|
||||
pwsink->core_proxy = pw_context_connect_fd (pwsink->context, dup(pwsink->fd), NULL, 0);
|
||||
pwsink->core = pw_context_connect_fd (pwsink->context, dup(pwsink->fd), NULL, 0);
|
||||
|
||||
if (pwsink->core_proxy == NULL)
|
||||
if (pwsink->core == NULL)
|
||||
goto connect_error;
|
||||
|
||||
pw_thread_loop_unlock (pwsink->main_loop);
|
||||
|
@ -740,9 +740,9 @@ gst_pipewire_sink_close (GstPipeWireSink * pwsink)
|
|||
if (pwsink->stream) {
|
||||
pw_stream_disconnect (pwsink->stream);
|
||||
}
|
||||
if (pwsink->core_proxy) {
|
||||
pw_core_proxy_disconnect (pwsink->core_proxy);
|
||||
pwsink->core_proxy = NULL;
|
||||
if (pwsink->core) {
|
||||
pw_core_disconnect (pwsink->core);
|
||||
pwsink->core = NULL;
|
||||
}
|
||||
pw_thread_loop_unlock (pwsink->main_loop);
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ struct _GstPipeWireSink {
|
|||
struct pw_thread_loop *main_loop;
|
||||
|
||||
struct pw_context *context;
|
||||
struct pw_core_proxy *core_proxy;
|
||||
struct pw_core *core;
|
||||
|
||||
struct pw_stream *stream;
|
||||
struct spa_hook stream_listener;
|
||||
|
|
|
@ -940,11 +940,11 @@ gst_pipewire_src_open (GstPipeWireSrc * pwsrc)
|
|||
pw_thread_loop_lock (pwsrc->main_loop);
|
||||
|
||||
if (pwsrc->fd == -1)
|
||||
pwsrc->core_proxy = pw_context_connect (pwsrc->context, NULL, 0);
|
||||
pwsrc->core = pw_context_connect (pwsrc->context, NULL, 0);
|
||||
else
|
||||
pwsrc->core_proxy = pw_context_connect_fd (pwsrc->context, dup(pwsrc->fd), NULL, 0);
|
||||
pwsrc->core = pw_context_connect_fd (pwsrc->context, dup(pwsrc->fd), NULL, 0);
|
||||
|
||||
if (pwsrc->core_proxy == NULL)
|
||||
if (pwsrc->core == NULL)
|
||||
goto connect_error;
|
||||
|
||||
if (pwsrc->properties) {
|
||||
|
@ -954,7 +954,7 @@ gst_pipewire_src_open (GstPipeWireSrc * pwsrc)
|
|||
props = NULL;
|
||||
}
|
||||
|
||||
if ((pwsrc->stream = pw_stream_new (pwsrc->core_proxy,
|
||||
if ((pwsrc->stream = pw_stream_new (pwsrc->core,
|
||||
pwsrc->client_name, props)) == NULL)
|
||||
goto no_stream;
|
||||
|
||||
|
@ -1010,8 +1010,8 @@ gst_pipewire_src_close (GstPipeWireSrc * pwsrc)
|
|||
pw_stream_destroy (pwsrc->stream);
|
||||
pwsrc->stream = NULL;
|
||||
|
||||
pw_core_proxy_disconnect (pwsrc->core_proxy);
|
||||
pwsrc->core_proxy = NULL;
|
||||
pw_core_disconnect (pwsrc->core);
|
||||
pwsrc->core = NULL;
|
||||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
|
|
|
@ -75,7 +75,7 @@ struct _GstPipeWireSrc {
|
|||
struct pw_thread_loop *main_loop;
|
||||
|
||||
struct pw_context *context;
|
||||
struct pw_core_proxy *core_proxy;
|
||||
struct pw_core *core;
|
||||
|
||||
struct pw_stream *stream;
|
||||
struct spa_hook stream_listener;
|
||||
|
|
|
@ -43,7 +43,7 @@ static const struct spa_dict_item module_props[] = {
|
|||
{ PW_KEY_MODULE_VERSION, PACKAGE_VERSION },
|
||||
};
|
||||
|
||||
struct pw_proxy *pw_core_proxy_spa_device_export(struct pw_core_proxy *core_proxy,
|
||||
struct pw_proxy *pw_core_spa_device_export(struct pw_core *core,
|
||||
uint32_t type, struct pw_properties *props, void *object,
|
||||
size_t user_data_size);
|
||||
|
||||
|
@ -188,7 +188,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
|
|||
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;
|
||||
data->export_spadevice.func = pw_core_spa_device_export;
|
||||
pw_context_register_export_type(context, &data->export_spadevice);
|
||||
|
||||
pw_module_add_listener(module, &data->module_listener, &module_events, data);
|
||||
|
|
|
@ -52,7 +52,7 @@ static const struct pw_proxy_events proxy_events = {
|
|||
.destroy = device_proxy_destroy,
|
||||
};
|
||||
|
||||
struct pw_proxy *pw_core_proxy_spa_device_export(struct pw_core_proxy *core_proxy,
|
||||
struct pw_proxy *pw_core_spa_device_export(struct pw_core *core,
|
||||
uint32_t type, struct pw_properties *props, void *object,
|
||||
size_t user_data_size)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ struct pw_proxy *pw_core_proxy_spa_device_export(struct pw_core_proxy *core_prox
|
|||
struct pw_proxy *proxy;
|
||||
struct device_data *data;
|
||||
|
||||
proxy = pw_core_proxy_create_object(core_proxy,
|
||||
proxy = pw_core_create_object(core,
|
||||
"client-device",
|
||||
SPA_TYPE_INTERFACE_Device,
|
||||
SPA_VERSION_DEVICE,
|
||||
|
|
|
@ -44,9 +44,9 @@ static const struct spa_dict_item module_props[] = {
|
|||
{ PW_KEY_MODULE_VERSION, PACKAGE_VERSION },
|
||||
};
|
||||
|
||||
struct pw_proxy *pw_core_proxy_node_export(struct pw_core_proxy *core_proxy,
|
||||
struct pw_proxy *pw_core_node_export(struct pw_core *core,
|
||||
uint32_t type, struct pw_properties *props, void *object, size_t user_data_size);
|
||||
struct pw_proxy *pw_core_proxy_spa_node_export(struct pw_core_proxy *core_proxy,
|
||||
struct pw_proxy *pw_core_spa_node_export(struct pw_core *core,
|
||||
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_context *context);
|
||||
|
@ -178,11 +178,11 @@ int pipewire__module_init(struct pw_module *module, const char *args)
|
|||
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;
|
||||
data->export_node.func = pw_core_node_export;
|
||||
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;
|
||||
data->export_spanode.func = pw_core_spa_node_export;
|
||||
pw_context_register_export_type(context, &data->export_spanode);
|
||||
|
||||
pw_module_add_listener(module, &data->module_listener, &module_events, data);
|
||||
|
|
|
@ -1107,7 +1107,7 @@ static const struct spa_node_callbacks node_callbacks = {
|
|||
.xrun = node_xrun
|
||||
};
|
||||
|
||||
static struct pw_proxy *node_export(struct pw_core_proxy *core_proxy, void *object, bool do_free,
|
||||
static struct pw_proxy *node_export(struct pw_core *core, void *object, bool do_free,
|
||||
size_t user_data_size)
|
||||
{
|
||||
struct pw_node *node = object;
|
||||
|
@ -1115,7 +1115,7 @@ static struct pw_proxy *node_export(struct pw_core_proxy *core_proxy, void *obje
|
|||
struct node_data *data;
|
||||
int i;
|
||||
|
||||
client_node = pw_core_proxy_create_object(core_proxy,
|
||||
client_node = pw_core_create_object(core,
|
||||
"client-node",
|
||||
PW_TYPE_INTERFACE_ClientNode,
|
||||
PW_VERSION_CLIENT_NODE,
|
||||
|
@ -1125,7 +1125,7 @@ static struct pw_proxy *node_export(struct pw_core_proxy *core_proxy, void *obje
|
|||
return NULL;
|
||||
|
||||
data = pw_proxy_get_user_data(client_node);
|
||||
data->pool = pw_core_proxy_get_mempool(core_proxy);
|
||||
data->pool = pw_core_get_mempool(core);
|
||||
data->node = node;
|
||||
data->do_free = do_free;
|
||||
data->context = pw_node_get_context(node);
|
||||
|
@ -1164,7 +1164,7 @@ static struct pw_proxy *node_export(struct pw_core_proxy *core_proxy, void *obje
|
|||
return data->proxy;
|
||||
}
|
||||
|
||||
struct pw_proxy *pw_core_proxy_node_export(struct pw_core_proxy *core_proxy,
|
||||
struct pw_proxy *pw_core_node_export(struct pw_core *core,
|
||||
uint32_t type, struct pw_properties *props, void *object,
|
||||
size_t user_data_size)
|
||||
{
|
||||
|
@ -1174,16 +1174,16 @@ struct pw_proxy *pw_core_proxy_node_export(struct pw_core_proxy *core_proxy,
|
|||
pw_node_update_properties(node, &props->dict);
|
||||
pw_properties_free(props);
|
||||
}
|
||||
return node_export(core_proxy, object, false, user_data_size);
|
||||
return node_export(core, object, false, user_data_size);
|
||||
}
|
||||
|
||||
struct pw_proxy *pw_core_proxy_spa_node_export(struct pw_core_proxy *core_proxy,
|
||||
struct pw_proxy *pw_core_spa_node_export(struct pw_core *core,
|
||||
uint32_t type, struct pw_properties *props, void *object,
|
||||
size_t user_data_size)
|
||||
{
|
||||
struct pw_node *node;
|
||||
|
||||
node = pw_node_new(pw_core_proxy_get_context(core_proxy), props, 0);
|
||||
node = pw_node_new(pw_core_get_context(core), props, 0);
|
||||
if (node == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -1191,5 +1191,5 @@ struct pw_proxy *pw_core_proxy_spa_node_export(struct pw_core_proxy *core_proxy,
|
|||
pw_node_register(node, NULL);
|
||||
pw_node_set_active(node, true);
|
||||
|
||||
return node_export(core_proxy, node, true, user_data_size);
|
||||
return node_export(core, node, true, user_data_size);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ static const struct spa_dict_item module_props[] = {
|
|||
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,
|
||||
struct pw_proxy *pw_core_metadata_export(struct pw_core *core,
|
||||
uint32_t type, struct pw_properties *props, void *object, size_t user_data_size);
|
||||
|
||||
int pw_protocol_native_ext_metadata_init(struct pw_context *context);
|
||||
|
@ -174,7 +174,7 @@ int pipewire__module_init(struct pw_module *module, const char *args)
|
|||
data);
|
||||
|
||||
data->export_metadata.type = PW_TYPE_INTERFACE_Metadata;
|
||||
data->export_metadata.func = pw_core_proxy_metadata_export;
|
||||
data->export_metadata.func = pw_core_metadata_export;
|
||||
pw_context_register_export_type(context, &data->export_metadata);
|
||||
|
||||
pw_module_add_listener(module, &data->module_listener, &module_events, data);
|
||||
|
|
|
@ -52,7 +52,7 @@ static const struct pw_proxy_events proxy_events = {
|
|||
.destroy = object_proxy_destroy,
|
||||
};
|
||||
|
||||
struct pw_proxy *pw_core_proxy_metadata_export(struct pw_core_proxy *core_proxy,
|
||||
struct pw_proxy *pw_core_metadata_export(struct pw_core *core,
|
||||
uint32_t type, struct pw_properties *props, void *object,
|
||||
size_t user_data_size)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ struct pw_proxy *pw_core_proxy_metadata_export(struct pw_core_proxy *core_proxy,
|
|||
struct pw_proxy *proxy;
|
||||
struct object_data *data;
|
||||
|
||||
proxy = pw_core_proxy_create_object(core_proxy,
|
||||
proxy = pw_core_create_object(core,
|
||||
"metadata",
|
||||
PW_TYPE_INTERFACE_Metadata,
|
||||
PW_VERSION_METADATA,
|
||||
|
|
|
@ -593,9 +593,9 @@ static void
|
|||
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_core *this = impl->this.core;
|
||||
struct pw_protocol_native_connection *conn = impl->connection;
|
||||
struct pw_context *context = pw_core_proxy_get_context(this);
|
||||
struct pw_context *context = pw_core_get_context(this);
|
||||
struct pw_loop *loop = pw_context_get_main_loop(context);
|
||||
int res;
|
||||
|
||||
|
@ -643,7 +643,7 @@ on_remote_data(void *data, int fd, uint32_t mask)
|
|||
spa_debug_pod(0, NULL, (struct spa_pod *)msg->data);
|
||||
}
|
||||
|
||||
proxy = pw_core_proxy_find_proxy(this, msg->id);
|
||||
proxy = pw_core_find_proxy(this, msg->id);
|
||||
if (proxy == NULL || proxy->zombie) {
|
||||
if (proxy == NULL)
|
||||
pw_log_error(NAME" %p: could not find proxy %u", this, msg->id);
|
||||
|
@ -683,7 +683,7 @@ on_remote_data(void *data, int fd, uint32_t mask)
|
|||
error:
|
||||
pw_log_error(NAME" %p: got connection error %d (%s)", impl, res, spa_strerror(res));
|
||||
pw_proxy_notify((struct pw_proxy*)this,
|
||||
struct pw_core_proxy_events, error, 0, 0,
|
||||
struct pw_core_events, error, 0, 0,
|
||||
this->recv_seq, res, "connection error");
|
||||
pw_loop_destroy_source(loop, impl->source);
|
||||
impl->source = NULL;
|
||||
|
@ -1006,28 +1006,28 @@ const static struct pw_protocol_implementaton protocol_impl = {
|
|||
static struct spa_pod_builder *
|
||||
impl_ext_begin_proxy(struct pw_proxy *proxy, uint8_t opcode, struct pw_protocol_native_message **msg)
|
||||
{
|
||||
struct client *impl = SPA_CONTAINER_OF(proxy->core_proxy->conn, struct client, this);
|
||||
struct client *impl = SPA_CONTAINER_OF(proxy->core->conn, struct client, this);
|
||||
return pw_protocol_native_connection_begin(impl->connection, proxy->id, opcode, msg);
|
||||
}
|
||||
|
||||
static uint32_t impl_ext_add_proxy_fd(struct pw_proxy *proxy, int fd)
|
||||
{
|
||||
struct client *impl = SPA_CONTAINER_OF(proxy->core_proxy->conn, struct client, this);
|
||||
struct client *impl = SPA_CONTAINER_OF(proxy->core->conn, struct client, this);
|
||||
return pw_protocol_native_connection_add_fd(impl->connection, fd);
|
||||
}
|
||||
|
||||
static int impl_ext_get_proxy_fd(struct pw_proxy *proxy, uint32_t index)
|
||||
{
|
||||
struct client *impl = SPA_CONTAINER_OF(proxy->core_proxy->conn, struct client, this);
|
||||
struct client *impl = SPA_CONTAINER_OF(proxy->core->conn, struct client, this);
|
||||
return pw_protocol_native_connection_get_fd(impl->connection, index);
|
||||
}
|
||||
|
||||
static int impl_ext_end_proxy(struct pw_proxy *proxy,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct pw_core_proxy *core_proxy = proxy->core_proxy;
|
||||
struct client *impl = SPA_CONTAINER_OF(core_proxy->conn, struct client, this);
|
||||
return core_proxy->send_seq = pw_protocol_native_connection_end(impl->connection, builder);
|
||||
struct pw_core *core = proxy->core;
|
||||
struct client *impl = SPA_CONTAINER_OF(core->conn, struct client, this);
|
||||
return core->send_seq = pw_protocol_native_connection_end(impl->connection, builder);
|
||||
}
|
||||
|
||||
static struct spa_pod_builder *
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
static int core_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_core_proxy_events *events,
|
||||
const struct pw_core_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
|
@ -49,7 +49,7 @@ static int core_method_marshal_hello(void *object, uint32_t version)
|
|||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_HELLO, NULL);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_METHOD_HELLO, NULL);
|
||||
|
||||
spa_pod_builder_add_struct(b,
|
||||
SPA_POD_Int(version));
|
||||
|
@ -63,7 +63,7 @@ static int core_method_marshal_sync(void *object, uint32_t id, int seq)
|
|||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_SYNC, &msg);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_METHOD_SYNC, &msg);
|
||||
|
||||
spa_pod_builder_add_struct(b,
|
||||
SPA_POD_Int(id),
|
||||
|
@ -77,7 +77,7 @@ static int core_method_marshal_pong(void *object, uint32_t id, int seq)
|
|||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_PONG, NULL);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_METHOD_PONG, NULL);
|
||||
|
||||
spa_pod_builder_add_struct(b,
|
||||
SPA_POD_Int(id),
|
||||
|
@ -91,7 +91,7 @@ static int core_method_marshal_error(void *object, uint32_t id, int seq, int res
|
|||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_ERROR, NULL);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_METHOD_ERROR, NULL);
|
||||
|
||||
spa_pod_builder_add_struct(b,
|
||||
SPA_POD_Int(id),
|
||||
|
@ -116,7 +116,7 @@ static struct pw_registry_proxy * core_method_marshal_get_registry(void *object,
|
|||
|
||||
new_id = pw_proxy_get_id(res);
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_GET_REGISTRY, NULL);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_METHOD_GET_REGISTRY, NULL);
|
||||
|
||||
spa_pod_builder_add_struct(b,
|
||||
SPA_POD_Int(version),
|
||||
|
@ -208,7 +208,7 @@ core_method_marshal_create_object(void *object,
|
|||
|
||||
new_id = pw_proxy_get_id(res);
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_CREATE_OBJECT, NULL);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_METHOD_CREATE_OBJECT, NULL);
|
||||
|
||||
spa_pod_builder_push_struct(b, &f);
|
||||
spa_pod_builder_add(b,
|
||||
|
@ -232,7 +232,7 @@ core_method_marshal_destroy(void *object, void *p)
|
|||
struct spa_pod_builder *b;
|
||||
uint32_t id = pw_proxy_get_id(p);
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_PROXY_METHOD_DESTROY, NULL);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CORE_METHOD_DESTROY, NULL);
|
||||
|
||||
spa_pod_builder_add_struct(b,
|
||||
SPA_POD_Int(id));
|
||||
|
@ -272,7 +272,7 @@ static int core_event_demarshal_info(void *object, const struct pw_protocol_nati
|
|||
if (parse_dict(&prs, &props) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_proxy_notify(proxy, struct pw_core_proxy_events, info, 0, &info);
|
||||
return pw_proxy_notify(proxy, struct pw_core_events, info, 0, &info);
|
||||
}
|
||||
|
||||
static int core_event_demarshal_done(void *object, const struct pw_protocol_native_message *msg)
|
||||
|
@ -287,7 +287,7 @@ static int core_event_demarshal_done(void *object, const struct pw_protocol_nati
|
|||
SPA_POD_Int(&seq)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_proxy_notify(proxy, struct pw_core_proxy_events, done, 0, id, seq);
|
||||
return pw_proxy_notify(proxy, struct pw_core_events, done, 0, id, seq);
|
||||
}
|
||||
|
||||
static int core_event_demarshal_ping(void *object, const struct pw_protocol_native_message *msg)
|
||||
|
@ -302,7 +302,7 @@ static int core_event_demarshal_ping(void *object, const struct pw_protocol_nati
|
|||
SPA_POD_Int(&seq)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_proxy_notify(proxy, struct pw_core_proxy_events, ping, 0, id, seq);
|
||||
return pw_proxy_notify(proxy, struct pw_core_events, ping, 0, id, seq);
|
||||
}
|
||||
|
||||
static int core_event_demarshal_error(void *object, const struct pw_protocol_native_message *msg)
|
||||
|
@ -321,7 +321,7 @@ static int core_event_demarshal_error(void *object, const struct pw_protocol_nat
|
|||
SPA_POD_String(&error)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_proxy_notify(proxy, struct pw_core_proxy_events, error, 0, id, seq, res, error);
|
||||
return pw_proxy_notify(proxy, struct pw_core_events, error, 0, id, seq, res, error);
|
||||
}
|
||||
|
||||
static int core_event_demarshal_remove_id(void *object, const struct pw_protocol_native_message *msg)
|
||||
|
@ -334,7 +334,7 @@ static int core_event_demarshal_remove_id(void *object, const struct pw_protocol
|
|||
if (spa_pod_parser_get_struct(&prs, SPA_POD_Int(&id)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_proxy_notify(proxy, struct pw_core_proxy_events, remove_id, 0, id);
|
||||
return pw_proxy_notify(proxy, struct pw_core_events, remove_id, 0, id);
|
||||
}
|
||||
|
||||
static int core_event_demarshal_bound_id(void *object, const struct pw_protocol_native_message *msg)
|
||||
|
@ -349,7 +349,7 @@ static int core_event_demarshal_bound_id(void *object, const struct pw_protocol_
|
|||
SPA_POD_Int(&global_id)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_proxy_notify(proxy, struct pw_core_proxy_events, bound_id, 0, id, global_id);
|
||||
return pw_proxy_notify(proxy, struct pw_core_events, bound_id, 0, id, global_id);
|
||||
}
|
||||
|
||||
static int core_event_demarshal_add_mem(void *object, const struct pw_protocol_native_message *msg)
|
||||
|
@ -370,7 +370,7 @@ static int core_event_demarshal_add_mem(void *object, const struct pw_protocol_n
|
|||
|
||||
fd = pw_protocol_native_get_proxy_fd(proxy, idx);
|
||||
|
||||
return pw_proxy_notify(proxy, struct pw_core_proxy_events, add_mem, 0, id, type, fd, flags);
|
||||
return pw_proxy_notify(proxy, struct pw_core_events, add_mem, 0, id, type, fd, flags);
|
||||
}
|
||||
|
||||
static int core_event_demarshal_remove_mem(void *object, const struct pw_protocol_native_message *msg)
|
||||
|
@ -384,7 +384,7 @@ static int core_event_demarshal_remove_mem(void *object, const struct pw_protoco
|
|||
SPA_POD_Int(&id)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_proxy_notify(proxy, struct pw_core_proxy_events, remove_mem, 0, id);
|
||||
return pw_proxy_notify(proxy, struct pw_core_events, remove_mem, 0, id);
|
||||
}
|
||||
|
||||
static void core_event_marshal_info(void *object, const struct pw_core_info *info)
|
||||
|
@ -393,7 +393,7 @@ static void core_event_marshal_info(void *object, const struct pw_core_info *inf
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_EVENT_INFO, NULL);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_INFO, NULL);
|
||||
|
||||
spa_pod_builder_push_struct(b, &f);
|
||||
spa_pod_builder_add(b,
|
||||
|
@ -416,7 +416,7 @@ static void core_event_marshal_done(void *object, uint32_t id, int seq)
|
|||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_EVENT_DONE, NULL);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_DONE, NULL);
|
||||
|
||||
spa_pod_builder_add_struct(b,
|
||||
SPA_POD_Int(id),
|
||||
|
@ -431,7 +431,7 @@ static void core_event_marshal_ping(void *object, uint32_t id, int seq)
|
|||
struct spa_pod_builder *b;
|
||||
struct pw_protocol_native_message *msg;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_EVENT_PING, &msg);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_PING, &msg);
|
||||
|
||||
spa_pod_builder_add_struct(b,
|
||||
SPA_POD_Int(id),
|
||||
|
@ -445,7 +445,7 @@ static void core_event_marshal_error(void *object, uint32_t id, int seq, int res
|
|||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_EVENT_ERROR, NULL);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_ERROR, NULL);
|
||||
|
||||
spa_pod_builder_add_struct(b,
|
||||
SPA_POD_Int(id),
|
||||
|
@ -461,7 +461,7 @@ static void core_event_marshal_remove_id(void *object, uint32_t id)
|
|||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_EVENT_REMOVE_ID, NULL);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_REMOVE_ID, NULL);
|
||||
|
||||
spa_pod_builder_add_struct(b,
|
||||
SPA_POD_Int(id));
|
||||
|
@ -474,7 +474,7 @@ static void core_event_marshal_bound_id(void *object, uint32_t id, uint32_t glob
|
|||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_EVENT_BOUND_ID, NULL);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_BOUND_ID, NULL);
|
||||
|
||||
spa_pod_builder_add_struct(b,
|
||||
SPA_POD_Int(id),
|
||||
|
@ -488,7 +488,7 @@ static void core_event_marshal_add_mem(void *object, uint32_t id, uint32_t type,
|
|||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_EVENT_ADD_MEM, NULL);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_ADD_MEM, NULL);
|
||||
|
||||
spa_pod_builder_add_struct(b,
|
||||
SPA_POD_Int(id),
|
||||
|
@ -504,7 +504,7 @@ static void core_event_marshal_remove_mem(void *object, uint32_t id)
|
|||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_EVENT_REMOVE_MEM, NULL);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_REMOVE_MEM, NULL);
|
||||
|
||||
spa_pod_builder_add_struct(b,
|
||||
SPA_POD_Int(id));
|
||||
|
@ -523,7 +523,7 @@ static int core_method_demarshal_hello(void *object, const struct pw_protocol_na
|
|||
SPA_POD_Int(&version)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_resource_notify(resource, struct pw_core_proxy_methods, hello, 0, version);
|
||||
return pw_resource_notify(resource, struct pw_core_methods, hello, 0, version);
|
||||
}
|
||||
|
||||
static int core_method_demarshal_sync(void *object, const struct pw_protocol_native_message *msg)
|
||||
|
@ -538,7 +538,7 @@ static int core_method_demarshal_sync(void *object, const struct pw_protocol_nat
|
|||
SPA_POD_Int(&seq)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_resource_notify(resource, struct pw_core_proxy_methods, sync, 0, id, seq);
|
||||
return pw_resource_notify(resource, struct pw_core_methods, sync, 0, id, seq);
|
||||
}
|
||||
|
||||
static int core_method_demarshal_pong(void *object, const struct pw_protocol_native_message *msg)
|
||||
|
@ -553,7 +553,7 @@ static int core_method_demarshal_pong(void *object, const struct pw_protocol_nat
|
|||
SPA_POD_Int(&seq)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_resource_notify(resource, struct pw_core_proxy_methods, pong, 0, id, seq);
|
||||
return pw_resource_notify(resource, struct pw_core_methods, pong, 0, id, seq);
|
||||
}
|
||||
|
||||
static int core_method_demarshal_error(void *object, const struct pw_protocol_native_message *msg)
|
||||
|
@ -572,7 +572,7 @@ static int core_method_demarshal_error(void *object, const struct pw_protocol_na
|
|||
SPA_POD_String(&error)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_resource_notify(resource, struct pw_core_proxy_methods, error, 0, id, seq, res, error);
|
||||
return pw_resource_notify(resource, struct pw_core_methods, error, 0, id, seq, res, error);
|
||||
}
|
||||
|
||||
static int core_method_demarshal_get_registry(void *object, const struct pw_protocol_native_message *msg)
|
||||
|
@ -587,7 +587,7 @@ static int core_method_demarshal_get_registry(void *object, const struct pw_prot
|
|||
SPA_POD_Int(&new_id)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_resource_notify(resource, struct pw_core_proxy_methods, get_registry, 0, version, new_id);
|
||||
return pw_resource_notify(resource, struct pw_core_methods, get_registry, 0, version, new_id);
|
||||
}
|
||||
|
||||
static int core_method_demarshal_create_object(void *object, const struct pw_protocol_native_message *msg)
|
||||
|
@ -622,7 +622,7 @@ static int core_method_demarshal_create_object(void *object, const struct pw_pro
|
|||
SPA_POD_Int(&new_id), NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_resource_notify(resource, struct pw_core_proxy_methods, create_object, 0, factory_name,
|
||||
return pw_resource_notify(resource, struct pw_core_methods, create_object, 0, factory_name,
|
||||
type, version,
|
||||
&props, new_id);
|
||||
}
|
||||
|
@ -645,7 +645,7 @@ static int core_method_demarshal_destroy(void *object, const struct pw_protocol_
|
|||
if ((r = pw_client_find_resource(client, id)) == NULL)
|
||||
goto no_resource;
|
||||
|
||||
return pw_resource_notify(resource, struct pw_core_proxy_methods, destroy, 0, r);
|
||||
return pw_resource_notify(resource, struct pw_core_methods, destroy, 0, r);
|
||||
|
||||
no_resource:
|
||||
pw_log_error("client %p: unknown resouce %u op:%u", client, id, msg->opcode);
|
||||
|
@ -1893,8 +1893,8 @@ static int registry_marshal_destroy(void *object, uint32_t id)
|
|||
return pw_protocol_native_end_proxy(proxy, b);
|
||||
}
|
||||
|
||||
static const struct pw_core_proxy_methods pw_protocol_native_core_method_marshal = {
|
||||
PW_VERSION_CORE_PROXY_METHODS,
|
||||
static const struct pw_core_methods pw_protocol_native_core_method_marshal = {
|
||||
PW_VERSION_CORE_METHODS,
|
||||
.add_listener = &core_method_marshal_add_listener,
|
||||
.hello = &core_method_marshal_hello,
|
||||
.sync = &core_method_marshal_sync,
|
||||
|
@ -1905,19 +1905,19 @@ static const struct pw_core_proxy_methods pw_protocol_native_core_method_marshal
|
|||
.destroy = &core_method_marshal_destroy,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_core_method_demarshal[PW_CORE_PROXY_METHOD_NUM] = {
|
||||
[PW_CORE_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
[PW_CORE_PROXY_METHOD_HELLO] = { &core_method_demarshal_hello, 0, },
|
||||
[PW_CORE_PROXY_METHOD_SYNC] = { &core_method_demarshal_sync, 0, },
|
||||
[PW_CORE_PROXY_METHOD_PONG] = { &core_method_demarshal_pong, 0, },
|
||||
[PW_CORE_PROXY_METHOD_ERROR] = { &core_method_demarshal_error, 0, },
|
||||
[PW_CORE_PROXY_METHOD_GET_REGISTRY] = { &core_method_demarshal_get_registry, 0, },
|
||||
[PW_CORE_PROXY_METHOD_CREATE_OBJECT] = { &core_method_demarshal_create_object, 0, },
|
||||
[PW_CORE_PROXY_METHOD_DESTROY] = { &core_method_demarshal_destroy, 0, }
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_core_method_demarshal[PW_CORE_METHOD_NUM] = {
|
||||
[PW_CORE_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
[PW_CORE_METHOD_HELLO] = { &core_method_demarshal_hello, 0, },
|
||||
[PW_CORE_METHOD_SYNC] = { &core_method_demarshal_sync, 0, },
|
||||
[PW_CORE_METHOD_PONG] = { &core_method_demarshal_pong, 0, },
|
||||
[PW_CORE_METHOD_ERROR] = { &core_method_demarshal_error, 0, },
|
||||
[PW_CORE_METHOD_GET_REGISTRY] = { &core_method_demarshal_get_registry, 0, },
|
||||
[PW_CORE_METHOD_CREATE_OBJECT] = { &core_method_demarshal_create_object, 0, },
|
||||
[PW_CORE_METHOD_DESTROY] = { &core_method_demarshal_destroy, 0, }
|
||||
};
|
||||
|
||||
static const struct pw_core_proxy_events pw_protocol_native_core_event_marshal = {
|
||||
PW_VERSION_CORE_PROXY_EVENTS,
|
||||
static const struct pw_core_events pw_protocol_native_core_event_marshal = {
|
||||
PW_VERSION_CORE_EVENTS,
|
||||
.info = &core_event_marshal_info,
|
||||
.done = &core_event_marshal_done,
|
||||
.ping = &core_event_marshal_ping,
|
||||
|
@ -1929,24 +1929,24 @@ static const struct pw_core_proxy_events pw_protocol_native_core_event_marshal =
|
|||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_core_event_demarshal[PW_CORE_PROXY_EVENT_NUM] =
|
||||
pw_protocol_native_core_event_demarshal[PW_CORE_EVENT_NUM] =
|
||||
{
|
||||
[PW_CORE_PROXY_EVENT_INFO] = { &core_event_demarshal_info, 0, },
|
||||
[PW_CORE_PROXY_EVENT_DONE] = { &core_event_demarshal_done, 0, },
|
||||
[PW_CORE_PROXY_EVENT_PING] = { &core_event_demarshal_ping, 0, },
|
||||
[PW_CORE_PROXY_EVENT_ERROR] = { &core_event_demarshal_error, 0, },
|
||||
[PW_CORE_PROXY_EVENT_REMOVE_ID] = { &core_event_demarshal_remove_id, 0, },
|
||||
[PW_CORE_PROXY_EVENT_BOUND_ID] = { &core_event_demarshal_bound_id, 0, },
|
||||
[PW_CORE_PROXY_EVENT_ADD_MEM] = { &core_event_demarshal_add_mem, 0, },
|
||||
[PW_CORE_PROXY_EVENT_REMOVE_MEM] = { &core_event_demarshal_remove_mem, 0, },
|
||||
[PW_CORE_EVENT_INFO] = { &core_event_demarshal_info, 0, },
|
||||
[PW_CORE_EVENT_DONE] = { &core_event_demarshal_done, 0, },
|
||||
[PW_CORE_EVENT_PING] = { &core_event_demarshal_ping, 0, },
|
||||
[PW_CORE_EVENT_ERROR] = { &core_event_demarshal_error, 0, },
|
||||
[PW_CORE_EVENT_REMOVE_ID] = { &core_event_demarshal_remove_id, 0, },
|
||||
[PW_CORE_EVENT_BOUND_ID] = { &core_event_demarshal_bound_id, 0, },
|
||||
[PW_CORE_EVENT_ADD_MEM] = { &core_event_demarshal_add_mem, 0, },
|
||||
[PW_CORE_EVENT_REMOVE_MEM] = { &core_event_demarshal_remove_mem, 0, },
|
||||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_core_marshal = {
|
||||
PW_TYPE_INTERFACE_Core,
|
||||
PW_VERSION_CORE_PROXY,
|
||||
PW_VERSION_CORE,
|
||||
0,
|
||||
PW_CORE_PROXY_METHOD_NUM,
|
||||
PW_CORE_PROXY_EVENT_NUM,
|
||||
PW_CORE_METHOD_NUM,
|
||||
PW_CORE_EVENT_NUM,
|
||||
.client_marshal = &pw_protocol_native_core_method_marshal,
|
||||
.server_demarshal = pw_protocol_native_core_method_demarshal,
|
||||
.server_marshal = &pw_protocol_native_core_event_marshal,
|
||||
|
|
|
@ -35,36 +35,36 @@ extern "C" {
|
|||
|
||||
#define PW_VERSION_CORE_V0 0
|
||||
|
||||
#define PW_CORE_PROXY_V0_METHOD_HELLO 0
|
||||
#define PW_CORE_PROXY_V0_METHOD_UPDATE_TYPES 1
|
||||
#define PW_CORE_PROXY_V0_METHOD_SYNC 2
|
||||
#define PW_CORE_PROXY_V0_METHOD_GET_REGISTRY 3
|
||||
#define PW_CORE_PROXY_V0_METHOD_CLIENT_UPDATE 4
|
||||
#define PW_CORE_PROXY_V0_METHOD_PERMISSIONS 5
|
||||
#define PW_CORE_PROXY_V0_METHOD_CREATE_OBJECT 6
|
||||
#define PW_CORE_PROXY_V0_METHOD_DESTROY 7
|
||||
#define PW_CORE_PROXY_V0_METHOD_NUM 8
|
||||
#define PW_CORE_V0_METHOD_HELLO 0
|
||||
#define PW_CORE_V0_METHOD_UPDATE_TYPES 1
|
||||
#define PW_CORE_V0_METHOD_SYNC 2
|
||||
#define PW_CORE_V0_METHOD_GET_REGISTRY 3
|
||||
#define PW_CORE_V0_METHOD_CLIENT_UPDATE 4
|
||||
#define PW_CORE_V0_METHOD_PERMISSIONS 5
|
||||
#define PW_CORE_V0_METHOD_CREATE_OBJECT 6
|
||||
#define PW_CORE_V0_METHOD_DESTROY 7
|
||||
#define PW_CORE_V0_METHOD_NUM 8
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* Key to update default permissions of globals without specific
|
||||
* permissions. value is "[r][w][x]" */
|
||||
#define PW_CORE_PROXY_PERMISSIONS_DEFAULT "permissions.default"
|
||||
#define PW_CORE_PERMISSIONS_DEFAULT "permissions.default"
|
||||
|
||||
/**
|
||||
* Key to update specific permissions of a global. If the global
|
||||
* did not have specific permissions, it will first be assigned
|
||||
* the default permissions before it is updated.
|
||||
* Value is "<global-id>:[r][w][x]"*/
|
||||
#define PW_CORE_PROXY_PERMISSIONS_GLOBAL "permissions.global"
|
||||
#define PW_CORE_PERMISSIONS_GLOBAL "permissions.global"
|
||||
|
||||
/**
|
||||
* Key to update specific permissions of all existing globals.
|
||||
* This is equivalent to using \ref PW_CORE_PROXY_PERMISSIONS_GLOBAL
|
||||
* This is equivalent to using \ref PW_CORE_PERMISSIONS_GLOBAL
|
||||
* on each global id individually that did not have specific
|
||||
* permissions.
|
||||
* Value is "[r][w][x]" */
|
||||
#define PW_CORE_PROXY_PERMISSIONS_EXISTING "permissions.existing"
|
||||
#define PW_CORE_PERMISSIONS_EXISTING "permissions.existing"
|
||||
|
||||
#define PW_LINK_OUTPUT_NODE_ID "link.output_node.id"
|
||||
#define PW_LINK_OUTPUT_PORT_ID "link.output_port.id"
|
||||
|
@ -73,15 +73,15 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/**
|
||||
* \struct pw_core_proxy_v0_methods
|
||||
* \struct pw_core_v0_methods
|
||||
* \brief Core methods
|
||||
*
|
||||
* The core global object. This is a singleton object used for
|
||||
* creating new objects in the remote PipeWire intance. It is
|
||||
* also used for internal features.
|
||||
*/
|
||||
struct pw_core_proxy_v0_methods {
|
||||
#define PW_VERSION_CORE_PROXY_V0_METHODS 0
|
||||
struct pw_core_v0_methods {
|
||||
#define PW_VERSION_CORE_V0_METHODS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Start a conversation with the server. This will send
|
||||
|
@ -167,19 +167,19 @@ struct pw_core_proxy_v0_methods {
|
|||
void (*destroy) (void *object, uint32_t id);
|
||||
};
|
||||
|
||||
#define PW_CORE_PROXY_V0_EVENT_UPDATE_TYPES 0
|
||||
#define PW_CORE_PROXY_V0_EVENT_DONE 1
|
||||
#define PW_CORE_PROXY_V0_EVENT_ERROR 2
|
||||
#define PW_CORE_PROXY_V0_EVENT_REMOVE_ID 3
|
||||
#define PW_CORE_PROXY_V0_EVENT_INFO 4
|
||||
#define PW_CORE_PROXY_V0_EVENT_NUM 5
|
||||
#define PW_CORE_V0_EVENT_UPDATE_TYPES 0
|
||||
#define PW_CORE_V0_EVENT_DONE 1
|
||||
#define PW_CORE_V0_EVENT_ERROR 2
|
||||
#define PW_CORE_V0_EVENT_REMOVE_ID 3
|
||||
#define PW_CORE_V0_EVENT_INFO 4
|
||||
#define PW_CORE_V0_EVENT_NUM 5
|
||||
|
||||
/** \struct pw_core_proxy_v0_events
|
||||
/** \struct pw_core_v0_events
|
||||
* \brief Core events
|
||||
* \ingroup pw_core_interface The pw_core interface
|
||||
*/
|
||||
struct pw_core_proxy_v0_events {
|
||||
#define PW_VERSION_CORE_PROXY_V0_EVENTS 0
|
||||
struct pw_core_v0_events {
|
||||
#define PW_VERSION_CORE_V0_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Update the type map
|
||||
|
@ -234,11 +234,11 @@ struct pw_core_proxy_v0_events {
|
|||
void (*info) (void *object, struct pw_core_info *info);
|
||||
};
|
||||
|
||||
#define pw_core_resource_v0_update_types(r,...) pw_resource_notify(r,struct pw_core_proxy_v0_events,update_types,__VA_ARGS__)
|
||||
#define pw_core_resource_v0_done(r,...) pw_resource_notify(r,struct pw_core_proxy_v0_events,done,__VA_ARGS__)
|
||||
#define pw_core_resource_v0_error(r,...) pw_resource_notify(r,struct pw_core_proxy_v0_events,error,__VA_ARGS__)
|
||||
#define pw_core_resource_v0_remove_id(r,...) pw_resource_notify(r,struct pw_core_proxy_v0_events,remove_id,__VA_ARGS__)
|
||||
#define pw_core_resource_v0_info(r,...) pw_resource_notify(r,struct pw_core_proxy_v0_events,info,__VA_ARGS__)
|
||||
#define pw_core_resource_v0_update_types(r,...) pw_resource_notify(r,struct pw_core_v0_events,update_types,__VA_ARGS__)
|
||||
#define pw_core_resource_v0_done(r,...) pw_resource_notify(r,struct pw_core_v0_events,done,__VA_ARGS__)
|
||||
#define pw_core_resource_v0_error(r,...) pw_resource_notify(r,struct pw_core_v0_events,error,__VA_ARGS__)
|
||||
#define pw_core_resource_v0_remove_id(r,...) pw_resource_notify(r,struct pw_core_v0_events,remove_id,__VA_ARGS__)
|
||||
#define pw_core_resource_v0_info(r,...) pw_resource_notify(r,struct pw_core_v0_events,info,__VA_ARGS__)
|
||||
|
||||
|
||||
#define PW_VERSION_REGISTRY_V0 0
|
||||
|
|
|
@ -54,7 +54,7 @@ update_types_server(struct pw_resource *resource)
|
|||
struct spa_pod_frame f;
|
||||
uint32_t i;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_V0_EVENT_UPDATE_TYPES, NULL);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_V0_EVENT_UPDATE_TYPES, NULL);
|
||||
|
||||
spa_pod_builder_push_struct(b, &f);
|
||||
spa_pod_builder_add(b,
|
||||
|
@ -78,11 +78,11 @@ static void core_marshal_info(void *object, const struct pw_core_info *info)
|
|||
struct spa_pod_frame f;
|
||||
struct pw_protocol_native_message *msg;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_V0_EVENT_INFO, &msg);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_V0_EVENT_INFO, &msg);
|
||||
|
||||
if (msg->seq == 0) {
|
||||
update_types_server(resource);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_V0_EVENT_INFO, &msg);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_V0_EVENT_INFO, &msg);
|
||||
}
|
||||
|
||||
n_items = info->props ? info->props->n_items : 0;
|
||||
|
@ -113,7 +113,7 @@ static void core_marshal_done(void *object, uint32_t id, int seq)
|
|||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_V0_EVENT_DONE, NULL);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_V0_EVENT_DONE, NULL);
|
||||
|
||||
spa_pod_builder_add_struct(b, "i", seq);
|
||||
|
||||
|
@ -125,7 +125,7 @@ static void core_marshal_error(void *object, uint32_t id, int seq, int res, cons
|
|||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_V0_EVENT_ERROR, NULL);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_V0_EVENT_ERROR, NULL);
|
||||
|
||||
spa_pod_builder_add_struct(b,
|
||||
"i", id,
|
||||
|
@ -140,7 +140,7 @@ static void core_marshal_remove_id(void *object, uint32_t id)
|
|||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_PROXY_V0_EVENT_REMOVE_ID, NULL);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_V0_EVENT_REMOVE_ID, NULL);
|
||||
|
||||
spa_pod_builder_add_struct(b, "i", id);
|
||||
|
||||
|
@ -211,7 +211,7 @@ static int core_demarshal_hello(void *object, const struct pw_protocol_native_me
|
|||
"P", &ptr) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_resource_notify(resource, struct pw_core_proxy_methods, hello, 0, 2);
|
||||
return pw_resource_notify(resource, struct pw_core_methods, hello, 0, 2);
|
||||
}
|
||||
|
||||
static int core_demarshal_sync(void *object, const struct pw_protocol_native_message *msg)
|
||||
|
@ -224,7 +224,7 @@ static int core_demarshal_sync(void *object, const struct pw_protocol_native_mes
|
|||
if (spa_pod_parser_get_struct(&prs, "i", &seq) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_resource_notify(resource, struct pw_core_proxy_methods, sync, 0, 0, seq);
|
||||
return pw_resource_notify(resource, struct pw_core_methods, sync, 0, 0, seq);
|
||||
}
|
||||
|
||||
static int core_demarshal_get_registry(void *object, const struct pw_protocol_native_message *msg)
|
||||
|
@ -239,7 +239,7 @@ static int core_demarshal_get_registry(void *object, const struct pw_protocol_na
|
|||
"i", &new_id) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_resource_notify(resource, struct pw_core_proxy_methods, get_registry, 0, version, new_id);
|
||||
return pw_resource_notify(resource, struct pw_core_methods, get_registry, 0, version, new_id);
|
||||
}
|
||||
|
||||
SPA_EXPORT
|
||||
|
@ -622,7 +622,7 @@ static int core_demarshal_create_object(void *object, const struct pw_protocol_n
|
|||
|
||||
type = pw_protocol_native0_type_from_v2(client, type);
|
||||
|
||||
return pw_resource_notify(resource, struct pw_core_proxy_methods, create_object, 0, factory_name,
|
||||
return pw_resource_notify(resource, struct pw_core_methods, create_object, 0, factory_name,
|
||||
type, version,
|
||||
&props, new_id);
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ static int core_demarshal_destroy(void *object, const struct pw_protocol_native_
|
|||
if ((r = pw_client_find_resource(client, id)) == NULL)
|
||||
goto no_resource;
|
||||
|
||||
return pw_resource_notify(resource, struct pw_core_proxy_methods, destroy, 0, r);
|
||||
return pw_resource_notify(resource, struct pw_core_methods, destroy, 0, r);
|
||||
|
||||
no_resource:
|
||||
pw_log_error("client %p: unknown resouce %u op:%u", client, id, msg->opcode);
|
||||
|
@ -1018,19 +1018,19 @@ static void link_marshal_info(void *object, const struct pw_link_info *info)
|
|||
pw_protocol_native_end_resource(resource, b);
|
||||
}
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_core_method_demarshal[PW_CORE_PROXY_V0_METHOD_NUM] = {
|
||||
[PW_CORE_PROXY_V0_METHOD_HELLO] = { &core_demarshal_hello, 0, },
|
||||
[PW_CORE_PROXY_V0_METHOD_UPDATE_TYPES] = { &core_demarshal_update_types_server, 0, },
|
||||
[PW_CORE_PROXY_V0_METHOD_SYNC] = { &core_demarshal_sync, 0, },
|
||||
[PW_CORE_PROXY_V0_METHOD_GET_REGISTRY] = { &core_demarshal_get_registry, 0, },
|
||||
[PW_CORE_PROXY_V0_METHOD_CLIENT_UPDATE] = { &core_demarshal_client_update, 0, },
|
||||
[PW_CORE_PROXY_V0_METHOD_PERMISSIONS] = { &core_demarshal_permissions, 0, },
|
||||
[PW_CORE_PROXY_V0_METHOD_CREATE_OBJECT] = { &core_demarshal_create_object, 0, PW_PROTOCOL_NATIVE_FLAG_REMAP, },
|
||||
[PW_CORE_PROXY_V0_METHOD_DESTROY] = { &core_demarshal_destroy, 0, }
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_core_method_demarshal[PW_CORE_V0_METHOD_NUM] = {
|
||||
[PW_CORE_V0_METHOD_HELLO] = { &core_demarshal_hello, 0, },
|
||||
[PW_CORE_V0_METHOD_UPDATE_TYPES] = { &core_demarshal_update_types_server, 0, },
|
||||
[PW_CORE_V0_METHOD_SYNC] = { &core_demarshal_sync, 0, },
|
||||
[PW_CORE_V0_METHOD_GET_REGISTRY] = { &core_demarshal_get_registry, 0, },
|
||||
[PW_CORE_V0_METHOD_CLIENT_UPDATE] = { &core_demarshal_client_update, 0, },
|
||||
[PW_CORE_V0_METHOD_PERMISSIONS] = { &core_demarshal_permissions, 0, },
|
||||
[PW_CORE_V0_METHOD_CREATE_OBJECT] = { &core_demarshal_create_object, 0, PW_PROTOCOL_NATIVE_FLAG_REMAP, },
|
||||
[PW_CORE_V0_METHOD_DESTROY] = { &core_demarshal_destroy, 0, }
|
||||
};
|
||||
|
||||
static const struct pw_core_proxy_events pw_protocol_native_core_event_marshal = {
|
||||
PW_VERSION_CORE_PROXY_EVENTS,
|
||||
static const struct pw_core_events pw_protocol_native_core_event_marshal = {
|
||||
PW_VERSION_CORE_EVENTS,
|
||||
.info = &core_marshal_info,
|
||||
.done = &core_marshal_done,
|
||||
.error = &core_marshal_error,
|
||||
|
@ -1040,8 +1040,8 @@ static const struct pw_core_proxy_events pw_protocol_native_core_event_marshal =
|
|||
static const struct pw_protocol_marshal pw_protocol_native_core_marshal = {
|
||||
PW_TYPE_INTERFACE_Core,
|
||||
PW_VERSION_CORE_V0,
|
||||
PW_CORE_PROXY_V0_METHOD_NUM,
|
||||
PW_CORE_PROXY_EVENT_NUM,
|
||||
PW_CORE_V0_METHOD_NUM,
|
||||
PW_CORE_EVENT_NUM,
|
||||
0,
|
||||
NULL,
|
||||
pw_protocol_native_core_method_demarshal,
|
||||
|
|
|
@ -377,8 +377,8 @@ static int core_destroy(void *object, void *proxy)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct pw_core_proxy_methods core_methods = {
|
||||
PW_VERSION_CORE_PROXY_METHODS,
|
||||
static const struct pw_core_methods core_methods = {
|
||||
PW_VERSION_CORE_METHODS,
|
||||
.hello = core_hello,
|
||||
.sync = core_sync,
|
||||
.pong = core_pong,
|
||||
|
@ -570,7 +570,7 @@ struct pw_context *pw_context_new(struct pw_loop *main_loop,
|
|||
pw_map_init(&this->globals, 128, 32);
|
||||
|
||||
spa_list_init(&this->protocol_list);
|
||||
spa_list_init(&this->core_proxy_list);
|
||||
spa_list_init(&this->core_list);
|
||||
spa_list_init(&this->registry_resource_list);
|
||||
spa_list_init(&this->global_list);
|
||||
spa_list_init(&this->module_list);
|
||||
|
@ -607,7 +607,7 @@ struct pw_context *pw_context_new(struct pw_loop *main_loop,
|
|||
|
||||
this->global = pw_global_new(this,
|
||||
PW_TYPE_INTERFACE_Core,
|
||||
PW_VERSION_CORE_PROXY,
|
||||
PW_VERSION_CORE,
|
||||
pw_properties_new(
|
||||
PW_KEY_USER_NAME, this->info.user_name,
|
||||
PW_KEY_HOST_NAME, this->info.host_name,
|
||||
|
@ -660,7 +660,7 @@ void pw_context_destroy(struct pw_context *context)
|
|||
struct pw_global *global;
|
||||
struct pw_module *module;
|
||||
struct pw_device *device;
|
||||
struct pw_core_proxy *core_proxy;
|
||||
struct pw_core *core;
|
||||
struct pw_resource *resource;
|
||||
struct pw_node *node;
|
||||
struct factory_entry *entry;
|
||||
|
@ -670,8 +670,8 @@ void pw_context_destroy(struct pw_context *context)
|
|||
|
||||
spa_hook_remove(&context->global_listener);
|
||||
|
||||
spa_list_consume(core_proxy, &context->core_proxy_list, link)
|
||||
pw_core_proxy_disconnect(core_proxy);
|
||||
spa_list_consume(core, &context->core_list, link)
|
||||
pw_core_disconnect(core);
|
||||
|
||||
spa_list_consume(module, &context->module_list, link)
|
||||
pw_module_destroy(module);
|
||||
|
|
|
@ -45,7 +45,7 @@ struct pw_context;
|
|||
#include <pipewire/client.h>
|
||||
#include <pipewire/introspect.h>
|
||||
#include <pipewire/interfaces.h>
|
||||
#include <pipewire/core-proxy.h>
|
||||
#include <pipewire/core.h>
|
||||
#include <pipewire/global.h>
|
||||
#include <pipewire/loop.h>
|
||||
#include <pipewire/factory.h>
|
||||
|
@ -164,7 +164,7 @@ struct spa_handle *pw_context_load_spa_handle(struct pw_context *context,
|
|||
struct pw_export_type {
|
||||
struct spa_list link;
|
||||
uint32_t type;
|
||||
struct pw_proxy * (*func) (struct pw_core_proxy *core_proxy,
|
||||
struct pw_proxy * (*func) (struct pw_core *core,
|
||||
uint32_t type, struct pw_properties *properties, void *object,
|
||||
size_t user_data_size);
|
||||
};
|
||||
|
|
|
@ -1,109 +0,0 @@
|
|||
/* PipeWire
|
||||
*
|
||||
* Copyright © 2018 Wim Taymans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef PIPEWIRE_REMOTE_H
|
||||
#define PIPEWIRE_REMOTE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <spa/utils/hook.h>
|
||||
|
||||
#include <pipewire/context.h>
|
||||
#include <pipewire/properties.h>
|
||||
#include <pipewire/node.h>
|
||||
#include <pipewire/proxy.h>
|
||||
|
||||
/** Connect to a PipeWire instance \memberof pw_core_proxy
|
||||
* \return a pw_core_proxy on success or NULL with errno set on error */
|
||||
struct pw_core_proxy *
|
||||
pw_context_connect(struct pw_context *context, /**< a \ref pw_context */
|
||||
struct pw_properties *properties, /**< optional properties, ownership of
|
||||
* the properties is taken.*/
|
||||
size_t user_data_size /**< extra user data size */);
|
||||
|
||||
/** Connect to a PipeWire instance on the given socket \memberof pw_core_proxy
|
||||
* \param fd the connected socket to use, the socket will be closed
|
||||
* automatically on disconnect or error.
|
||||
* \return a pw_core_proxy on success or NULL with errno set on error */
|
||||
struct pw_core_proxy *
|
||||
pw_context_connect_fd(struct pw_context *context, /**< a \ref pw_context */
|
||||
int fd, /**< an fd */
|
||||
struct pw_properties *properties, /**< optional properties, ownership of
|
||||
* the properties is taken.*/
|
||||
size_t user_data_size /**< extra user data size */);
|
||||
|
||||
/** Connect to a given PipeWire instance \memberof pw_core_proxy
|
||||
* \return a pw_core_proxy on success or NULL with errno set on error */
|
||||
struct pw_core_proxy *
|
||||
pw_context_connect_self(struct pw_context *context, /**< a \ref pw_context to connect to */
|
||||
struct pw_properties *properties, /**< optional properties, ownership of
|
||||
* the properties is taken.*/
|
||||
size_t user_data_size /**< extra user data size */);
|
||||
|
||||
/** Steal the fd of the core_proxy connection or < 0 on error. The core_proxy
|
||||
* will be disconnected after this call. */
|
||||
int pw_core_proxy_steal_fd(struct pw_core_proxy *core_proxy);
|
||||
|
||||
/** Get the core proxy, can only be called when connected */
|
||||
int pw_core_proxy_disconnect(struct pw_core_proxy *proxy);
|
||||
|
||||
/** Get the user_data. It is of the size specified when this object was
|
||||
* constructed */
|
||||
void *pw_core_proxy_get_user_data(struct pw_core_proxy *core_proxy);
|
||||
|
||||
/** Get the client proxy */
|
||||
struct pw_client_proxy * pw_core_proxy_get_client_proxy(struct pw_core_proxy *proxy);
|
||||
|
||||
/** Get the context object used to created this core_proxy */
|
||||
struct pw_context * pw_core_proxy_get_context(struct pw_core_proxy *proxy);
|
||||
|
||||
/** Get properties from the core_proxy */
|
||||
const struct pw_properties *pw_core_proxy_get_properties(struct pw_core_proxy *proxy);
|
||||
|
||||
/** Update the core_proxy properties. This updates the properties
|
||||
* of the associated client.
|
||||
* \return the number of properties that were updated */
|
||||
int pw_core_proxy_update_properties(struct pw_core_proxy *core_proxy, const struct spa_dict *dict);
|
||||
|
||||
/** Get the core_proxy mempool object */
|
||||
struct pw_mempool * pw_core_proxy_get_mempool(struct pw_core_proxy *proxy);
|
||||
|
||||
/** Get the proxy with the given id */
|
||||
struct pw_proxy *pw_core_proxy_find_proxy(struct pw_core_proxy *proxy, uint32_t id);
|
||||
|
||||
/** Export an object into the PipeWire instance associated with core_proxy */
|
||||
struct pw_proxy *pw_core_proxy_export(struct pw_core_proxy *proxy, /**< the proxy */
|
||||
uint32_t type, /**< the type of object */
|
||||
struct pw_properties *properties, /**< extra properties */
|
||||
void *object, /**< object to export */
|
||||
size_t user_data_size /**< extra user data */);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PIPEWIRE_REMOTE_H */
|
|
@ -37,21 +37,21 @@
|
|||
|
||||
#include "extensions/protocol-native.h"
|
||||
|
||||
#define NAME "core-proxy"
|
||||
#define NAME "core"
|
||||
|
||||
/** \cond */
|
||||
|
||||
/** \endcond */
|
||||
static void core_event_ping(void *data, uint32_t id, int seq)
|
||||
{
|
||||
struct pw_core_proxy *this = data;
|
||||
struct pw_core *this = data;
|
||||
pw_log_debug(NAME" %p: object %u ping %u", this, id, seq);
|
||||
pw_core_proxy_pong(this->core_proxy, id, seq);
|
||||
pw_core_pong(this->core, id, seq);
|
||||
}
|
||||
|
||||
static void core_event_done(void *data, uint32_t id, int seq)
|
||||
{
|
||||
struct pw_core_proxy *this = data;
|
||||
struct pw_core *this = data;
|
||||
struct pw_proxy *proxy;
|
||||
|
||||
pw_log_trace(NAME" %p: object %u done %d", this, id, seq);
|
||||
|
@ -63,7 +63,7 @@ static void core_event_done(void *data, uint32_t id, int seq)
|
|||
|
||||
static void core_event_error(void *data, uint32_t id, int seq, int res, const char *message)
|
||||
{
|
||||
struct pw_core_proxy *this = data;
|
||||
struct pw_core *this = data;
|
||||
struct pw_proxy *proxy;
|
||||
|
||||
pw_log_error(NAME" %p: object error %u: seq:%d %d (%s): %s", this, id, seq,
|
||||
|
@ -76,7 +76,7 @@ static void core_event_error(void *data, uint32_t id, int seq, int res, const ch
|
|||
|
||||
static void core_event_remove_id(void *data, uint32_t id)
|
||||
{
|
||||
struct pw_core_proxy *this = data;
|
||||
struct pw_core *this = data;
|
||||
struct pw_proxy *proxy;
|
||||
|
||||
pw_log_debug(NAME" %p: object remove %u", this, id);
|
||||
|
@ -86,7 +86,7 @@ static void core_event_remove_id(void *data, uint32_t id)
|
|||
|
||||
static void core_event_bound_id(void *data, uint32_t id, uint32_t global_id)
|
||||
{
|
||||
struct pw_core_proxy *this = data;
|
||||
struct pw_core *this = data;
|
||||
struct pw_proxy *proxy;
|
||||
|
||||
pw_log_debug(NAME" %p: proxy %u bound %u", this, id, global_id);
|
||||
|
@ -97,7 +97,7 @@ static void core_event_bound_id(void *data, uint32_t id, uint32_t global_id)
|
|||
|
||||
static void core_event_add_mem(void *data, uint32_t id, uint32_t type, int fd, uint32_t flags)
|
||||
{
|
||||
struct pw_core_proxy *this = data;
|
||||
struct pw_core *this = data;
|
||||
struct pw_memblock *m;
|
||||
|
||||
pw_log_debug(NAME" %p: add mem %u type:%u fd:%d flags:%u", this, id, type, fd, flags);
|
||||
|
@ -112,13 +112,13 @@ static void core_event_add_mem(void *data, uint32_t id, uint32_t type, int fd, u
|
|||
|
||||
static void core_event_remove_mem(void *data, uint32_t id)
|
||||
{
|
||||
struct pw_core_proxy *this = data;
|
||||
struct pw_core *this = data;
|
||||
pw_log_debug(NAME" %p: remove mem %u", this, id);
|
||||
pw_mempool_unref_id(this->pool, id);
|
||||
}
|
||||
|
||||
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 = core_event_error,
|
||||
.ping = core_event_ping,
|
||||
.done = core_event_done,
|
||||
|
@ -129,115 +129,115 @@ static const struct pw_core_proxy_events core_events = {
|
|||
};
|
||||
|
||||
SPA_EXPORT
|
||||
struct pw_context *pw_core_proxy_get_context(struct pw_core_proxy *core_proxy)
|
||||
struct pw_context *pw_core_get_context(struct pw_core *core)
|
||||
{
|
||||
return core_proxy->context;
|
||||
return core->context;
|
||||
}
|
||||
|
||||
SPA_EXPORT
|
||||
const struct pw_properties *pw_core_proxy_get_properties(struct pw_core_proxy *core_proxy)
|
||||
const struct pw_properties *pw_core_get_properties(struct pw_core *core)
|
||||
{
|
||||
return core_proxy->properties;
|
||||
return core->properties;
|
||||
}
|
||||
|
||||
SPA_EXPORT
|
||||
int pw_core_proxy_update_properties(struct pw_core_proxy *core_proxy, const struct spa_dict *dict)
|
||||
int pw_core_update_properties(struct pw_core *core, const struct spa_dict *dict)
|
||||
{
|
||||
int changed;
|
||||
|
||||
changed = pw_properties_update(core_proxy->properties, dict);
|
||||
changed = pw_properties_update(core->properties, dict);
|
||||
|
||||
pw_log_debug(NAME" %p: updated %d properties", core_proxy, changed);
|
||||
pw_log_debug(NAME" %p: updated %d properties", core, changed);
|
||||
|
||||
if (!changed)
|
||||
return 0;
|
||||
|
||||
if (core_proxy->client_proxy)
|
||||
pw_client_proxy_update_properties(core_proxy->client_proxy, &core_proxy->properties->dict);
|
||||
if (core->client_proxy)
|
||||
pw_client_proxy_update_properties(core->client_proxy, &core->properties->dict);
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
SPA_EXPORT
|
||||
void *pw_core_proxy_get_user_data(struct pw_core_proxy *core_proxy)
|
||||
void *pw_core_get_user_data(struct pw_core *core)
|
||||
{
|
||||
return core_proxy->user_data;
|
||||
return core->user_data;
|
||||
}
|
||||
|
||||
static int destroy_proxy(void *object, void *data)
|
||||
{
|
||||
struct pw_core_proxy *core_proxy = data;
|
||||
struct pw_core *core = data;
|
||||
struct pw_proxy *p = object;
|
||||
|
||||
if (object == NULL)
|
||||
return 0;
|
||||
|
||||
p->core_proxy = NULL;
|
||||
if (object != core_proxy)
|
||||
p->core = NULL;
|
||||
if (object != core)
|
||||
pw_proxy_remove(p);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void core_proxy_destroy(void *data)
|
||||
static void proxy_core_destroy(void *data)
|
||||
{
|
||||
struct pw_core_proxy *core_proxy = data;
|
||||
struct pw_core *core = data;
|
||||
struct pw_stream *stream, *s2;
|
||||
struct pw_filter *filter, *f2;
|
||||
|
||||
if (core_proxy->destroyed)
|
||||
if (core->destroyed)
|
||||
return;
|
||||
|
||||
core_proxy->destroyed = true;
|
||||
core->destroyed = true;
|
||||
|
||||
pw_log_debug(NAME" %p: core proxy destroy", core_proxy);
|
||||
spa_list_remove(&core_proxy->link);
|
||||
pw_log_debug(NAME" %p: core proxy destroy", core);
|
||||
spa_list_remove(&core->link);
|
||||
|
||||
spa_list_for_each_safe(stream, s2, &core_proxy->stream_list, link)
|
||||
spa_list_for_each_safe(stream, s2, &core->stream_list, link)
|
||||
pw_stream_disconnect(stream);
|
||||
spa_list_for_each_safe(filter, f2, &core_proxy->filter_list, link)
|
||||
spa_list_for_each_safe(filter, f2, &core->filter_list, link)
|
||||
pw_filter_disconnect(filter);
|
||||
|
||||
pw_protocol_client_disconnect(core_proxy->conn);
|
||||
core_proxy->client_proxy = NULL;
|
||||
pw_protocol_client_disconnect(core->conn);
|
||||
core->client_proxy = NULL;
|
||||
|
||||
pw_map_for_each(&core_proxy->objects, destroy_proxy, core_proxy);
|
||||
pw_map_reset(&core_proxy->objects);
|
||||
pw_map_for_each(&core->objects, destroy_proxy, core);
|
||||
pw_map_reset(&core->objects);
|
||||
|
||||
spa_list_consume(stream, &core_proxy->stream_list, link)
|
||||
spa_list_consume(stream, &core->stream_list, link)
|
||||
pw_stream_destroy(stream);
|
||||
spa_list_consume(filter, &core_proxy->filter_list, link)
|
||||
spa_list_consume(filter, &core->filter_list, link)
|
||||
pw_filter_destroy(filter);
|
||||
|
||||
pw_mempool_destroy(core_proxy->pool);
|
||||
pw_mempool_destroy(core->pool);
|
||||
|
||||
pw_protocol_client_destroy(core_proxy->conn);
|
||||
pw_protocol_client_destroy(core->conn);
|
||||
|
||||
pw_map_clear(&core_proxy->objects);
|
||||
pw_map_clear(&core->objects);
|
||||
|
||||
pw_log_debug(NAME" %p: free", core_proxy);
|
||||
pw_properties_free(core_proxy->properties);
|
||||
pw_log_debug(NAME" %p: free", core);
|
||||
pw_properties_free(core->properties);
|
||||
}
|
||||
|
||||
static const struct pw_proxy_events core_proxy_events = {
|
||||
static const struct pw_proxy_events proxy_core_events = {
|
||||
PW_VERSION_PROXY_EVENTS,
|
||||
.destroy = core_proxy_destroy,
|
||||
.destroy = proxy_core_destroy,
|
||||
};
|
||||
|
||||
SPA_EXPORT
|
||||
struct pw_client_proxy * pw_core_proxy_get_client_proxy(struct pw_core_proxy *core_proxy)
|
||||
struct pw_client_proxy * pw_core_get_client_proxy(struct pw_core *core)
|
||||
{
|
||||
return core_proxy->client_proxy;
|
||||
return core->client_proxy;
|
||||
}
|
||||
|
||||
SPA_EXPORT
|
||||
struct pw_proxy *pw_core_proxy_find_proxy(struct pw_core_proxy *core_proxy, uint32_t id)
|
||||
struct pw_proxy *pw_core_find_proxy(struct pw_core *core, uint32_t id)
|
||||
{
|
||||
return pw_map_lookup(&core_proxy->objects, id);
|
||||
return pw_map_lookup(&core->objects, id);
|
||||
}
|
||||
|
||||
SPA_EXPORT
|
||||
struct pw_proxy *pw_core_proxy_export(struct pw_core_proxy *core_proxy,
|
||||
struct pw_proxy *pw_core_export(struct pw_core *core,
|
||||
uint32_t type, struct pw_properties *props, void *object,
|
||||
size_t user_data_size)
|
||||
{
|
||||
|
@ -245,13 +245,13 @@ struct pw_proxy *pw_core_proxy_export(struct pw_core_proxy *core_proxy,
|
|||
const struct pw_export_type *t;
|
||||
int res;
|
||||
|
||||
t = pw_context_find_export_type(core_proxy->context, type);
|
||||
t = pw_context_find_export_type(core->context, type);
|
||||
if (t == NULL) {
|
||||
res = -EPROTO;
|
||||
goto error_export_type;
|
||||
}
|
||||
|
||||
proxy = t->func(core_proxy, type, props, object, user_data_size);
|
||||
proxy = t->func(core, type, props, object, user_data_size);
|
||||
if (proxy == NULL) {
|
||||
res = -errno;
|
||||
goto error_proxy_failed;
|
||||
|
@ -259,10 +259,10 @@ struct pw_proxy *pw_core_proxy_export(struct pw_core_proxy *core_proxy,
|
|||
return proxy;
|
||||
|
||||
error_export_type:
|
||||
pw_log_error(NAME" %p: can't export type %d: %s", core_proxy, type, spa_strerror(res));
|
||||
pw_log_error(NAME" %p: can't export type %d: %s", core, type, spa_strerror(res));
|
||||
goto exit_free;
|
||||
error_proxy_failed:
|
||||
pw_log_error(NAME" %p: failed to create proxy: %s", core_proxy, spa_strerror(res));
|
||||
pw_log_error(NAME" %p: failed to create proxy: %s", core, spa_strerror(res));
|
||||
goto exit;
|
||||
exit_free:
|
||||
if (props)
|
||||
|
@ -272,15 +272,15 @@ exit:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static struct pw_core_proxy *core_proxy_new(struct pw_context *context,
|
||||
static struct pw_core *core_new(struct pw_context *context,
|
||||
struct pw_properties *properties, size_t user_data_size)
|
||||
{
|
||||
struct pw_core_proxy *p;
|
||||
struct pw_core *p;
|
||||
struct pw_protocol *protocol = NULL;
|
||||
const char *protocol_name;
|
||||
int res;
|
||||
|
||||
p = calloc(1, sizeof(struct pw_core_proxy) + user_data_size);
|
||||
p = calloc(1, sizeof(struct pw_core) + user_data_size);
|
||||
if (p == NULL) {
|
||||
res = -errno;
|
||||
goto exit_cleanup;
|
||||
|
@ -294,13 +294,13 @@ static struct pw_core_proxy *core_proxy_new(struct pw_context *context,
|
|||
|
||||
pw_fill_connect_properties(context, properties);
|
||||
|
||||
p->proxy.core_proxy = p;
|
||||
p->proxy.core = p;
|
||||
p->context = context;
|
||||
p->properties = properties;
|
||||
p->pool = pw_mempool_new(NULL);
|
||||
p->core_proxy = p;
|
||||
p->core = p;
|
||||
if (user_data_size > 0)
|
||||
p->user_data = SPA_MEMBER(p, sizeof(struct pw_core_proxy), void);
|
||||
p->user_data = SPA_MEMBER(p, sizeof(struct pw_core), void);
|
||||
p->proxy.user_data = p->user_data;
|
||||
|
||||
pw_map_init(&p->objects, 64, 32);
|
||||
|
@ -324,9 +324,9 @@ static struct pw_core_proxy *core_proxy_new(struct pw_context *context,
|
|||
if (p->conn == NULL)
|
||||
goto error_connection;
|
||||
|
||||
p->conn->core_proxy = p;
|
||||
p->conn->core = p;
|
||||
|
||||
if ((res = pw_proxy_init(&p->proxy, PW_TYPE_INTERFACE_Core, PW_VERSION_CORE_PROXY)) < 0)
|
||||
if ((res = pw_proxy_init(&p->proxy, PW_TYPE_INTERFACE_Core, PW_VERSION_CORE)) < 0)
|
||||
goto error_proxy;
|
||||
|
||||
p->client_proxy = (struct pw_client_proxy*)pw_proxy_new(&p->proxy,
|
||||
|
@ -336,13 +336,13 @@ static struct pw_core_proxy *core_proxy_new(struct pw_context *context,
|
|||
goto error_proxy;
|
||||
}
|
||||
|
||||
pw_core_proxy_add_listener(p, &p->core_listener, &core_events, p);
|
||||
pw_proxy_add_listener(&p->proxy, &p->core_proxy_listener, &core_proxy_events, p);
|
||||
pw_core_add_listener(p, &p->core_listener, &core_events, p);
|
||||
pw_proxy_add_listener(&p->proxy, &p->proxy_core_listener, &proxy_core_events, p);
|
||||
|
||||
pw_core_proxy_hello(p, PW_VERSION_CORE_PROXY);
|
||||
pw_core_hello(p, PW_VERSION_CORE);
|
||||
pw_client_proxy_update_properties(p->client_proxy, &p->properties->dict);
|
||||
|
||||
spa_list_append(&context->core_proxy_list, &p->link);
|
||||
spa_list_append(&context->core_list, &p->link);
|
||||
|
||||
return p;
|
||||
|
||||
|
@ -371,55 +371,55 @@ exit_cleanup:
|
|||
}
|
||||
|
||||
SPA_EXPORT
|
||||
struct pw_core_proxy *
|
||||
struct pw_core *
|
||||
pw_context_connect(struct pw_context *context, struct pw_properties *properties,
|
||||
size_t user_data_size)
|
||||
{
|
||||
struct pw_core_proxy *core_proxy;
|
||||
struct pw_core *core;
|
||||
int res;
|
||||
|
||||
core_proxy = core_proxy_new(context, properties, user_data_size);
|
||||
if (core_proxy == NULL)
|
||||
core = core_new(context, properties, user_data_size);
|
||||
if (core == NULL)
|
||||
return NULL;
|
||||
|
||||
if ((res = pw_protocol_client_connect(core_proxy->conn,
|
||||
&core_proxy->properties->dict,
|
||||
if ((res = pw_protocol_client_connect(core->conn,
|
||||
&core->properties->dict,
|
||||
NULL, NULL)) < 0)
|
||||
goto error_free;
|
||||
|
||||
return core_proxy;
|
||||
return core;
|
||||
|
||||
error_free:
|
||||
pw_core_proxy_disconnect(core_proxy);
|
||||
pw_core_disconnect(core);
|
||||
errno = -res;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SPA_EXPORT
|
||||
struct pw_core_proxy *
|
||||
struct pw_core *
|
||||
pw_context_connect_fd(struct pw_context *context, int fd, struct pw_properties *properties,
|
||||
size_t user_data_size)
|
||||
{
|
||||
struct pw_core_proxy *core_proxy;
|
||||
struct pw_core *core;
|
||||
int res;
|
||||
|
||||
core_proxy = core_proxy_new(context, properties, user_data_size);
|
||||
if (core_proxy == NULL)
|
||||
core = core_new(context, properties, user_data_size);
|
||||
if (core == NULL)
|
||||
return NULL;
|
||||
|
||||
if ((res = pw_protocol_client_connect_fd(core_proxy->conn, fd, true)) < 0)
|
||||
if ((res = pw_protocol_client_connect_fd(core->conn, fd, true)) < 0)
|
||||
goto error_free;
|
||||
|
||||
return core_proxy;
|
||||
return core;
|
||||
|
||||
error_free:
|
||||
pw_core_proxy_disconnect(core_proxy);
|
||||
pw_core_disconnect(core);
|
||||
errno = -res;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SPA_EXPORT
|
||||
struct pw_core_proxy *
|
||||
struct pw_core *
|
||||
pw_context_connect_self(struct pw_context *context, struct pw_properties *properties,
|
||||
size_t user_data_size)
|
||||
{
|
||||
|
@ -437,19 +437,19 @@ pw_context_connect_self(struct pw_context *context, struct pw_properties *proper
|
|||
}
|
||||
|
||||
SPA_EXPORT
|
||||
int pw_core_proxy_steal_fd(struct pw_core_proxy *proxy)
|
||||
int pw_core_steal_fd(struct pw_core *proxy)
|
||||
{
|
||||
return pw_protocol_client_steal_fd(proxy->conn);
|
||||
}
|
||||
|
||||
SPA_EXPORT
|
||||
struct pw_mempool * pw_core_proxy_get_mempool(struct pw_core_proxy *proxy)
|
||||
struct pw_mempool * pw_core_get_mempool(struct pw_core *proxy)
|
||||
{
|
||||
return proxy->pool;
|
||||
}
|
||||
|
||||
SPA_EXPORT
|
||||
int pw_core_proxy_disconnect(struct pw_core_proxy *proxy)
|
||||
int pw_core_disconnect(struct pw_core *proxy)
|
||||
{
|
||||
pw_proxy_destroy(&proxy->proxy);
|
||||
return 0;
|
561
src/pipewire/core.h
Normal file
561
src/pipewire/core.h
Normal file
|
@ -0,0 +1,561 @@
|
|||
/* PipeWire
|
||||
*
|
||||
* Copyright © 2018 Wim Taymans
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef PIPEWIRE_CORE_H
|
||||
#define PIPEWIRE_CORE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <spa/utils/hook.h>
|
||||
|
||||
#define PW_VERSION_CORE 3
|
||||
struct pw_core;
|
||||
#define PW_VERSION_REGISTRY_PROXY 3
|
||||
struct pw_registry_proxy;
|
||||
|
||||
/** The core information. Extra information can be added in later versions \memberof pw_introspect */
|
||||
struct pw_core_info {
|
||||
uint32_t id; /**< id of the global */
|
||||
uint32_t cookie; /**< a random cookie for identifying this instance of PipeWire */
|
||||
const char *user_name; /**< name of the user that started the core */
|
||||
const char *host_name; /**< name of the machine the core is running on */
|
||||
const char *version; /**< version of the core */
|
||||
const char *name; /**< name of the core */
|
||||
#define PW_CORE_CHANGE_MASK_PROPS (1 << 0)
|
||||
#define PW_CORE_CHANGE_MASK_ALL ((1 << 1)-1)
|
||||
uint64_t change_mask; /**< bitfield of changed fields since last call */
|
||||
struct spa_dict *props; /**< extra properties */
|
||||
};
|
||||
|
||||
#include <pipewire/context.h>
|
||||
#include <pipewire/properties.h>
|
||||
#include <pipewire/node.h>
|
||||
#include <pipewire/proxy.h>
|
||||
|
||||
/** Update and existing \ref pw_core_info with \a update \memberof pw_introspect */
|
||||
struct pw_core_info *
|
||||
pw_core_info_update(struct pw_core_info *info,
|
||||
const struct pw_core_info *update);
|
||||
|
||||
/** Free a \ref pw_core_info \memberof pw_introspect */
|
||||
void pw_core_info_free(struct pw_core_info *info);
|
||||
|
||||
/**
|
||||
* \page page_iface_pw_core pw_core
|
||||
* \section page_iface_pw_core_desc Description
|
||||
*
|
||||
* The core global object. This is a special singleton object. It
|
||||
* is used for internal PipeWire protocol features.
|
||||
* \section page_iface_pw_core API
|
||||
*/
|
||||
|
||||
/** Core */
|
||||
|
||||
#define PW_CORE_EVENT_INFO 0
|
||||
#define PW_CORE_EVENT_DONE 1
|
||||
#define PW_CORE_EVENT_PING 2
|
||||
#define PW_CORE_EVENT_ERROR 3
|
||||
#define PW_CORE_EVENT_REMOVE_ID 4
|
||||
#define PW_CORE_EVENT_BOUND_ID 5
|
||||
#define PW_CORE_EVENT_ADD_MEM 6
|
||||
#define PW_CORE_EVENT_REMOVE_MEM 7
|
||||
#define PW_CORE_EVENT_NUM 8
|
||||
|
||||
/** \struct pw_core_events
|
||||
* \brief Core events
|
||||
* \ingroup pw_core_interface The pw_core interface
|
||||
*/
|
||||
struct pw_core_events {
|
||||
#define PW_VERSION_CORE_EVENTS 0
|
||||
uint32_t version;
|
||||
|
||||
/**
|
||||
* Notify new core info
|
||||
*
|
||||
* This event is emited when first bound to the core or when the
|
||||
* hello method is called.
|
||||
*
|
||||
* \param info new core info
|
||||
*/
|
||||
void (*info) (void *object, const struct pw_core_info *info);
|
||||
/**
|
||||
* Emit a done event
|
||||
*
|
||||
* The done event is emited as a result of a sync method with the
|
||||
* same seq number.
|
||||
*
|
||||
* \param seq the seq number passed to the sync method call
|
||||
*/
|
||||
void (*done) (void *object, uint32_t id, int seq);
|
||||
|
||||
/** Emit a ping event
|
||||
*
|
||||
* The client should reply with a pong reply with the same seq
|
||||
* number.
|
||||
*/
|
||||
void (*ping) (void *object, uint32_t id, int seq);
|
||||
|
||||
/**
|
||||
* Fatal error event
|
||||
*
|
||||
* The error event is sent out when a fatal (non-recoverable)
|
||||
* error has occurred. The id argument is the proxy object where
|
||||
* the error occurred, most often in response to a request to that
|
||||
* object. The message is a brief description of the error,
|
||||
* for (debugging) convenience.
|
||||
*
|
||||
* This event is usually also emited on the proxy object with
|
||||
* \a id.
|
||||
*
|
||||
* \param id object where the error occurred
|
||||
* \param seq the sequence number that generated the error
|
||||
* \param res error code
|
||||
* \param message error description
|
||||
*/
|
||||
void (*error) (void *object, uint32_t id, int seq, int res, const char *message);
|
||||
/**
|
||||
* Remove an object ID
|
||||
*
|
||||
* This event is used internally by the object ID management
|
||||
* logic. When a client deletes an object, the server will send
|
||||
* this event to acknowledge that it has seen the delete request.
|
||||
* When the client receives this event, it will know that it can
|
||||
* safely reuse the object ID.
|
||||
*
|
||||
* \param id deleted object ID
|
||||
*/
|
||||
void (*remove_id) (void *object, uint32_t id);
|
||||
|
||||
/**
|
||||
* Notify an object binding
|
||||
*
|
||||
* This event is emited when a local object ID is bound to a
|
||||
* global ID. It is emited before the global becomes visible in the
|
||||
* registry.
|
||||
*
|
||||
* \param id bound object ID
|
||||
* \param global_id the global id bound to
|
||||
*/
|
||||
void (*bound_id) (void *object, uint32_t id, uint32_t global_id);
|
||||
|
||||
/**
|
||||
* Add memory for a client
|
||||
*
|
||||
* Memory is given to a client as \a fd of a certain
|
||||
* memory \a type.
|
||||
*
|
||||
* Further references to this fd will be made with the per memory
|
||||
* unique identifier \a id.
|
||||
*
|
||||
* \param id the unique id of the memory
|
||||
* \param type the memory type, one of enum spa_data_type
|
||||
* \param fd the file descriptor
|
||||
* \param flags extra flags
|
||||
*/
|
||||
void (*add_mem) (void *object, uint32_t id, uint32_t type, int fd, uint32_t flags);
|
||||
|
||||
/**
|
||||
* Remove memory for a client
|
||||
*
|
||||
* \param id the memory id to remove
|
||||
*/
|
||||
void (*remove_mem) (void *object, uint32_t id);
|
||||
};
|
||||
|
||||
#define PW_CORE_METHOD_ADD_LISTENER 0
|
||||
#define PW_CORE_METHOD_HELLO 1
|
||||
#define PW_CORE_METHOD_SYNC 2
|
||||
#define PW_CORE_METHOD_PONG 3
|
||||
#define PW_CORE_METHOD_ERROR 4
|
||||
#define PW_CORE_METHOD_GET_REGISTRY 5
|
||||
#define PW_CORE_METHOD_CREATE_OBJECT 6
|
||||
#define PW_CORE_METHOD_DESTROY 7
|
||||
#define PW_CORE_METHOD_NUM 8
|
||||
|
||||
/**
|
||||
* \struct pw_core_methods
|
||||
* \brief Core methods
|
||||
*
|
||||
* The core global object. This is a singleton object used for
|
||||
* creating new objects in the remote PipeWire intance. It is
|
||||
* also used for internal features.
|
||||
*/
|
||||
struct pw_core_methods {
|
||||
#define PW_VERSION_CORE_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_core_events *events,
|
||||
void *data);
|
||||
/**
|
||||
* Start a conversation with the server. This will send
|
||||
* the core info and will destroy all resources for the client
|
||||
* (except the core and client resource).
|
||||
*/
|
||||
int (*hello) (void *object, uint32_t version);
|
||||
/**
|
||||
* Do server roundtrip
|
||||
*
|
||||
* Ask the server to emit the 'done' event with \a seq.
|
||||
*
|
||||
* Since methods are handled in-order and events are delivered
|
||||
* in-order, this can be used as a barrier to ensure all previous
|
||||
* methods and the resulting events have been handled.
|
||||
*
|
||||
* \param seq the seq number passed to the done event
|
||||
*/
|
||||
int (*sync) (void *object, uint32_t id, int seq);
|
||||
/**
|
||||
* Reply to a server ping event.
|
||||
*
|
||||
* Reply to the server ping event with the same seq.
|
||||
*
|
||||
* \param seq the seq number received in the ping event
|
||||
*/
|
||||
int (*pong) (void *object, uint32_t id, int seq);
|
||||
/**
|
||||
* Fatal error event
|
||||
*
|
||||
* The error method is sent out when a fatal (non-recoverable)
|
||||
* error has occurred. The id argument is the proxy object where
|
||||
* the error occurred, most often in response to an event on that
|
||||
* object. The message is a brief description of the error,
|
||||
* for (debugging) convenience.
|
||||
*
|
||||
* This method is usually also emited on the resource object with
|
||||
* \a id.
|
||||
*
|
||||
* \param id object where the error occurred
|
||||
* \param res error code
|
||||
* \param message error description
|
||||
*/
|
||||
int (*error) (void *object, uint32_t id, int seq, int res, const char *message);
|
||||
/**
|
||||
* Get the registry object
|
||||
*
|
||||
* Create a registry object that allows the client to list and bind
|
||||
* the global objects available from the PipeWire server
|
||||
* \param version the client version
|
||||
* \param user_data_size extra size
|
||||
*/
|
||||
struct pw_registry_proxy * (*get_registry) (void *object, uint32_t version,
|
||||
size_t user_data_size);
|
||||
|
||||
/**
|
||||
* Create a new object on the PipeWire server from a factory.
|
||||
*
|
||||
* \param factory_name the factory name to use
|
||||
* \param type the interface to bind to
|
||||
* \param version the version of the interface
|
||||
* \param props extra properties
|
||||
* \param user_data_size extra size
|
||||
*/
|
||||
void * (*create_object) (void *object,
|
||||
const char *factory_name,
|
||||
uint32_t type,
|
||||
uint32_t version,
|
||||
const struct spa_dict *props,
|
||||
size_t user_data_size);
|
||||
/**
|
||||
* Destroy an resource
|
||||
*
|
||||
* Destroy the server resource for the given proxy.
|
||||
*
|
||||
* \param obj the proxy to destroy
|
||||
*/
|
||||
int (*destroy) (void *object, void *proxy);
|
||||
};
|
||||
|
||||
#define pw_core_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)o, \
|
||||
struct pw_core_methods, _res, \
|
||||
method, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
#define pw_core_add_listener(c,...) pw_core_method(c,add_listener,0,__VA_ARGS__)
|
||||
#define pw_core_hello(c,...) pw_core_method(c,hello,0,__VA_ARGS__)
|
||||
#define pw_core_sync(c,...) pw_core_method(c,sync,0,__VA_ARGS__)
|
||||
#define pw_core_pong(c,...) pw_core_method(c,pong,0,__VA_ARGS__)
|
||||
#define pw_core_error(c,...) pw_core_method(c,error,0,__VA_ARGS__)
|
||||
|
||||
static inline int
|
||||
pw_core_errorv(struct pw_core *core, uint32_t id, int seq,
|
||||
int res, const char *message, va_list args)
|
||||
{
|
||||
char buffer[1024];
|
||||
vsnprintf(buffer, sizeof(buffer), message, args);
|
||||
buffer[1023] = '\0';
|
||||
return pw_core_error(core, id, seq, res, buffer);
|
||||
}
|
||||
|
||||
static inline int
|
||||
pw_core_errorf(struct pw_core *core, uint32_t id, int seq,
|
||||
int res, const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
int r;
|
||||
va_start(args, message);
|
||||
r = pw_core_errorv(core, id, seq, res, message, args);
|
||||
va_end(args);
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline struct pw_registry_proxy *
|
||||
pw_core_get_registry(struct pw_core *core, uint32_t version, size_t user_data_size)
|
||||
{
|
||||
struct pw_registry_proxy *res = NULL;
|
||||
spa_interface_call_res((struct spa_interface*)core,
|
||||
struct pw_core_methods, res,
|
||||
get_registry, 0, version, user_data_size);
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline void *
|
||||
pw_core_create_object(struct pw_core *core,
|
||||
const char *factory_name,
|
||||
uint32_t type,
|
||||
uint32_t version,
|
||||
const struct spa_dict *props,
|
||||
size_t user_data_size)
|
||||
{
|
||||
void *res = NULL;
|
||||
spa_interface_call_res((struct spa_interface*)core,
|
||||
struct pw_core_methods, res,
|
||||
create_object, 0, factory_name,
|
||||
type, version, props, user_data_size);
|
||||
return res;
|
||||
}
|
||||
|
||||
#define pw_core_destroy(c,...) pw_core_method(c,destroy,0,__VA_ARGS__)
|
||||
|
||||
/** \page page_registry Registry
|
||||
*
|
||||
* \section page_registry_overview Overview
|
||||
*
|
||||
* The registry object is a singleton object that keeps track of
|
||||
* global objects on the PipeWire instance. See also \ref page_global.
|
||||
*
|
||||
* Global objects typically represent an actual object in PipeWire
|
||||
* (for example, a module or node) or they are singleton
|
||||
* objects such as the core.
|
||||
*
|
||||
* When a client creates a registry object, the registry object
|
||||
* will emit a global event for each global currently in the
|
||||
* registry. Globals come and go as a result of device hotplugs or
|
||||
* reconfiguration or other events, and the registry will send out
|
||||
* global and global_remove events to keep the client up to date
|
||||
* with the changes. To mark the end of the initial burst of
|
||||
* events, the client can use the pw_core.sync methosd immediately
|
||||
* after calling pw_core.get_registry.
|
||||
*
|
||||
* A client can bind to a global object by using the bind
|
||||
* request. This creates a client-side proxy that lets the object
|
||||
* emit events to the client and lets the client invoke methods on
|
||||
* the object. See \ref page_proxy
|
||||
*
|
||||
* Clients can also change the permissions of the global objects that
|
||||
* it can see. This is interesting when you want to configure a
|
||||
* pipewire session before handing it to another application. You
|
||||
* can, for example, hide certain existing or new objects or limit
|
||||
* the access permissions on an object.
|
||||
*/
|
||||
|
||||
#define PW_REGISTRY_PROXY_EVENT_GLOBAL 0
|
||||
#define PW_REGISTRY_PROXY_EVENT_GLOBAL_REMOVE 1
|
||||
#define PW_REGISTRY_PROXY_EVENT_NUM 2
|
||||
|
||||
/** Registry events */
|
||||
struct pw_registry_proxy_events {
|
||||
#define PW_VERSION_REGISTRY_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify of a new global object
|
||||
*
|
||||
* The registry emits this event when a new global object is
|
||||
* available.
|
||||
*
|
||||
* \param id the global object id
|
||||
* \param permissions the permissions of the object
|
||||
* \param type the type of the interface
|
||||
* \param version the version of the interface
|
||||
* \param props extra properties of the global
|
||||
*/
|
||||
void (*global) (void *object, uint32_t id,
|
||||
uint32_t permissions, uint32_t type, uint32_t version,
|
||||
const struct spa_dict *props);
|
||||
/**
|
||||
* Notify of a global object removal
|
||||
*
|
||||
* Emited when a global object was removed from the registry.
|
||||
* If the client has any bindings to the global, it should destroy
|
||||
* those.
|
||||
*
|
||||
* \param id the id of the global that was removed
|
||||
*/
|
||||
void (*global_remove) (void *object, uint32_t id);
|
||||
};
|
||||
|
||||
#define PW_REGISTRY_PROXY_METHOD_ADD_LISTENER 0
|
||||
#define PW_REGISTRY_PROXY_METHOD_BIND 1
|
||||
#define PW_REGISTRY_PROXY_METHOD_DESTROY 2
|
||||
#define PW_REGISTRY_PROXY_METHOD_NUM 3
|
||||
|
||||
/** Registry methods */
|
||||
struct pw_registry_proxy_methods {
|
||||
#define PW_VERSION_REGISTRY_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_registry_proxy_events *events,
|
||||
void *data);
|
||||
/**
|
||||
* Bind to a global object
|
||||
*
|
||||
* Bind to the global object with \a id and use the client proxy
|
||||
* with new_id as the proxy. After this call, methods can be
|
||||
* send to the remote global object and events can be received
|
||||
*
|
||||
* \param id the global id to bind to
|
||||
* \param type the interface type to bind to
|
||||
* \param version the interface version to use
|
||||
* \returns the new object
|
||||
*/
|
||||
void * (*bind) (void *object, uint32_t id, uint32_t type, uint32_t version,
|
||||
size_t use_data_size);
|
||||
|
||||
/**
|
||||
* Attempt to destroy a global object
|
||||
*
|
||||
* Try to destroy the global object.
|
||||
*
|
||||
* \param id the global id to destroy
|
||||
*/
|
||||
int (*destroy) (void *object, uint32_t id);
|
||||
};
|
||||
|
||||
#define pw_registry_proxy_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)o, \
|
||||
struct pw_registry_proxy_methods, _res, \
|
||||
method, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
/** Registry */
|
||||
#define pw_registry_proxy_add_listener(p,...) pw_registry_proxy_method(p,add_listener,0,__VA_ARGS__)
|
||||
|
||||
static inline void *
|
||||
pw_registry_proxy_bind(struct pw_registry_proxy *registry,
|
||||
uint32_t id, uint32_t type, uint32_t version,
|
||||
size_t user_data_size)
|
||||
{
|
||||
void *res = NULL;
|
||||
spa_interface_call_res((struct spa_interface*)registry,
|
||||
struct pw_registry_proxy_methods, res,
|
||||
bind, 0, id, type, version, user_data_size);
|
||||
return res;
|
||||
}
|
||||
|
||||
#define pw_registry_proxy_destroy(p,...) pw_registry_proxy_method(p,destroy,0,__VA_ARGS__)
|
||||
|
||||
|
||||
/** Connect to a PipeWire instance \memberof pw_core
|
||||
* \return a pw_core on success or NULL with errno set on error */
|
||||
struct pw_core *
|
||||
pw_context_connect(struct pw_context *context, /**< a \ref pw_context */
|
||||
struct pw_properties *properties, /**< optional properties, ownership of
|
||||
* the properties is taken.*/
|
||||
size_t user_data_size /**< extra user data size */);
|
||||
|
||||
/** Connect to a PipeWire instance on the given socket \memberof pw_core
|
||||
* \param fd the connected socket to use, the socket will be closed
|
||||
* automatically on disconnect or error.
|
||||
* \return a pw_core on success or NULL with errno set on error */
|
||||
struct pw_core *
|
||||
pw_context_connect_fd(struct pw_context *context, /**< a \ref pw_context */
|
||||
int fd, /**< an fd */
|
||||
struct pw_properties *properties, /**< optional properties, ownership of
|
||||
* the properties is taken.*/
|
||||
size_t user_data_size /**< extra user data size */);
|
||||
|
||||
/** Connect to a given PipeWire instance \memberof pw_core
|
||||
* \return a pw_core on success or NULL with errno set on error */
|
||||
struct pw_core *
|
||||
pw_context_connect_self(struct pw_context *context, /**< a \ref pw_context to connect to */
|
||||
struct pw_properties *properties, /**< optional properties, ownership of
|
||||
* the properties is taken.*/
|
||||
size_t user_data_size /**< extra user data size */);
|
||||
|
||||
/** Steal the fd of the core connection or < 0 on error. The core
|
||||
* will be disconnected after this call. */
|
||||
int pw_core_steal_fd(struct pw_core *core);
|
||||
|
||||
/** disconnect and destroy a core */
|
||||
int pw_core_disconnect(struct pw_core *core);
|
||||
|
||||
/** Get the user_data. It is of the size specified when this object was
|
||||
* constructed */
|
||||
void *pw_core_get_user_data(struct pw_core *core);
|
||||
|
||||
/** Get the client proxy */
|
||||
struct pw_client_proxy * pw_core_get_client_proxy(struct pw_core *core);
|
||||
|
||||
/** Get the context object used to created this core */
|
||||
struct pw_context * pw_core_get_context(struct pw_core *core);
|
||||
|
||||
/** Get properties from the core */
|
||||
const struct pw_properties *pw_core_get_properties(struct pw_core *core);
|
||||
|
||||
/** Update the core properties. This updates the properties
|
||||
* of the associated client.
|
||||
* \return the number of properties that were updated */
|
||||
int pw_core_update_properties(struct pw_core *core, const struct spa_dict *dict);
|
||||
|
||||
/** Get the core mempool object */
|
||||
struct pw_mempool * pw_core_get_mempool(struct pw_core *core);
|
||||
|
||||
/** Get the proxy with the given id */
|
||||
struct pw_proxy *pw_core_find_proxy(struct pw_core *core, uint32_t id);
|
||||
|
||||
/** Export an object into the PipeWire instance associated with core */
|
||||
struct pw_proxy *pw_core_export(struct pw_core *core, /**< the core */
|
||||
uint32_t type, /**< the type of object */
|
||||
struct pw_properties *properties, /**< extra properties */
|
||||
void *object, /**< object to export */
|
||||
size_t user_data_size /**< extra user data */);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PIPEWIRE_CORE_H */
|
|
@ -890,8 +890,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,
|
||||
};
|
||||
|
||||
|
@ -960,21 +960,21 @@ error_cleanup:
|
|||
}
|
||||
|
||||
SPA_EXPORT
|
||||
struct pw_filter * pw_filter_new(struct pw_core_proxy *core_proxy, const char *name,
|
||||
struct pw_filter * pw_filter_new(struct pw_core *core, const char *name,
|
||||
struct pw_properties *props)
|
||||
{
|
||||
struct filter *impl;
|
||||
struct pw_filter *this;
|
||||
struct pw_context *context = core_proxy->context;
|
||||
struct pw_context *context = core->context;
|
||||
|
||||
impl = filter_new(context, name, props, core_proxy->properties);
|
||||
impl = filter_new(context, name, props, core->properties);
|
||||
if (impl == NULL)
|
||||
return NULL;
|
||||
|
||||
this = &impl->this;
|
||||
this->core_proxy = core_proxy;
|
||||
spa_list_append(&this->core_proxy->filter_list, &this->link);
|
||||
pw_core_proxy_add_listener(core_proxy,
|
||||
this->core = core;
|
||||
spa_list_append(&this->core->filter_list, &this->link);
|
||||
pw_core_add_listener(core,
|
||||
&this->core_listener, &core_events, this);
|
||||
|
||||
return this;
|
||||
|
@ -1050,7 +1050,7 @@ void pw_filter_destroy(struct pw_filter *filter)
|
|||
|
||||
pw_filter_disconnect(filter);
|
||||
|
||||
if (filter->core_proxy) {
|
||||
if (filter->core) {
|
||||
spa_hook_remove(&filter->core_listener);
|
||||
spa_list_remove(&filter->link);
|
||||
}
|
||||
|
@ -1088,9 +1088,9 @@ enum pw_filter_state pw_filter_get_state(struct pw_filter *filter, const char **
|
|||
}
|
||||
|
||||
SPA_EXPORT
|
||||
struct pw_core_proxy *pw_filter_get_core_proxy(struct pw_filter *filter)
|
||||
struct pw_core *pw_filter_get_core(struct pw_filter *filter)
|
||||
{
|
||||
return filter->core_proxy;
|
||||
return filter->core;
|
||||
}
|
||||
|
||||
SPA_EXPORT
|
||||
|
@ -1183,21 +1183,21 @@ pw_filter_connect(struct pw_filter *filter,
|
|||
impl->disconnecting = false;
|
||||
filter_set_state(filter, PW_FILTER_STATE_CONNECTING, NULL);
|
||||
|
||||
if (filter->core_proxy == NULL) {
|
||||
filter->core_proxy = pw_context_connect(impl->context,
|
||||
if (filter->core == NULL) {
|
||||
filter->core = pw_context_connect(impl->context,
|
||||
pw_properties_copy(filter->properties), 0);
|
||||
if (filter->core_proxy == NULL) {
|
||||
if (filter->core == NULL) {
|
||||
res = -errno;
|
||||
goto error_connect;
|
||||
}
|
||||
spa_list_append(&filter->core_proxy->filter_list, &filter->link);
|
||||
pw_core_proxy_add_listener(filter->core_proxy,
|
||||
spa_list_append(&filter->core->filter_list, &filter->link);
|
||||
pw_core_add_listener(filter->core,
|
||||
&filter->core_listener, &core_events, filter);
|
||||
impl->free_proxy = true;
|
||||
}
|
||||
|
||||
pw_log_debug(NAME" %p: export node %p", filter, &impl->impl_node);
|
||||
filter->proxy = pw_core_proxy_export(filter->core_proxy,
|
||||
filter->proxy = pw_core_export(filter->core,
|
||||
SPA_TYPE_INTERFACE_Node, NULL, &impl->impl_node, 0);
|
||||
if (filter->proxy == NULL) {
|
||||
res = -errno;
|
||||
|
@ -1237,8 +1237,8 @@ int pw_filter_disconnect(struct pw_filter *filter)
|
|||
impl->free_proxy = false;
|
||||
spa_hook_remove(&filter->core_listener);
|
||||
spa_list_remove(&filter->link);
|
||||
pw_core_proxy_disconnect(filter->core_proxy);
|
||||
filter->core_proxy = NULL;
|
||||
pw_core_disconnect(filter->core);
|
||||
filter->core = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ struct pw_filter;
|
|||
#include <spa/node/io.h>
|
||||
#include <spa/param/param.h>
|
||||
|
||||
#include <pipewire/core-proxy.h>
|
||||
#include <pipewire/core.h>
|
||||
|
||||
/** \enum pw_filter_state The state of a filter \memberof pw_filter */
|
||||
enum pw_filter_state {
|
||||
|
@ -124,7 +124,7 @@ enum pw_filter_port_flags {
|
|||
/** Create a new unconneced \ref pw_filter \memberof pw_filter
|
||||
* \return a newly allocated \ref pw_filter */
|
||||
struct pw_filter *
|
||||
pw_filter_new(struct pw_core_proxy *proxy, /**< a \ref pw_core_proxy */
|
||||
pw_filter_new(struct pw_core *core, /**< a \ref pw_core */
|
||||
const char *name, /**< a filter media name */
|
||||
struct pw_properties *props /**< filter properties, ownership is taken */);
|
||||
|
||||
|
@ -147,7 +147,7 @@ enum pw_filter_state pw_filter_get_state(struct pw_filter *filter, const char **
|
|||
|
||||
const char *pw_stream_get_name(struct pw_stream *stream);
|
||||
|
||||
struct pw_core_proxy *pw_filter_get_core_proxy(struct pw_filter *filter);
|
||||
struct pw_core *pw_filter_get_core(struct pw_filter *filter);
|
||||
|
||||
/** Connect a filter for processing. \memberof pw_filter
|
||||
* \return 0 on success < 0 on error.
|
||||
|
|
|
@ -41,10 +41,6 @@ extern "C" {
|
|||
#include <pipewire/proxy.h>
|
||||
#include <pipewire/permission.h>
|
||||
|
||||
#define PW_VERSION_CORE_PROXY 3
|
||||
struct pw_core_proxy;
|
||||
#define PW_VERSION_REGISTRY_PROXY 3
|
||||
struct pw_registry_proxy;
|
||||
#define PW_VERSION_MODULE_PROXY 3
|
||||
struct pw_module_proxy;
|
||||
#define PW_VERSION_DEVICE_PROXY 3
|
||||
|
@ -76,423 +72,6 @@ struct pw_link_proxy;
|
|||
* \section page_iface_pw_core API
|
||||
*/
|
||||
|
||||
/** Core */
|
||||
|
||||
#define PW_CORE_PROXY_EVENT_INFO 0
|
||||
#define PW_CORE_PROXY_EVENT_DONE 1
|
||||
#define PW_CORE_PROXY_EVENT_PING 2
|
||||
#define PW_CORE_PROXY_EVENT_ERROR 3
|
||||
#define PW_CORE_PROXY_EVENT_REMOVE_ID 4
|
||||
#define PW_CORE_PROXY_EVENT_BOUND_ID 5
|
||||
#define PW_CORE_PROXY_EVENT_ADD_MEM 6
|
||||
#define PW_CORE_PROXY_EVENT_REMOVE_MEM 7
|
||||
#define PW_CORE_PROXY_EVENT_NUM 8
|
||||
|
||||
/** \struct pw_core_proxy_events
|
||||
* \brief Core events
|
||||
* \ingroup pw_core_interface The pw_core interface
|
||||
*/
|
||||
struct pw_core_proxy_events {
|
||||
#define PW_VERSION_CORE_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
|
||||
/**
|
||||
* Notify new core info
|
||||
*
|
||||
* This event is emited when first bound to the core or when the
|
||||
* hello method is called.
|
||||
*
|
||||
* \param info new core info
|
||||
*/
|
||||
void (*info) (void *object, const struct pw_core_info *info);
|
||||
/**
|
||||
* Emit a done event
|
||||
*
|
||||
* The done event is emited as a result of a sync method with the
|
||||
* same seq number.
|
||||
*
|
||||
* \param seq the seq number passed to the sync method call
|
||||
*/
|
||||
void (*done) (void *object, uint32_t id, int seq);
|
||||
|
||||
/** Emit a ping event
|
||||
*
|
||||
* The client should reply with a pong reply with the same seq
|
||||
* number.
|
||||
*/
|
||||
void (*ping) (void *object, uint32_t id, int seq);
|
||||
|
||||
/**
|
||||
* Fatal error event
|
||||
*
|
||||
* The error event is sent out when a fatal (non-recoverable)
|
||||
* error has occurred. The id argument is the proxy object where
|
||||
* the error occurred, most often in response to a request to that
|
||||
* object. The message is a brief description of the error,
|
||||
* for (debugging) convenience.
|
||||
*
|
||||
* This event is usually also emited on the proxy object with
|
||||
* \a id.
|
||||
*
|
||||
* \param id object where the error occurred
|
||||
* \param seq the sequence number that generated the error
|
||||
* \param res error code
|
||||
* \param message error description
|
||||
*/
|
||||
void (*error) (void *object, uint32_t id, int seq, int res, const char *message);
|
||||
/**
|
||||
* Remove an object ID
|
||||
*
|
||||
* This event is used internally by the object ID management
|
||||
* logic. When a client deletes an object, the server will send
|
||||
* this event to acknowledge that it has seen the delete request.
|
||||
* When the client receives this event, it will know that it can
|
||||
* safely reuse the object ID.
|
||||
*
|
||||
* \param id deleted object ID
|
||||
*/
|
||||
void (*remove_id) (void *object, uint32_t id);
|
||||
|
||||
/**
|
||||
* Notify an object binding
|
||||
*
|
||||
* This event is emited when a local object ID is bound to a
|
||||
* global ID. It is emited before the global becomes visible in the
|
||||
* registry.
|
||||
*
|
||||
* \param id bound object ID
|
||||
* \param global_id the global id bound to
|
||||
*/
|
||||
void (*bound_id) (void *object, uint32_t id, uint32_t global_id);
|
||||
|
||||
/**
|
||||
* Add memory for a client
|
||||
*
|
||||
* Memory is given to a client as \a fd of a certain
|
||||
* memory \a type.
|
||||
*
|
||||
* Further references to this fd will be made with the per memory
|
||||
* unique identifier \a id.
|
||||
*
|
||||
* \param id the unique id of the memory
|
||||
* \param type the memory type, one of enum spa_data_type
|
||||
* \param fd the file descriptor
|
||||
* \param flags extra flags
|
||||
*/
|
||||
void (*add_mem) (void *object, uint32_t id, uint32_t type, int fd, uint32_t flags);
|
||||
|
||||
/**
|
||||
* Remove memory for a client
|
||||
*
|
||||
* \param id the memory id to remove
|
||||
*/
|
||||
void (*remove_mem) (void *object, uint32_t id);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define PW_CORE_PROXY_METHOD_ADD_LISTENER 0
|
||||
#define PW_CORE_PROXY_METHOD_HELLO 1
|
||||
#define PW_CORE_PROXY_METHOD_SYNC 2
|
||||
#define PW_CORE_PROXY_METHOD_PONG 3
|
||||
#define PW_CORE_PROXY_METHOD_ERROR 4
|
||||
#define PW_CORE_PROXY_METHOD_GET_REGISTRY 5
|
||||
#define PW_CORE_PROXY_METHOD_CREATE_OBJECT 6
|
||||
#define PW_CORE_PROXY_METHOD_DESTROY 7
|
||||
#define PW_CORE_PROXY_METHOD_NUM 8
|
||||
|
||||
/**
|
||||
* \struct pw_core_proxy_methods
|
||||
* \brief Core methods
|
||||
*
|
||||
* The core global object. This is a singleton object used for
|
||||
* creating new objects in the remote PipeWire intance. It is
|
||||
* also used for internal features.
|
||||
*/
|
||||
struct pw_core_proxy_methods {
|
||||
#define PW_VERSION_CORE_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_core_proxy_events *events,
|
||||
void *data);
|
||||
/**
|
||||
* Start a conversation with the server. This will send
|
||||
* the core info and will destroy all resources for the client
|
||||
* (except the core and client resource).
|
||||
*/
|
||||
int (*hello) (void *object, uint32_t version);
|
||||
/**
|
||||
* Do server roundtrip
|
||||
*
|
||||
* Ask the server to emit the 'done' event with \a seq.
|
||||
*
|
||||
* Since methods are handled in-order and events are delivered
|
||||
* in-order, this can be used as a barrier to ensure all previous
|
||||
* methods and the resulting events have been handled.
|
||||
*
|
||||
* \param seq the seq number passed to the done event
|
||||
*/
|
||||
int (*sync) (void *object, uint32_t id, int seq);
|
||||
/**
|
||||
* Reply to a server ping event.
|
||||
*
|
||||
* Reply to the server ping event with the same seq.
|
||||
*
|
||||
* \param seq the seq number received in the ping event
|
||||
*/
|
||||
int (*pong) (void *object, uint32_t id, int seq);
|
||||
/**
|
||||
* Fatal error event
|
||||
*
|
||||
* The error method is sent out when a fatal (non-recoverable)
|
||||
* error has occurred. The id argument is the proxy object where
|
||||
* the error occurred, most often in response to an event on that
|
||||
* object. The message is a brief description of the error,
|
||||
* for (debugging) convenience.
|
||||
*
|
||||
* This method is usually also emited on the resource object with
|
||||
* \a id.
|
||||
*
|
||||
* \param id object where the error occurred
|
||||
* \param res error code
|
||||
* \param message error description
|
||||
*/
|
||||
int (*error) (void *object, uint32_t id, int seq, int res, const char *message);
|
||||
/**
|
||||
* Get the registry object
|
||||
*
|
||||
* Create a registry object that allows the client to list and bind
|
||||
* the global objects available from the PipeWire server
|
||||
* \param version the client version
|
||||
* \param user_data_size extra size
|
||||
*/
|
||||
struct pw_registry_proxy * (*get_registry) (void *object, uint32_t version,
|
||||
size_t user_data_size);
|
||||
|
||||
/**
|
||||
* Create a new object on the PipeWire server from a factory.
|
||||
*
|
||||
* \param factory_name the factory name to use
|
||||
* \param type the interface to bind to
|
||||
* \param version the version of the interface
|
||||
* \param props extra properties
|
||||
* \param user_data_size extra size
|
||||
*/
|
||||
void * (*create_object) (void *object,
|
||||
const char *factory_name,
|
||||
uint32_t type,
|
||||
uint32_t version,
|
||||
const struct spa_dict *props,
|
||||
size_t user_data_size);
|
||||
/**
|
||||
* Destroy an resource
|
||||
*
|
||||
* Destroy the server resource for the given proxy.
|
||||
*
|
||||
* \param obj the proxy to destroy
|
||||
*/
|
||||
int (*destroy) (void *object, void *proxy);
|
||||
};
|
||||
|
||||
#define pw_core_proxy_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)o, \
|
||||
struct pw_core_proxy_methods, _res, \
|
||||
method, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
#define pw_core_proxy_add_listener(c,...) pw_core_proxy_method(c,add_listener,0,__VA_ARGS__)
|
||||
#define pw_core_proxy_hello(c,...) pw_core_proxy_method(c,hello,0,__VA_ARGS__)
|
||||
#define pw_core_proxy_sync(c,...) pw_core_proxy_method(c,sync,0,__VA_ARGS__)
|
||||
#define pw_core_proxy_pong(c,...) pw_core_proxy_method(c,pong,0,__VA_ARGS__)
|
||||
#define pw_core_proxy_error(c,...) pw_core_proxy_method(c,error,0,__VA_ARGS__)
|
||||
|
||||
static inline int
|
||||
pw_core_proxy_errorv(struct pw_core_proxy *core, uint32_t id, int seq,
|
||||
int res, const char *message, va_list args)
|
||||
{
|
||||
char buffer[1024];
|
||||
vsnprintf(buffer, sizeof(buffer), message, args);
|
||||
buffer[1023] = '\0';
|
||||
return pw_core_proxy_error(core, id, seq, res, buffer);
|
||||
}
|
||||
|
||||
static inline int
|
||||
pw_core_proxy_errorf(struct pw_core_proxy *core, uint32_t id, int seq,
|
||||
int res, const char *message, ...)
|
||||
{
|
||||
va_list args;
|
||||
int r;
|
||||
va_start(args, message);
|
||||
r = pw_core_proxy_errorv(core, id, seq, res, message, args);
|
||||
va_end(args);
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline struct pw_registry_proxy *
|
||||
pw_core_proxy_get_registry(struct pw_core_proxy *core, uint32_t version, size_t user_data_size)
|
||||
{
|
||||
struct pw_registry_proxy *res = NULL;
|
||||
spa_interface_call_res((struct spa_interface*)core,
|
||||
struct pw_core_proxy_methods, res,
|
||||
get_registry, 0, version, user_data_size);
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline void *
|
||||
pw_core_proxy_create_object(struct pw_core_proxy *core,
|
||||
const char *factory_name,
|
||||
uint32_t type,
|
||||
uint32_t version,
|
||||
const struct spa_dict *props,
|
||||
size_t user_data_size)
|
||||
{
|
||||
void *res = NULL;
|
||||
spa_interface_call_res((struct spa_interface*)core,
|
||||
struct pw_core_proxy_methods, res,
|
||||
create_object, 0, factory_name,
|
||||
type, version, props, user_data_size);
|
||||
return res;
|
||||
}
|
||||
|
||||
#define pw_core_proxy_destroy(c,...) pw_core_proxy_method(c,destroy,0,__VA_ARGS__)
|
||||
|
||||
/** \page page_registry Registry
|
||||
*
|
||||
* \section page_registry_overview Overview
|
||||
*
|
||||
* The registry object is a singleton object that keeps track of
|
||||
* global objects on the PipeWire instance. See also \ref page_global.
|
||||
*
|
||||
* Global objects typically represent an actual object in PipeWire
|
||||
* (for example, a module or node) or they are singleton
|
||||
* objects such as the core.
|
||||
*
|
||||
* When a client creates a registry object, the registry object
|
||||
* will emit a global event for each global currently in the
|
||||
* registry. Globals come and go as a result of device hotplugs or
|
||||
* reconfiguration or other events, and the registry will send out
|
||||
* global and global_remove events to keep the client up to date
|
||||
* with the changes. To mark the end of the initial burst of
|
||||
* events, the client can use the pw_core.sync methosd immediately
|
||||
* after calling pw_core.get_registry.
|
||||
*
|
||||
* A client can bind to a global object by using the bind
|
||||
* request. This creates a client-side proxy that lets the object
|
||||
* emit events to the client and lets the client invoke methods on
|
||||
* the object. See \ref page_proxy
|
||||
*
|
||||
* Clients can also change the permissions of the global objects that
|
||||
* it can see. This is interesting when you want to configure a
|
||||
* pipewire session before handing it to another application. You
|
||||
* can, for example, hide certain existing or new objects or limit
|
||||
* the access permissions on an object.
|
||||
*/
|
||||
|
||||
#define PW_REGISTRY_PROXY_EVENT_GLOBAL 0
|
||||
#define PW_REGISTRY_PROXY_EVENT_GLOBAL_REMOVE 1
|
||||
#define PW_REGISTRY_PROXY_EVENT_NUM 2
|
||||
|
||||
/** Registry events */
|
||||
struct pw_registry_proxy_events {
|
||||
#define PW_VERSION_REGISTRY_PROXY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify of a new global object
|
||||
*
|
||||
* The registry emits this event when a new global object is
|
||||
* available.
|
||||
*
|
||||
* \param id the global object id
|
||||
* \param permissions the permissions of the object
|
||||
* \param type the type of the interface
|
||||
* \param version the version of the interface
|
||||
* \param props extra properties of the global
|
||||
*/
|
||||
void (*global) (void *object, uint32_t id,
|
||||
uint32_t permissions, uint32_t type, uint32_t version,
|
||||
const struct spa_dict *props);
|
||||
/**
|
||||
* Notify of a global object removal
|
||||
*
|
||||
* Emited when a global object was removed from the registry.
|
||||
* If the client has any bindings to the global, it should destroy
|
||||
* those.
|
||||
*
|
||||
* \param id the id of the global that was removed
|
||||
*/
|
||||
void (*global_remove) (void *object, uint32_t id);
|
||||
};
|
||||
|
||||
#define PW_REGISTRY_PROXY_METHOD_ADD_LISTENER 0
|
||||
#define PW_REGISTRY_PROXY_METHOD_BIND 1
|
||||
#define PW_REGISTRY_PROXY_METHOD_DESTROY 2
|
||||
#define PW_REGISTRY_PROXY_METHOD_NUM 3
|
||||
|
||||
/** Registry methods */
|
||||
struct pw_registry_proxy_methods {
|
||||
#define PW_VERSION_REGISTRY_PROXY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_registry_proxy_events *events,
|
||||
void *data);
|
||||
/**
|
||||
* Bind to a global object
|
||||
*
|
||||
* Bind to the global object with \a id and use the client proxy
|
||||
* with new_id as the proxy. After this call, methods can be
|
||||
* send to the remote global object and events can be received
|
||||
*
|
||||
* \param id the global id to bind to
|
||||
* \param type the interface type to bind to
|
||||
* \param version the interface version to use
|
||||
* \returns the new object
|
||||
*/
|
||||
void * (*bind) (void *object, uint32_t id, uint32_t type, uint32_t version,
|
||||
size_t use_data_size);
|
||||
|
||||
/**
|
||||
* Attempt to destroy a global object
|
||||
*
|
||||
* Try to destroy the global object.
|
||||
*
|
||||
* \param id the global id to destroy
|
||||
*/
|
||||
int (*destroy) (void *object, uint32_t id);
|
||||
};
|
||||
|
||||
#define pw_registry_proxy_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)o, \
|
||||
struct pw_registry_proxy_methods, _res, \
|
||||
method, version, ##__VA_ARGS__); \
|
||||
_res; \
|
||||
})
|
||||
|
||||
/** Registry */
|
||||
#define pw_registry_proxy_add_listener(p,...) pw_registry_proxy_method(p,add_listener,0,__VA_ARGS__)
|
||||
|
||||
static inline void *
|
||||
pw_registry_proxy_bind(struct pw_registry_proxy *registry,
|
||||
uint32_t id, uint32_t type, uint32_t version,
|
||||
size_t user_data_size)
|
||||
{
|
||||
void *res = NULL;
|
||||
spa_interface_call_res((struct spa_interface*)registry,
|
||||
struct pw_registry_proxy_methods, res,
|
||||
bind, 0, id, type, version, user_data_size);
|
||||
return res;
|
||||
}
|
||||
|
||||
#define pw_registry_proxy_destroy(p,...) pw_registry_proxy_method(p,destroy,0,__VA_ARGS__)
|
||||
|
||||
|
||||
#define PW_MODULE_PROXY_EVENT_INFO 0
|
||||
#define PW_MODULE_PROXY_EVENT_NUM 1
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include "pipewire/pipewire.h"
|
||||
|
||||
#include "pipewire/core-proxy.h"
|
||||
#include "pipewire/core.h"
|
||||
|
||||
SPA_EXPORT
|
||||
const char *pw_node_state_as_string(enum pw_node_state state)
|
||||
|
|
|
@ -76,28 +76,6 @@ const char * pw_link_state_as_string(enum pw_link_state state);
|
|||
* about the object in the PipeWire server
|
||||
*/
|
||||
|
||||
/** The core information. Extra information can be added in later versions \memberof pw_introspect */
|
||||
struct pw_core_info {
|
||||
uint32_t id; /**< id of the global */
|
||||
uint32_t cookie; /**< a random cookie for identifying this instance of PipeWire */
|
||||
const char *user_name; /**< name of the user that started the core */
|
||||
const char *host_name; /**< name of the machine the core is running on */
|
||||
const char *version; /**< version of the core */
|
||||
const char *name; /**< name of the core */
|
||||
#define PW_CORE_CHANGE_MASK_PROPS (1 << 0)
|
||||
#define PW_CORE_CHANGE_MASK_ALL ((1 << 1)-1)
|
||||
uint64_t change_mask; /**< bitfield of changed fields since last call */
|
||||
struct spa_dict *props; /**< extra properties */
|
||||
};
|
||||
|
||||
/** Update and existing \ref pw_core_info with \a update \memberof pw_introspect */
|
||||
struct pw_core_info *
|
||||
pw_core_info_update(struct pw_core_info *info,
|
||||
const struct pw_core_info *update);
|
||||
|
||||
/** Free a \ref pw_core_info \memberof pw_introspect */
|
||||
void pw_core_info_free(struct pw_core_info *info);
|
||||
|
||||
/** The module information. Extra information can be added in later versions \memberof pw_introspect */
|
||||
struct pw_module_info {
|
||||
uint32_t id; /**< id of the global */
|
||||
|
|
|
@ -26,7 +26,7 @@ pipewire_headers = [
|
|||
'properties.h',
|
||||
'protocol.h',
|
||||
'proxy.h',
|
||||
'core-proxy.h',
|
||||
'core.h',
|
||||
'resource.h',
|
||||
'stream.h',
|
||||
'thread-loop.h',
|
||||
|
@ -58,7 +58,7 @@ pipewire_sources = [
|
|||
'properties.c',
|
||||
'protocol.c',
|
||||
'proxy.c',
|
||||
'core-proxy.c',
|
||||
'core.c',
|
||||
'resource.c',
|
||||
'stream.c',
|
||||
'thread-loop.c',
|
||||
|
|
|
@ -47,7 +47,7 @@ extern "C" {
|
|||
#include <pipewire/port.h>
|
||||
#include <pipewire/properties.h>
|
||||
#include <pipewire/proxy.h>
|
||||
#include <pipewire/core-proxy.h>
|
||||
#include <pipewire/core.h>
|
||||
#include <pipewire/resource.h>
|
||||
#include <pipewire/stream.h>
|
||||
#include <pipewire/thread-loop.h>
|
||||
|
|
|
@ -173,7 +173,7 @@ struct pw_global {
|
|||
#define pw_context_emit_global_added(c,g) pw_context_emit(c, global_added, 0, g)
|
||||
#define pw_context_emit_global_removed(c,g) pw_context_emit(c, global_removed, 0, g)
|
||||
|
||||
#define pw_core_resource(r,m,v,...) pw_resource_call(r, struct pw_core_proxy_events, m, v, ##__VA_ARGS__)
|
||||
#define pw_core_resource(r,m,v,...) pw_resource_call(r, struct pw_core_events, m, v, ##__VA_ARGS__)
|
||||
#define pw_core_resource_info(r,...) pw_core_resource(r,info,0,__VA_ARGS__)
|
||||
#define pw_core_resource_done(r,...) pw_core_resource(r,done,0,__VA_ARGS__)
|
||||
#define pw_core_resource_ping(r,...) pw_core_resource(r,ping,0,__VA_ARGS__)
|
||||
|
@ -221,7 +221,7 @@ struct pw_context {
|
|||
struct pw_map globals; /**< map of globals */
|
||||
|
||||
struct spa_list protocol_list; /**< list of protocols */
|
||||
struct spa_list core_proxy_list; /**< list of remote connections */
|
||||
struct spa_list core_list; /**< list of core connections */
|
||||
struct spa_list registry_resource_list; /**< list of registry resources */
|
||||
struct spa_list module_list; /**< list of modules */
|
||||
struct spa_list device_list; /**< list of devices */
|
||||
|
@ -713,7 +713,7 @@ struct pw_resource {
|
|||
struct pw_proxy {
|
||||
struct spa_interface impl; /**< object implementation */
|
||||
|
||||
struct pw_core_proxy *core_proxy; /**< the owner core_proxy of this proxy */
|
||||
struct pw_core *core; /**< the owner core of this proxy */
|
||||
|
||||
uint32_t id; /**< client side id */
|
||||
uint32_t type; /**< type of the interface */
|
||||
|
@ -732,17 +732,17 @@ struct pw_proxy {
|
|||
void *user_data; /**< extra user data */
|
||||
};
|
||||
|
||||
struct pw_core_proxy {
|
||||
struct pw_core {
|
||||
struct pw_proxy proxy;
|
||||
|
||||
struct pw_context *context; /**< context */
|
||||
struct spa_list link; /**< link in context core_proxy_list */
|
||||
struct pw_context *context; /**< context */
|
||||
struct spa_list link; /**< link in context core_list */
|
||||
struct pw_properties *properties; /**< extra properties */
|
||||
|
||||
struct pw_mempool *pool; /**< memory pool */
|
||||
struct pw_core_proxy *core_proxy; /**< proxy for the core object */
|
||||
struct pw_core *core; /**< proxy for the core object */
|
||||
struct spa_hook core_listener;
|
||||
struct spa_hook core_proxy_listener;
|
||||
struct spa_hook proxy_core_listener;
|
||||
|
||||
struct pw_map objects; /**< map of client side proxy objects
|
||||
* indexed with the client id */
|
||||
|
@ -773,10 +773,10 @@ struct pw_core_proxy {
|
|||
|
||||
|
||||
struct pw_stream {
|
||||
struct pw_core_proxy *core_proxy; /**< the owner core_proxy */
|
||||
struct pw_core *core; /**< the owner core */
|
||||
struct spa_hook core_listener;
|
||||
|
||||
struct spa_list link; /**< link in the core_proxy */
|
||||
struct spa_list link; /**< link in the core */
|
||||
|
||||
char *name; /**< the name of the stream */
|
||||
struct pw_properties *properties; /**< properties of the stream */
|
||||
|
@ -809,7 +809,7 @@ struct pw_stream {
|
|||
|
||||
|
||||
struct pw_filter {
|
||||
struct pw_core_proxy *core_proxy; /**< the owner core proxy */
|
||||
struct pw_core *core; /**< the owner core proxy */
|
||||
struct spa_hook core_listener;
|
||||
|
||||
struct spa_list link; /**< link in the core proxy */
|
||||
|
|
|
@ -44,7 +44,7 @@ struct pw_protocol_client {
|
|||
struct spa_list link; /**< link in protocol client_list */
|
||||
struct pw_protocol *protocol; /**< the owner protocol */
|
||||
|
||||
struct pw_core_proxy *core_proxy;
|
||||
struct pw_core *core;
|
||||
|
||||
int (*connect) (struct pw_protocol_client *client,
|
||||
const struct spa_dict *props,
|
||||
|
|
|
@ -48,7 +48,7 @@ int pw_proxy_init(struct pw_proxy *proxy, uint32_t type, uint32_t version)
|
|||
proxy->version = version;
|
||||
proxy->bound_id = SPA_ID_INVALID;
|
||||
|
||||
proxy->id = pw_map_insert_new(&proxy->core_proxy->objects, proxy);
|
||||
proxy->id = pw_map_insert_new(&proxy->core->objects, proxy);
|
||||
if (proxy->id == SPA_ID_INVALID) {
|
||||
res = -errno;
|
||||
pw_log_error(NAME" %p: can't allocate new id: %m", proxy);
|
||||
|
@ -67,7 +67,7 @@ int pw_proxy_init(struct pw_proxy *proxy, uint32_t type, uint32_t version)
|
|||
return 0;
|
||||
|
||||
error_clean:
|
||||
pw_map_remove(&proxy->core_proxy->objects, proxy->id);
|
||||
pw_map_remove(&proxy->core->objects, proxy->id);
|
||||
error:
|
||||
return res;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ error:
|
|||
* This function creates a new proxy object with the supplied id and type. The
|
||||
* proxy object will have an id assigned from the client id space.
|
||||
*
|
||||
* \sa pw_core_proxy
|
||||
* \sa pw_core
|
||||
*
|
||||
* \memberof pw_proxy
|
||||
*/
|
||||
|
@ -100,7 +100,7 @@ struct pw_proxy *pw_proxy_new(struct pw_proxy *factory,
|
|||
return NULL;
|
||||
|
||||
this = &impl->this;
|
||||
this->core_proxy = factory->core_proxy;
|
||||
this->core = factory->core;
|
||||
|
||||
if ((res = pw_proxy_init(this, type, version)) < 0)
|
||||
goto error_init;
|
||||
|
@ -111,7 +111,7 @@ struct pw_proxy *pw_proxy_new(struct pw_proxy *factory,
|
|||
pw_log_debug(NAME" %p: new %u type %s/%d core-proxy:%p, marshal:%p",
|
||||
this, this->id,
|
||||
spa_debug_type_find_name(pw_type_info(), type), version,
|
||||
this->core_proxy, this->marshal);
|
||||
this->core, this->marshal);
|
||||
return this;
|
||||
|
||||
error_init:
|
||||
|
@ -123,10 +123,10 @@ error_init:
|
|||
SPA_EXPORT
|
||||
int pw_proxy_install_marshal(struct pw_proxy *this, bool implementor)
|
||||
{
|
||||
struct pw_core_proxy *core_proxy = this->core_proxy;
|
||||
struct pw_core *core = this->core;
|
||||
const struct pw_protocol_marshal *marshal;
|
||||
|
||||
marshal = pw_protocol_get_marshal(core_proxy->conn->protocol,
|
||||
marshal = pw_protocol_get_marshal(core->conn->protocol,
|
||||
this->type, this->version,
|
||||
implementor ? PW_PROTOCOL_MARSHAL_FLAG_IMPL : 0);
|
||||
if (marshal == NULL)
|
||||
|
@ -175,15 +175,15 @@ uint32_t pw_proxy_get_type(struct pw_proxy *proxy, uint32_t *version)
|
|||
}
|
||||
|
||||
SPA_EXPORT
|
||||
struct pw_core_proxy *pw_proxy_get_core_proxy(struct pw_proxy *proxy)
|
||||
struct pw_core *pw_proxy_get_core(struct pw_proxy *proxy)
|
||||
{
|
||||
return proxy->core_proxy;
|
||||
return proxy->core;
|
||||
}
|
||||
|
||||
SPA_EXPORT
|
||||
struct pw_protocol *pw_proxy_get_protocol(struct pw_proxy *proxy)
|
||||
{
|
||||
return proxy->core_proxy->conn->protocol;
|
||||
return proxy->core->conn->protocol;
|
||||
}
|
||||
|
||||
SPA_EXPORT
|
||||
|
@ -208,7 +208,7 @@ void pw_proxy_add_object_listener(struct pw_proxy *proxy,
|
|||
*
|
||||
* \param proxy Proxy object to destroy
|
||||
*
|
||||
* \note This is normally called by \ref pw_core_proxy when the server
|
||||
* \note This is normally called by \ref pw_core when the server
|
||||
* decides to destroy the server side object
|
||||
* \memberof pw_proxy
|
||||
*/
|
||||
|
@ -222,16 +222,16 @@ void pw_proxy_destroy(struct pw_proxy *proxy)
|
|||
if (!proxy->removed) {
|
||||
/* if the server did not remove this proxy, remove ourselves
|
||||
* from the proxy objects and schedule a destroy. */
|
||||
if (proxy->core_proxy && !proxy->core_proxy->destroyed) {
|
||||
if (proxy->core && !proxy->core->destroyed) {
|
||||
proxy->zombie = true;
|
||||
pw_core_proxy_destroy(proxy->core_proxy, proxy);
|
||||
pw_core_destroy(proxy->core, proxy);
|
||||
} else {
|
||||
proxy->removed = true;
|
||||
}
|
||||
}
|
||||
if (proxy->removed) {
|
||||
if (proxy->core_proxy)
|
||||
pw_map_remove(&proxy->core_proxy->objects, proxy->id);
|
||||
if (proxy->core)
|
||||
pw_map_remove(&proxy->core->objects, proxy->id);
|
||||
|
||||
pw_proxy_unref(proxy);
|
||||
}
|
||||
|
@ -257,10 +257,10 @@ SPA_EXPORT
|
|||
int pw_proxy_sync(struct pw_proxy *proxy, int seq)
|
||||
{
|
||||
int res = -EIO;
|
||||
struct pw_core_proxy *core_proxy = proxy->core_proxy;
|
||||
struct pw_core *core = proxy->core;
|
||||
|
||||
if (core_proxy != NULL) {
|
||||
res = pw_core_proxy_sync(core_proxy, proxy->id, seq);
|
||||
if (core != NULL) {
|
||||
res = pw_core_sync(core, proxy->id, seq);
|
||||
pw_log_debug(NAME" %p: %u seq:%d sync %u", proxy, proxy->id, seq, res);
|
||||
}
|
||||
return res;
|
||||
|
@ -271,12 +271,12 @@ int pw_proxy_errorf(struct pw_proxy *proxy, int res, const char *error, ...)
|
|||
{
|
||||
va_list ap;
|
||||
int r = -EIO;
|
||||
struct pw_core_proxy *core_proxy = proxy->core_proxy;
|
||||
struct pw_core *core = proxy->core;
|
||||
|
||||
va_start(ap, error);
|
||||
if (core_proxy != NULL)
|
||||
r = pw_core_proxy_errorv(core_proxy, proxy->id,
|
||||
core_proxy->recv_seq, res, error, ap);
|
||||
if (core != NULL)
|
||||
r = pw_core_errorv(core, proxy->id,
|
||||
core->recv_seq, res, error, ap);
|
||||
va_end(ap);
|
||||
return r;
|
||||
}
|
||||
|
@ -285,10 +285,10 @@ SPA_EXPORT
|
|||
int pw_proxy_error(struct pw_proxy *proxy, int res, const char *error)
|
||||
{
|
||||
int r = -EIO;
|
||||
struct pw_core_proxy *core_proxy = proxy->core_proxy;
|
||||
if (core_proxy != NULL)
|
||||
r = pw_core_proxy_error(core_proxy, proxy->id,
|
||||
core_proxy->recv_seq, res, error);
|
||||
struct pw_core *core = proxy->core;
|
||||
if (core != NULL)
|
||||
r = pw_core_error(core, proxy->id,
|
||||
core->recv_seq, res, error);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
@ -1009,8 +1009,8 @@ static void on_core_error(void *object, uint32_t id, int seq, int res, const cha
|
|||
}
|
||||
}
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
|
@ -1081,21 +1081,21 @@ error_cleanup:
|
|||
}
|
||||
|
||||
SPA_EXPORT
|
||||
struct pw_stream * pw_stream_new(struct pw_core_proxy *core_proxy, const char *name,
|
||||
struct pw_stream * pw_stream_new(struct pw_core *core, const char *name,
|
||||
struct pw_properties *props)
|
||||
{
|
||||
struct stream *impl;
|
||||
struct pw_stream *this;
|
||||
struct pw_context *context = core_proxy->context;
|
||||
struct pw_context *context = core->context;
|
||||
|
||||
impl = stream_new(context, name, props, core_proxy->properties);
|
||||
impl = stream_new(context, name, props, core->properties);
|
||||
if (impl == NULL)
|
||||
return NULL;
|
||||
|
||||
this = &impl->this;
|
||||
this->core_proxy = core_proxy;
|
||||
spa_list_append(&core_proxy->stream_list, &this->link);
|
||||
pw_core_proxy_add_listener(core_proxy,
|
||||
this->core = core;
|
||||
spa_list_append(&core->stream_list, &this->link);
|
||||
pw_core_add_listener(core,
|
||||
&this->core_listener, &core_events, this);
|
||||
|
||||
return this;
|
||||
|
@ -1171,10 +1171,10 @@ void pw_stream_destroy(struct pw_stream *stream)
|
|||
|
||||
pw_stream_disconnect(stream);
|
||||
|
||||
if (stream->core_proxy) {
|
||||
if (stream->core) {
|
||||
spa_hook_remove(&stream->core_listener);
|
||||
spa_list_remove(&stream->link);
|
||||
stream->core_proxy = NULL;
|
||||
stream->core = NULL;
|
||||
}
|
||||
|
||||
clear_params(impl, SPA_ID_INVALID);
|
||||
|
@ -1244,9 +1244,9 @@ int pw_stream_update_properties(struct pw_stream *stream, const struct spa_dict
|
|||
}
|
||||
|
||||
SPA_EXPORT
|
||||
struct pw_core_proxy *pw_stream_get_core_proxy(struct pw_stream *stream)
|
||||
struct pw_core *pw_stream_get_core(struct pw_stream *stream)
|
||||
{
|
||||
return stream->core_proxy;
|
||||
return stream->core;
|
||||
}
|
||||
|
||||
static void add_params(struct stream *impl)
|
||||
|
@ -1385,15 +1385,15 @@ pw_stream_connect(struct pw_stream *stream,
|
|||
direction == PW_DIRECTION_INPUT ? "Input" : "Output",
|
||||
get_media_class(impl));
|
||||
|
||||
if (stream->core_proxy == NULL) {
|
||||
stream->core_proxy = pw_context_connect(impl->context,
|
||||
if (stream->core == NULL) {
|
||||
stream->core = pw_context_connect(impl->context,
|
||||
pw_properties_copy(stream->properties), 0);
|
||||
if (stream->core_proxy == NULL) {
|
||||
if (stream->core == NULL) {
|
||||
res = -errno;
|
||||
goto error_connect;
|
||||
}
|
||||
spa_list_append(&stream->core_proxy->stream_list, &stream->link);
|
||||
pw_core_proxy_add_listener(stream->core_proxy,
|
||||
spa_list_append(&stream->core->stream_list, &stream->link);
|
||||
pw_core_add_listener(stream->core,
|
||||
&stream->core_listener, &core_events, stream);
|
||||
impl->free_proxy = true;
|
||||
}
|
||||
|
@ -1441,7 +1441,7 @@ pw_stream_connect(struct pw_stream *stream,
|
|||
}
|
||||
|
||||
pw_log_debug(NAME" %p: export node %p", stream, impl->node);
|
||||
stream->proxy = pw_core_proxy_export(stream->core_proxy,
|
||||
stream->proxy = pw_core_export(stream->core,
|
||||
PW_TYPE_INTERFACE_Node, NULL, impl->node, 0);
|
||||
if (stream->proxy == NULL) {
|
||||
res = -errno;
|
||||
|
@ -1494,8 +1494,8 @@ int pw_stream_disconnect(struct pw_stream *stream)
|
|||
impl->free_proxy = false;
|
||||
spa_hook_remove(&stream->core_listener);
|
||||
spa_list_remove(&stream->link);
|
||||
pw_core_proxy_disconnect(stream->core_proxy);
|
||||
stream->core_proxy = NULL;
|
||||
pw_core_disconnect(stream->core);
|
||||
stream->core = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ extern "C" {
|
|||
*
|
||||
* For more complicated nodes such as filters or ports with multiple
|
||||
* inputs and/or outputs you will need to use the pw_filter or make
|
||||
* a pw_node yourself and export it with \ref pw_core_proxy_export.
|
||||
* a pw_node yourself and export it with \ref pw_core_export.
|
||||
*
|
||||
* \section sec_create Create
|
||||
*
|
||||
|
@ -152,7 +152,7 @@ struct pw_stream;
|
|||
#include <spa/buffer/buffer.h>
|
||||
#include <spa/param/param.h>
|
||||
|
||||
#include <pipewire/core-proxy.h>
|
||||
#include <pipewire/core.h>
|
||||
|
||||
/** \enum pw_stream_state The state of a stream \memberof pw_stream */
|
||||
enum pw_stream_state {
|
||||
|
@ -247,7 +247,7 @@ enum pw_stream_flags {
|
|||
/** Create a new unconneced \ref pw_stream \memberof pw_stream
|
||||
* \return a newly allocated \ref pw_stream */
|
||||
struct pw_stream *
|
||||
pw_stream_new(struct pw_core_proxy *proxy, /**< a \ref pw_core_proxy */
|
||||
pw_stream_new(struct pw_core *core, /**< a \ref pw_core */
|
||||
const char *name, /**< a stream media name */
|
||||
struct pw_properties *props /**< stream properties, ownership is taken */);
|
||||
|
||||
|
@ -270,7 +270,7 @@ enum pw_stream_state pw_stream_get_state(struct pw_stream *stream, const char **
|
|||
|
||||
const char *pw_stream_get_name(struct pw_stream *stream);
|
||||
|
||||
struct pw_core_proxy *pw_stream_get_core_proxy(struct pw_stream *stream);
|
||||
struct pw_core *pw_stream_get_core(struct pw_stream *stream);
|
||||
|
||||
const struct pw_properties *pw_stream_get_properties(struct pw_stream *stream);
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ static void test_create(void)
|
|||
spa_assert(pw_context_find_global(context, 0) == global);
|
||||
spa_assert(pw_global_get_context(global) == context);
|
||||
spa_assert(pw_global_get_type(global) == PW_TYPE_INTERFACE_Core);
|
||||
spa_assert(pw_global_get_version(global) == PW_VERSION_CORE_PROXY);
|
||||
spa_assert(pw_global_get_version(global) == PW_VERSION_CORE);
|
||||
spa_assert(pw_global_get_id(global) == 0);
|
||||
spa_assert(pw_global_get_object(global) == (void*)context);
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include <pipewire/properties.h>
|
||||
#include <pipewire/protocol.h>
|
||||
#include <pipewire/proxy.h>
|
||||
#include <pipewire/core-proxy.h>
|
||||
#include <pipewire/core.h>
|
||||
#include <pipewire/resource.h>
|
||||
#include <pipewire/stream.h>
|
||||
#include <pipewire/thread-loop.h>
|
||||
|
|
|
@ -33,13 +33,13 @@ do { \
|
|||
|
||||
static void test_core_abi(void)
|
||||
{
|
||||
struct pw_core_proxy_methods m;
|
||||
struct pw_core_proxy_events e;
|
||||
struct pw_core_methods m;
|
||||
struct pw_core_events e;
|
||||
struct {
|
||||
uint32_t version;
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_core_proxy_events *events,
|
||||
const struct pw_core_events *events,
|
||||
void *data);
|
||||
int (*hello) (void *object, uint32_t version);
|
||||
int (*sync) (void *object, uint32_t id, int seq);
|
||||
|
@ -54,7 +54,7 @@ static void test_core_abi(void)
|
|||
const struct spa_dict *props,
|
||||
size_t user_data_size);
|
||||
int (*destroy) (void *object, void *proxy);
|
||||
} methods = { PW_VERSION_CORE_PROXY_METHODS, };
|
||||
} methods = { PW_VERSION_CORE_METHODS, };
|
||||
struct {
|
||||
uint32_t version;
|
||||
void (*info) (void *object, const struct pw_core_info *info);
|
||||
|
@ -65,7 +65,7 @@ static void test_core_abi(void)
|
|||
void (*bound_id) (void *object, uint32_t id, uint32_t global_id);
|
||||
void (*add_mem) (void *object, uint32_t id, uint32_t type, int fd, uint32_t flags);
|
||||
void (*remove_mem) (void *object, uint32_t id);
|
||||
} events = { PW_VERSION_CORE_PROXY_EVENTS, };
|
||||
} events = { PW_VERSION_CORE_EVENTS, };
|
||||
|
||||
TEST_FUNC(m, methods, version);
|
||||
TEST_FUNC(m, methods, add_listener);
|
||||
|
@ -76,7 +76,7 @@ static void test_core_abi(void)
|
|||
TEST_FUNC(m, methods, get_registry);
|
||||
TEST_FUNC(m, methods, create_object);
|
||||
TEST_FUNC(m, methods, destroy);
|
||||
spa_assert(PW_VERSION_CORE_PROXY_METHODS == 0);
|
||||
spa_assert(PW_VERSION_CORE_METHODS == 0);
|
||||
spa_assert(sizeof(m) == sizeof(methods));
|
||||
|
||||
TEST_FUNC(e, events, version);
|
||||
|
@ -88,7 +88,7 @@ static void test_core_abi(void)
|
|||
TEST_FUNC(e, events, bound_id);
|
||||
TEST_FUNC(e, events, add_mem);
|
||||
TEST_FUNC(e, events, remove_mem);
|
||||
spa_assert(PW_VERSION_CORE_PROXY_EVENTS == 0);
|
||||
spa_assert(PW_VERSION_CORE_EVENTS == 0);
|
||||
spa_assert(sizeof(e) == sizeof(events));
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ static void test_create(void)
|
|||
{
|
||||
struct pw_main_loop *loop;
|
||||
struct pw_context *context;
|
||||
struct pw_core_proxy *core_proxy;
|
||||
struct pw_core *core;
|
||||
struct pw_stream *stream;
|
||||
struct pw_stream_events stream_events = stream_events_error;
|
||||
struct spa_hook listener = { 0, };
|
||||
|
@ -147,9 +147,9 @@ static void test_create(void)
|
|||
PW_KEY_CORE_DAEMON, "1",
|
||||
NULL), 12);
|
||||
spa_assert(context != NULL);
|
||||
core_proxy = pw_context_connect_self(context, NULL, 0);
|
||||
spa_assert(core_proxy != NULL);
|
||||
stream = pw_stream_new(core_proxy, "test", NULL);
|
||||
core = pw_context_connect_self(context, NULL, 0);
|
||||
spa_assert(core != NULL);
|
||||
stream = pw_stream_new(core, "test", NULL);
|
||||
spa_assert(stream != NULL);
|
||||
pw_stream_add_listener(stream, &listener, &stream_events, stream);
|
||||
|
||||
|
@ -186,7 +186,7 @@ static void test_properties(void)
|
|||
{
|
||||
struct pw_main_loop *loop;
|
||||
struct pw_context *context;
|
||||
struct pw_core_proxy *core_proxy;
|
||||
struct pw_core *core;
|
||||
const struct pw_properties *props;
|
||||
struct pw_stream *stream;
|
||||
struct pw_stream_events stream_events = stream_events_error;
|
||||
|
@ -199,9 +199,9 @@ static void test_properties(void)
|
|||
PW_KEY_CORE_DAEMON, "1",
|
||||
NULL), 12);
|
||||
spa_assert(context != NULL);
|
||||
core_proxy = pw_context_connect_self(context, NULL, 0);
|
||||
spa_assert(core_proxy != NULL);
|
||||
stream = pw_stream_new(core_proxy, "test",
|
||||
core = pw_context_connect_self(context, NULL, 0);
|
||||
spa_assert(core != NULL);
|
||||
stream = pw_stream_new(core, "test",
|
||||
pw_properties_new("foo", "bar",
|
||||
"biz", "fuzz",
|
||||
NULL));
|
||||
|
|
|
@ -74,9 +74,9 @@ struct remote_data {
|
|||
|
||||
int prompt_pending;
|
||||
|
||||
struct pw_core_proxy *core_proxy;
|
||||
struct pw_core *core;
|
||||
struct spa_hook core_listener;
|
||||
struct spa_hook core_proxy_listener;
|
||||
struct spa_hook proxy_core_listener;
|
||||
struct pw_registry_proxy *registry_proxy;
|
||||
struct spa_hook registry_listener;
|
||||
|
||||
|
@ -383,8 +383,8 @@ static void on_core_error(void *_data, uint32_t id, int seq, int res, const char
|
|||
}
|
||||
}
|
||||
|
||||
static const struct pw_core_proxy_events remote_core_events = {
|
||||
PW_VERSION_CORE_PROXY_EVENTS,
|
||||
static const struct pw_core_events remote_core_events = {
|
||||
PW_VERSION_CORE_EVENTS,
|
||||
.info = on_core_info,
|
||||
.done = on_core_done,
|
||||
.error = on_core_error,
|
||||
|
@ -405,7 +405,7 @@ static void on_core_destroy(void *_data)
|
|||
free(rd->name);
|
||||
}
|
||||
|
||||
static const struct pw_proxy_events core_proxy_events = {
|
||||
static const struct pw_proxy_events proxy_core_events = {
|
||||
PW_VERSION_PROXY_EVENTS,
|
||||
.destroy = on_core_destroy,
|
||||
};
|
||||
|
@ -415,41 +415,41 @@ static bool do_connect(struct data *data, const char *cmd, char *args, char **er
|
|||
char *a[1];
|
||||
int n;
|
||||
struct pw_properties *props = NULL;
|
||||
struct pw_core_proxy *core_proxy;
|
||||
struct pw_core *core;
|
||||
struct remote_data *rd;
|
||||
|
||||
n = pw_split_ip(args, WHITESPACE, 1, a);
|
||||
if (n == 1) {
|
||||
props = pw_properties_new(PW_KEY_REMOTE_NAME, a[0], NULL);
|
||||
}
|
||||
core_proxy = pw_context_connect(data->context, props, sizeof(struct remote_data));
|
||||
if (core_proxy == NULL) {
|
||||
core = pw_context_connect(data->context, props, sizeof(struct remote_data));
|
||||
if (core == NULL) {
|
||||
asprintf(error, "failed to connect: %m");
|
||||
return false;
|
||||
}
|
||||
|
||||
rd = pw_proxy_get_user_data((struct pw_proxy*)core_proxy);
|
||||
rd->core_proxy = core_proxy;
|
||||
rd = pw_proxy_get_user_data((struct pw_proxy*)core);
|
||||
rd->core = core;
|
||||
rd->data = data;
|
||||
pw_map_init(&rd->globals, 64, 16);
|
||||
rd->id = pw_map_insert_new(&data->vars, rd);
|
||||
spa_list_append(&data->remotes, &rd->link);
|
||||
|
||||
fprintf(stdout, "%d = @remote:%p\n", rd->id, rd->core_proxy);
|
||||
fprintf(stdout, "%d = @remote:%p\n", rd->id, rd->core);
|
||||
data->current = rd;
|
||||
|
||||
pw_core_proxy_add_listener(rd->core_proxy,
|
||||
pw_core_add_listener(rd->core,
|
||||
&rd->core_listener,
|
||||
&remote_core_events, rd);
|
||||
pw_proxy_add_listener((struct pw_proxy*)rd->core_proxy,
|
||||
&rd->core_proxy_listener,
|
||||
&core_proxy_events, rd);
|
||||
rd->registry_proxy = pw_core_proxy_get_registry(rd->core_proxy,
|
||||
pw_proxy_add_listener((struct pw_proxy*)rd->core,
|
||||
&rd->proxy_core_listener,
|
||||
&proxy_core_events, rd);
|
||||
rd->registry_proxy = pw_core_get_registry(rd->core,
|
||||
PW_VERSION_REGISTRY_PROXY, 0);
|
||||
pw_registry_proxy_add_listener(rd->registry_proxy,
|
||||
&rd->registry_listener,
|
||||
®istry_events, rd);
|
||||
rd->prompt_pending = pw_core_proxy_sync(rd->core_proxy, 0, 0);
|
||||
rd->prompt_pending = pw_core_sync(rd->core, 0, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ static bool do_disconnect(struct data *data, const char *cmd, char *args, char *
|
|||
goto no_remote;
|
||||
|
||||
}
|
||||
pw_core_proxy_disconnect(rd->core_proxy);
|
||||
pw_core_disconnect(rd->core);
|
||||
|
||||
if (data->current == NULL) {
|
||||
if (spa_list_is_empty(&data->remotes)) {
|
||||
|
@ -490,7 +490,7 @@ static bool do_list_remotes(struct data *data, const char *cmd, char *args, char
|
|||
struct remote_data *rd;
|
||||
|
||||
spa_list_for_each(rd, &data->remotes, link)
|
||||
fprintf(stdout, "\t%d = @remote:%p '%s'\n", rd->id, rd->core_proxy, rd->name);
|
||||
fprintf(stdout, "\t%d = @remote:%p '%s'\n", rd->id, rd->core, rd->name);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -717,8 +717,8 @@ static void core_event_info(void *object, const struct pw_core_info *info)
|
|||
}
|
||||
}
|
||||
|
||||
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,
|
||||
.info = core_event_info
|
||||
};
|
||||
|
||||
|
@ -1097,7 +1097,7 @@ static bool bind_global(struct remote_data *rd, struct global *global, char **er
|
|||
switch (global->type) {
|
||||
case PW_TYPE_INTERFACE_Core:
|
||||
events = &core_events;
|
||||
client_version = PW_VERSION_CORE_PROXY;
|
||||
client_version = PW_VERSION_CORE;
|
||||
destroy = (pw_destroy_t) pw_core_info_free;
|
||||
info_func = info_core;
|
||||
break;
|
||||
|
@ -1263,7 +1263,7 @@ static bool do_create_device(struct data *data, const char *cmd, char *args, cha
|
|||
if (n == 2)
|
||||
props = parse_props(a[1]);
|
||||
|
||||
proxy = pw_core_proxy_create_object(rd->core_proxy, a[0],
|
||||
proxy = pw_core_create_object(rd->core, a[0],
|
||||
PW_TYPE_INTERFACE_Device,
|
||||
PW_VERSION_DEVICE_PROXY,
|
||||
props ? &props->dict : NULL,
|
||||
|
@ -1300,7 +1300,7 @@ static bool do_create_node(struct data *data, const char *cmd, char *args, char
|
|||
if (n == 2)
|
||||
props = parse_props(a[1]);
|
||||
|
||||
proxy = pw_core_proxy_create_object(rd->core_proxy, a[0],
|
||||
proxy = pw_core_create_object(rd->core, a[0],
|
||||
PW_TYPE_INTERFACE_Node,
|
||||
PW_VERSION_NODE_PROXY,
|
||||
props ? &props->dict : NULL,
|
||||
|
@ -1368,7 +1368,7 @@ static bool do_create_link(struct data *data, const char *cmd, char *args, char
|
|||
pw_properties_set(props, PW_KEY_LINK_INPUT_NODE, a[2]);
|
||||
pw_properties_set(props, PW_KEY_LINK_INPUT_PORT, a[3]);
|
||||
|
||||
proxy = (struct pw_proxy*)pw_core_proxy_create_object(rd->core_proxy,
|
||||
proxy = (struct pw_proxy*)pw_core_create_object(rd->core,
|
||||
"link-factory",
|
||||
PW_TYPE_INTERFACE_Link,
|
||||
PW_VERSION_LINK_PROXY,
|
||||
|
@ -1420,7 +1420,7 @@ static bool do_export_node(struct data *data, const char *cmd, char *args, char
|
|||
return false;
|
||||
}
|
||||
node = pw_global_get_object(global);
|
||||
proxy = pw_core_proxy_export(rd->core_proxy, PW_TYPE_INTERFACE_Node, NULL, node, 0);
|
||||
proxy = pw_core_export(rd->core, PW_TYPE_INTERFACE_Node, NULL, node, 0);
|
||||
|
||||
id = pw_map_insert_new(&data->vars, proxy);
|
||||
fprintf(stdout, "%d = @proxy:%d\n", id, pw_proxy_get_id((struct pw_proxy*)proxy));
|
||||
|
@ -1621,8 +1621,8 @@ static void do_input(void *data, int fd, uint32_t mask)
|
|||
pw_main_loop_quit(d->loop);
|
||||
else {
|
||||
struct remote_data *rd = d->current;
|
||||
if (rd->core_proxy)
|
||||
rd->prompt_pending = pw_core_proxy_sync(rd->core_proxy, 0, 0);
|
||||
if (rd->core)
|
||||
rd->prompt_pending = pw_core_sync(rd->core, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ struct data {
|
|||
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 pw_registry_proxy *registry_proxy;
|
||||
|
@ -664,7 +664,7 @@ static void registry_event_global(void *data, uint32_t id, uint32_t permissions,
|
|||
break;
|
||||
case PW_TYPE_INTERFACE_Core:
|
||||
/* sync to notify we are done with globals */
|
||||
pw_core_proxy_sync(d->core_proxy, 0, 0);
|
||||
pw_core_sync(d->core, 0, 0);
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
|
@ -720,8 +720,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,
|
||||
.done = on_core_done,
|
||||
.error = on_core_error,
|
||||
};
|
||||
|
@ -820,8 +820,8 @@ int main(int argc, char *argv[])
|
|||
if (remote_name)
|
||||
props = pw_properties_new(PW_KEY_REMOTE_NAME, remote_name, NULL);
|
||||
|
||||
data.core_proxy = pw_context_connect(data.context, props, 0);
|
||||
if (data.core_proxy == NULL)
|
||||
data.core = pw_context_connect(data.context, props, 0);
|
||||
if (data.core == NULL)
|
||||
return -1;
|
||||
|
||||
data.dot_str = dot_str_new();
|
||||
|
@ -830,10 +830,10 @@ int main(int argc, char *argv[])
|
|||
|
||||
spa_list_init(&data.globals);
|
||||
|
||||
pw_core_proxy_add_listener(data.core_proxy,
|
||||
pw_core_add_listener(data.core,
|
||||
&data.core_listener,
|
||||
&core_events, &data);
|
||||
data.registry_proxy = pw_core_proxy_get_registry(data.core_proxy,
|
||||
data.registry_proxy = pw_core_get_registry(data.core,
|
||||
PW_VERSION_REGISTRY_PROXY, 0);
|
||||
pw_registry_proxy_add_listener(data.registry_proxy,
|
||||
&data.registry_listener,
|
||||
|
|
|
@ -50,7 +50,7 @@ struct data {
|
|||
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 pw_registry_proxy *registry_proxy;
|
||||
|
@ -84,7 +84,7 @@ static void add_pending(struct proxy_data *pd)
|
|||
if (pd->pending_seq == 0) {
|
||||
spa_list_append(&d->pending_list, &pd->pending_link);
|
||||
}
|
||||
pd->pending_seq = pw_core_proxy_sync(d->core_proxy, 0, pd->pending_seq);
|
||||
pd->pending_seq = pw_core_sync(d->core, 0, pd->pending_seq);
|
||||
}
|
||||
|
||||
static void remove_pending(struct proxy_data *pd)
|
||||
|
@ -678,8 +678,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,
|
||||
.info = on_core_info,
|
||||
.done = on_core_done,
|
||||
.error = on_core_error,
|
||||
|
@ -716,14 +716,14 @@ int main(int argc, char *argv[])
|
|||
|
||||
spa_list_init(&data.pending_list);
|
||||
|
||||
data.core_proxy = pw_context_connect(data.context, props, 0);
|
||||
if (data.core_proxy == NULL)
|
||||
data.core = pw_context_connect(data.context, props, 0);
|
||||
if (data.core == NULL)
|
||||
return -1;
|
||||
|
||||
pw_core_proxy_add_listener(data.core_proxy,
|
||||
pw_core_add_listener(data.core,
|
||||
&data.core_listener,
|
||||
&core_events, &data);
|
||||
data.registry_proxy = pw_core_proxy_get_registry(data.core_proxy,
|
||||
data.registry_proxy = pw_core_get_registry(data.core,
|
||||
PW_VERSION_REGISTRY_PROXY, 0);
|
||||
pw_registry_proxy_add_listener(data.registry_proxy,
|
||||
&data.registry_listener,
|
||||
|
|
Loading…
Reference in a new issue