mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
pw_registry_proxy -> pw_registry
This commit is contained in:
parent
ecc6b27cd7
commit
49d736bbb7
17 changed files with 140 additions and 141 deletions
|
|
@ -236,7 +236,7 @@ struct client {
|
|||
int last_sync;
|
||||
bool error;
|
||||
|
||||
struct pw_registry_proxy *registry_proxy;
|
||||
struct pw_registry *registry;
|
||||
struct spa_hook registry_listener;
|
||||
|
||||
struct pw_client_node_proxy *node_proxy;
|
||||
|
|
@ -1980,7 +1980,7 @@ static void registry_event_global(void *data, uint32_t id,
|
|||
if (c->metadata)
|
||||
goto exit;
|
||||
|
||||
proxy = pw_registry_proxy_bind(c->registry_proxy,
|
||||
proxy = pw_registry_bind(c->registry,
|
||||
id, type, PW_VERSION_METADATA, sizeof(struct metadata));
|
||||
|
||||
c->metadata = pw_proxy_get_user_data(proxy);
|
||||
|
|
@ -2068,8 +2068,8 @@ static void registry_event_global_remove(void *object, uint32_t id)
|
|||
return;
|
||||
}
|
||||
|
||||
static const struct pw_registry_proxy_events registry_events = {
|
||||
PW_VERSION_REGISTRY_PROXY_EVENTS,
|
||||
static const struct pw_registry_events registry_events = {
|
||||
PW_VERSION_REGISTRY_EVENTS,
|
||||
.global = registry_event_global,
|
||||
.global_remove = registry_event_global_remove,
|
||||
};
|
||||
|
|
@ -2156,9 +2156,9 @@ jack_client_t * jack_client_open (const char *client_name,
|
|||
pw_core_add_listener(client->core,
|
||||
&client->core_listener,
|
||||
&core_events, client);
|
||||
client->registry_proxy = pw_core_get_registry(client->core,
|
||||
PW_VERSION_REGISTRY_PROXY, 0);
|
||||
pw_registry_proxy_add_listener(client->registry_proxy,
|
||||
client->registry = pw_core_get_registry(client->core,
|
||||
PW_VERSION_REGISTRY, 0);
|
||||
pw_registry_add_listener(client->registry,
|
||||
&client->registry_listener,
|
||||
®istry_events, client);
|
||||
|
||||
|
|
@ -3463,7 +3463,7 @@ int jack_disconnect (jack_client_t *client,
|
|||
goto exit;
|
||||
}
|
||||
|
||||
pw_registry_proxy_destroy(c->registry_proxy, l->id);
|
||||
pw_registry_destroy(c->registry, l->id);
|
||||
|
||||
res = do_sync(c);
|
||||
|
||||
|
|
@ -3488,7 +3488,7 @@ int jack_port_disconnect (jack_client_t *client, jack_port_t *port)
|
|||
spa_list_for_each(l, &c->context.links, link) {
|
||||
if (l->port_link.src == o->id ||
|
||||
l->port_link.dst == o->id) {
|
||||
pw_registry_proxy_destroy(c->registry_proxy, l->id);
|
||||
pw_registry_destroy(c->registry, l->id);
|
||||
}
|
||||
}
|
||||
res = do_sync(c);
|
||||
|
|
|
|||
|
|
@ -721,7 +721,7 @@ static int set_mask(pa_context *c, struct global *g)
|
|||
if (events) {
|
||||
pw_log_debug("bind %d", g->id);
|
||||
|
||||
g->proxy = pw_registry_proxy_bind(c->registry_proxy, g->id, g->type,
|
||||
g->proxy = pw_registry_bind(c->registry, g->id, g->type,
|
||||
client_version, 0);
|
||||
if (g->proxy == NULL)
|
||||
return -ENOMEM;
|
||||
|
|
@ -786,9 +786,9 @@ static void registry_event_global_remove(void *object, uint32_t id)
|
|||
global_free(c, g);
|
||||
}
|
||||
|
||||
static const struct pw_registry_proxy_events registry_events =
|
||||
static const struct pw_registry_events registry_events =
|
||||
{
|
||||
PW_VERSION_REGISTRY_PROXY_EVENTS,
|
||||
PW_VERSION_REGISTRY_EVENTS,
|
||||
.global = registry_event_global,
|
||||
.global_remove = registry_event_global_remove,
|
||||
};
|
||||
|
|
@ -879,10 +879,10 @@ 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_get_registry(c->core,
|
||||
PW_VERSION_REGISTRY_PROXY, 0);
|
||||
pw_registry_proxy_add_listener(c->registry_proxy,
|
||||
if (c->registry == NULL) {
|
||||
c->registry = pw_core_get_registry(c->core,
|
||||
PW_VERSION_REGISTRY, 0);
|
||||
pw_registry_add_listener(c->registry,
|
||||
&c->registry_listener,
|
||||
®istry_events, c);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@ struct pa_context {
|
|||
struct spa_hook core_listener;
|
||||
struct pw_core_info *core_info;
|
||||
|
||||
struct pw_registry_proxy *registry_proxy;
|
||||
struct pw_registry *registry;
|
||||
struct spa_hook registry_listener;
|
||||
|
||||
pa_proplist *proplist;
|
||||
|
|
|
|||
|
|
@ -1160,7 +1160,7 @@ pa_operation* pa_context_kill_client(pa_context *c, uint32_t idx, pa_context_suc
|
|||
if (!(g->mask & PA_SUBSCRIPTION_MASK_CLIENT))
|
||||
return NULL;
|
||||
|
||||
pw_registry_proxy_destroy(c->registry_proxy, g->id);
|
||||
pw_registry_destroy(c->registry, g->id);
|
||||
|
||||
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_ack));
|
||||
d = o->userdata;
|
||||
|
|
@ -1761,7 +1761,7 @@ pa_operation* pa_context_kill_sink_input(pa_context *c, uint32_t idx, pa_context
|
|||
pw_stream_destroy(s->stream);
|
||||
}
|
||||
else if (g) {
|
||||
pw_registry_proxy_destroy(c->registry_proxy, g->id);
|
||||
pw_registry_destroy(c->registry, g->id);
|
||||
}
|
||||
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_ack));
|
||||
d = o->userdata;
|
||||
|
|
@ -2054,7 +2054,7 @@ pa_operation* pa_context_kill_source_output(pa_context *c, uint32_t idx, pa_cont
|
|||
pw_stream_destroy(s->stream);
|
||||
}
|
||||
else if (g) {
|
||||
pw_registry_proxy_destroy(c->registry_proxy, g->id);
|
||||
pw_registry_destroy(c->registry, g->id);
|
||||
}
|
||||
o = pa_operation_new(c, NULL, on_success, sizeof(struct success_ack));
|
||||
d = o->userdata;
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ struct impl {
|
|||
struct pw_core *policy_core;
|
||||
struct spa_hook policy_listener;
|
||||
|
||||
struct pw_registry_proxy *registry_proxy;
|
||||
struct pw_registry *registry;
|
||||
struct spa_hook registry_listener;
|
||||
|
||||
struct pw_map globals;
|
||||
|
|
@ -1023,7 +1023,7 @@ bind_object(struct impl *impl, const struct object_info *info, uint32_t id,
|
|||
struct pw_proxy *proxy;
|
||||
struct sm_object *obj;
|
||||
|
||||
proxy = pw_registry_proxy_bind(impl->registry_proxy,
|
||||
proxy = pw_registry_bind(impl->registry,
|
||||
id, type, info->version, info->size);
|
||||
if (proxy == NULL) {
|
||||
res = -errno;
|
||||
|
|
@ -1056,7 +1056,7 @@ update_object(struct impl *impl, const struct object_info *info,
|
|||
if (SPA_FLAG_IS_SET(obj->mask, SM_OBJECT_CHANGE_MASK_LISTENER))
|
||||
spa_hook_remove(&obj->object_listener);
|
||||
|
||||
obj->proxy = pw_registry_proxy_bind(impl->registry_proxy,
|
||||
obj->proxy = pw_registry_bind(impl->registry,
|
||||
id, info->type, info->version, 0);
|
||||
obj->type = type;
|
||||
|
||||
|
|
@ -1202,8 +1202,8 @@ registry_global_remove(void *data, uint32_t id)
|
|||
remove_object(impl, obj);
|
||||
}
|
||||
|
||||
static const struct pw_registry_proxy_events registry_events = {
|
||||
PW_VERSION_REGISTRY_PROXY_EVENTS,
|
||||
static const struct pw_registry_events registry_events = {
|
||||
PW_VERSION_REGISTRY_EVENTS,
|
||||
.global = registry_global,
|
||||
.global_remove = registry_global_remove,
|
||||
};
|
||||
|
|
@ -1595,9 +1595,9 @@ static int start_policy(struct impl *impl)
|
|||
pw_core_add_listener(impl->policy_core,
|
||||
&impl->policy_listener,
|
||||
&core_events, impl);
|
||||
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 = pw_core_get_registry(impl->policy_core,
|
||||
PW_VERSION_REGISTRY, 0);
|
||||
pw_registry_add_listener(impl->registry,
|
||||
&impl->registry_listener,
|
||||
®istry_events, impl);
|
||||
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ struct core_data {
|
|||
int seq;
|
||||
GstPipeWireDeviceProvider *self;
|
||||
struct spa_hook core_listener;
|
||||
struct pw_registry_proxy *registry;
|
||||
struct pw_registry *registry;
|
||||
struct spa_hook registry_listener;
|
||||
struct spa_list nodes;
|
||||
struct spa_list ports;
|
||||
|
|
@ -457,7 +457,7 @@ static void registry_event_global(void *data, uint32_t id, uint32_t permissions,
|
|||
if (type == PW_TYPE_INTERFACE_Node) {
|
||||
struct pw_node_proxy *node;
|
||||
|
||||
node = pw_registry_proxy_bind(rd->registry,
|
||||
node = pw_registry_bind(rd->registry,
|
||||
id, PW_TYPE_INTERFACE_Node,
|
||||
PW_VERSION_NODE_PROXY, sizeof(*nd));
|
||||
if (node == NULL)
|
||||
|
|
@ -484,7 +484,7 @@ static void registry_event_global(void *data, uint32_t id, uint32_t permissions,
|
|||
if ((nd = find_node_data(rd, atoi(str))) == NULL)
|
||||
return;
|
||||
|
||||
port = pw_registry_proxy_bind(rd->registry,
|
||||
port = pw_registry_bind(rd->registry,
|
||||
id, PW_TYPE_INTERFACE_Port,
|
||||
PW_VERSION_PORT_PROXY, sizeof(*pd));
|
||||
if (port == NULL)
|
||||
|
|
@ -513,8 +513,8 @@ static void registry_event_global_remove(void *data, uint32_t id)
|
|||
{
|
||||
}
|
||||
|
||||
static const struct pw_registry_proxy_events registry_events = {
|
||||
PW_VERSION_REGISTRY_PROXY_EVENTS,
|
||||
static const struct pw_registry_events registry_events = {
|
||||
PW_VERSION_REGISTRY_EVENTS,
|
||||
.global = registry_event_global,
|
||||
.global_remove = registry_event_global_remove,
|
||||
};
|
||||
|
|
@ -552,8 +552,8 @@ gst_pipewire_device_provider_probe (GstDeviceProvider * provider)
|
|||
self->list_only = TRUE;
|
||||
self->devices = NULL;
|
||||
|
||||
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);
|
||||
data->registry = pw_core_get_registry(self->core, PW_VERSION_REGISTRY, 0);
|
||||
pw_registry_add_listener(data->registry, &data->registry_listener, ®istry_events, data);
|
||||
|
||||
pw_core_sync(self->core, 0, self->seq++);
|
||||
|
||||
|
|
@ -620,9 +620,9 @@ gst_pipewire_device_provider_start (GstDeviceProvider * provider)
|
|||
|
||||
pw_core_add_listener(self->core, &data->core_listener, &core_events, self);
|
||||
|
||||
self->registry = pw_core_get_registry(self->core, PW_VERSION_REGISTRY_PROXY, 0);
|
||||
self->registry = pw_core_get_registry(self->core, PW_VERSION_REGISTRY, 0);
|
||||
data->registry = self->registry;
|
||||
pw_registry_proxy_add_listener(self->registry, &data->registry_listener, ®istry_events, data);
|
||||
pw_registry_add_listener(self->registry, &data->registry_listener, ®istry_events, data);
|
||||
|
||||
pw_core_sync(self->core, 0, self->seq++);
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ struct _GstPipeWireDeviceProvider {
|
|||
struct spa_list pending;
|
||||
int seq;
|
||||
|
||||
struct pw_registry_proxy *registry;
|
||||
struct pw_registry *registry;
|
||||
|
||||
int error;
|
||||
gboolean end;
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ static int core_method_marshal_error(void *object, uint32_t id, int seq, int res
|
|||
return pw_protocol_native_end_proxy(proxy, b);
|
||||
}
|
||||
|
||||
static struct pw_registry_proxy * core_method_marshal_get_registry(void *object,
|
||||
static struct pw_registry * core_method_marshal_get_registry(void *object,
|
||||
uint32_t version, size_t user_data_size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
|
|
@ -124,7 +124,7 @@ static struct pw_registry_proxy * core_method_marshal_get_registry(void *object,
|
|||
|
||||
pw_protocol_native_end_proxy(proxy, b);
|
||||
|
||||
return (struct pw_registry_proxy *) res;
|
||||
return (struct pw_registry *) res;
|
||||
}
|
||||
|
||||
static inline void push_item(struct spa_pod_builder *b, const struct spa_dict_item *item)
|
||||
|
|
@ -655,7 +655,7 @@ static int core_method_demarshal_destroy(void *object, const struct pw_protocol_
|
|||
|
||||
static int registry_method_marshal_add_listener(void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_registry_proxy_events *events,
|
||||
const struct pw_registry_events *events,
|
||||
void *data)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
|
|
@ -670,7 +670,7 @@ static void registry_marshal_global(void *object, uint32_t id, uint32_t permissi
|
|||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_REGISTRY_PROXY_EVENT_GLOBAL, NULL);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_REGISTRY_EVENT_GLOBAL, NULL);
|
||||
|
||||
spa_pod_builder_push_struct(b, &f);
|
||||
spa_pod_builder_add(b,
|
||||
|
|
@ -690,7 +690,7 @@ static void registry_marshal_global_remove(void *object, uint32_t id)
|
|||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_REGISTRY_PROXY_EVENT_GLOBAL_REMOVE, NULL);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_REGISTRY_EVENT_GLOBAL_REMOVE, NULL);
|
||||
|
||||
spa_pod_builder_add_struct(b, SPA_POD_Int(id));
|
||||
|
||||
|
|
@ -711,7 +711,7 @@ static int registry_demarshal_bind(void *object, const struct pw_protocol_native
|
|||
SPA_POD_Int(&new_id)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_resource_notify(resource, struct pw_registry_proxy_methods, bind, 0, id, type, version, new_id);
|
||||
return pw_resource_notify(resource, struct pw_registry_methods, bind, 0, id, type, version, new_id);
|
||||
}
|
||||
|
||||
static int registry_demarshal_destroy(void *object, const struct pw_protocol_native_message *msg)
|
||||
|
|
@ -725,7 +725,7 @@ static int registry_demarshal_destroy(void *object, const struct pw_protocol_nat
|
|||
SPA_POD_Int(&id)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_resource_notify(resource, struct pw_registry_proxy_methods, destroy, 0, id);
|
||||
return pw_resource_notify(resource, struct pw_registry_methods, destroy, 0, id);
|
||||
}
|
||||
|
||||
static int module_method_marshal_add_listener(void *object,
|
||||
|
|
@ -1836,7 +1836,7 @@ static int registry_demarshal_global(void *object, const struct pw_protocol_nati
|
|||
if (parse_dict(&prs, &props) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_proxy_notify(proxy, struct pw_registry_proxy_events,
|
||||
return pw_proxy_notify(proxy, struct pw_registry_events,
|
||||
global, 0, id, permissions, type, version,
|
||||
props.n_items > 0 ? &props : NULL);
|
||||
}
|
||||
|
|
@ -1852,7 +1852,7 @@ static int registry_demarshal_global_remove(void *object, const struct pw_protoc
|
|||
SPA_POD_Int(&id)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
return pw_proxy_notify(proxy, struct pw_registry_proxy_events, global_remove, 0, id);
|
||||
return pw_proxy_notify(proxy, struct pw_registry_events, global_remove, 0, id);
|
||||
}
|
||||
|
||||
static void * registry_marshal_bind(void *object, uint32_t id,
|
||||
|
|
@ -1869,7 +1869,7 @@ static void * registry_marshal_bind(void *object, uint32_t id,
|
|||
|
||||
new_id = pw_proxy_get_id(res);
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_REGISTRY_PROXY_METHOD_BIND, NULL);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_REGISTRY_METHOD_BIND, NULL);
|
||||
|
||||
spa_pod_builder_add_struct(b,
|
||||
SPA_POD_Int(id),
|
||||
|
|
@ -1887,7 +1887,7 @@ static int registry_marshal_destroy(void *object, uint32_t id)
|
|||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_REGISTRY_PROXY_METHOD_DESTROY, NULL);
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_REGISTRY_METHOD_DESTROY, NULL);
|
||||
spa_pod_builder_add_struct(b,
|
||||
SPA_POD_Int(id));
|
||||
return pw_protocol_native_end_proxy(proxy, b);
|
||||
|
|
@ -1953,40 +1953,40 @@ static const struct pw_protocol_marshal pw_protocol_native_core_marshal = {
|
|||
.client_demarshal = pw_protocol_native_core_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_registry_proxy_methods pw_protocol_native_registry_method_marshal = {
|
||||
PW_VERSION_REGISTRY_PROXY_METHODS,
|
||||
static const struct pw_registry_methods pw_protocol_native_registry_method_marshal = {
|
||||
PW_VERSION_REGISTRY_METHODS,
|
||||
.add_listener = ®istry_method_marshal_add_listener,
|
||||
.bind = ®istry_marshal_bind,
|
||||
.destroy = ®istry_marshal_destroy,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_registry_method_demarshal[PW_REGISTRY_PROXY_METHOD_NUM] =
|
||||
pw_protocol_native_registry_method_demarshal[PW_REGISTRY_METHOD_NUM] =
|
||||
{
|
||||
[PW_REGISTRY_PROXY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
[PW_REGISTRY_PROXY_METHOD_BIND] = { ®istry_demarshal_bind, 0, },
|
||||
[PW_REGISTRY_PROXY_METHOD_DESTROY] = { ®istry_demarshal_destroy, 0, },
|
||||
[PW_REGISTRY_METHOD_ADD_LISTENER] = { NULL, 0, },
|
||||
[PW_REGISTRY_METHOD_BIND] = { ®istry_demarshal_bind, 0, },
|
||||
[PW_REGISTRY_METHOD_DESTROY] = { ®istry_demarshal_destroy, 0, },
|
||||
};
|
||||
|
||||
static const struct pw_registry_proxy_events pw_protocol_native_registry_event_marshal = {
|
||||
PW_VERSION_REGISTRY_PROXY_EVENTS,
|
||||
static const struct pw_registry_events pw_protocol_native_registry_event_marshal = {
|
||||
PW_VERSION_REGISTRY_EVENTS,
|
||||
.global = ®istry_marshal_global,
|
||||
.global_remove = ®istry_marshal_global_remove,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal
|
||||
pw_protocol_native_registry_event_demarshal[PW_REGISTRY_PROXY_EVENT_NUM] =
|
||||
pw_protocol_native_registry_event_demarshal[PW_REGISTRY_EVENT_NUM] =
|
||||
{
|
||||
[PW_REGISTRY_PROXY_EVENT_GLOBAL] = { ®istry_demarshal_global, 0, },
|
||||
[PW_REGISTRY_PROXY_EVENT_GLOBAL_REMOVE] = { ®istry_demarshal_global_remove, 0, }
|
||||
[PW_REGISTRY_EVENT_GLOBAL] = { ®istry_demarshal_global, 0, },
|
||||
[PW_REGISTRY_EVENT_GLOBAL_REMOVE] = { ®istry_demarshal_global_remove, 0, }
|
||||
};
|
||||
|
||||
const struct pw_protocol_marshal pw_protocol_native_registry_marshal = {
|
||||
PW_TYPE_INTERFACE_Registry,
|
||||
PW_VERSION_REGISTRY_PROXY,
|
||||
PW_VERSION_REGISTRY,
|
||||
0,
|
||||
PW_REGISTRY_PROXY_METHOD_NUM,
|
||||
PW_REGISTRY_PROXY_EVENT_NUM,
|
||||
PW_REGISTRY_METHOD_NUM,
|
||||
PW_REGISTRY_EVENT_NUM,
|
||||
.client_marshal = &pw_protocol_native_registry_method_marshal,
|
||||
.server_demarshal = pw_protocol_native_registry_method_demarshal,
|
||||
.server_marshal = &pw_protocol_native_registry_event_marshal,
|
||||
|
|
|
|||
|
|
@ -274,12 +274,12 @@ struct pw_core_v0_events {
|
|||
* can, for example, hide certain existing or new objects or limit
|
||||
* the access permissions on an object.
|
||||
*/
|
||||
#define PW_REGISTRY_PROXY_V0_METHOD_BIND 0
|
||||
#define PW_REGISTRY_PROXY_V0_METHOD_NUM 1
|
||||
#define PW_REGISTRY_V0_METHOD_BIND 0
|
||||
#define PW_REGISTRY_V0_METHOD_NUM 1
|
||||
|
||||
/** Registry methods */
|
||||
struct pw_registry_proxy_v0_methods {
|
||||
#define PW_VERSION_REGISTRY_PROXY_V0_METHODS 0
|
||||
struct pw_registry_v0_methods {
|
||||
#define PW_VERSION_REGISTRY_V0_METHODS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Bind to a global object
|
||||
|
|
@ -296,13 +296,13 @@ struct pw_registry_proxy_v0_methods {
|
|||
void (*bind) (void *object, uint32_t id, uint32_t type, uint32_t version, uint32_t new_id);
|
||||
};
|
||||
|
||||
#define PW_REGISTRY_PROXY_V0_EVENT_GLOBAL 0
|
||||
#define PW_REGISTRY_PROXY_V0_EVENT_GLOBAL_REMOVE 1
|
||||
#define PW_REGISTRY_PROXY_V0_EVENT_NUM 2
|
||||
#define PW_REGISTRY_V0_EVENT_GLOBAL 0
|
||||
#define PW_REGISTRY_V0_EVENT_GLOBAL_REMOVE 1
|
||||
#define PW_REGISTRY_V0_EVENT_NUM 2
|
||||
|
||||
/** Registry events */
|
||||
struct pw_registry_proxy_v0_events {
|
||||
#define PW_VERSION_REGISTRY_PROXY_V0_EVENTS 0
|
||||
struct pw_registry_v0_events {
|
||||
#define PW_VERSION_REGISTRY_V0_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify of a new global object
|
||||
|
|
@ -332,8 +332,8 @@ struct pw_registry_proxy_v0_events {
|
|||
void (*global_remove) (void *object, uint32_t id);
|
||||
};
|
||||
|
||||
#define pw_registry_resource_v0_global(r,...) pw_resource_notify(r,struct pw_registry_proxy_v0_events,global,__VA_ARGS__)
|
||||
#define pw_registry_resource_v0_global_remove(r,...) pw_resource_notify(r,struct pw_registry_proxy_v0_events,global_remove,__VA_ARGS__)
|
||||
#define pw_registry_resource_v0_global(r,...) pw_resource_notify(r,struct pw_registry_v0_events,global,__VA_ARGS__)
|
||||
#define pw_registry_resource_v0_global_remove(r,...) pw_resource_notify(r,struct pw_registry_v0_events,global_remove,__VA_ARGS__)
|
||||
|
||||
|
||||
#define PW_VERSION_MODULE_V0 0
|
||||
|
|
|
|||
|
|
@ -694,7 +694,7 @@ static void registry_marshal_global(void *object, uint32_t id, uint32_t permissi
|
|||
struct spa_pod_frame f;
|
||||
uint32_t i, n_items, parent_id;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_REGISTRY_PROXY_V0_EVENT_GLOBAL, NULL);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_REGISTRY_V0_EVENT_GLOBAL, NULL);
|
||||
|
||||
n_items = props ? props->n_items : 0;
|
||||
|
||||
|
|
@ -726,7 +726,7 @@ static void registry_marshal_global_remove(void *object, uint32_t id)
|
|||
struct pw_resource *resource = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_REGISTRY_PROXY_V0_EVENT_GLOBAL_REMOVE, NULL);
|
||||
b = pw_protocol_native_begin_resource(resource, PW_REGISTRY_V0_EVENT_GLOBAL_REMOVE, NULL);
|
||||
|
||||
spa_pod_builder_add_struct(b, "i", id);
|
||||
|
||||
|
|
@ -749,7 +749,7 @@ static int registry_demarshal_bind(void *object, const struct pw_protocol_native
|
|||
|
||||
type = pw_protocol_native0_type_from_v2(resource->client, type);
|
||||
|
||||
return pw_resource_notify(resource, struct pw_registry_proxy_methods, bind, 0, id, type, version, new_id);
|
||||
return pw_resource_notify(resource, struct pw_registry_methods, bind, 0, id, type, version, new_id);
|
||||
}
|
||||
|
||||
static void module_marshal_info(void *object, const struct pw_module_info *info)
|
||||
|
|
@ -1050,11 +1050,11 @@ static const struct pw_protocol_marshal pw_protocol_native_core_marshal = {
|
|||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_registry_method_demarshal[] = {
|
||||
[PW_REGISTRY_PROXY_V0_METHOD_BIND] = { ®istry_demarshal_bind, 0, PW_PROTOCOL_NATIVE_FLAG_REMAP, },
|
||||
[PW_REGISTRY_V0_METHOD_BIND] = { ®istry_demarshal_bind, 0, PW_PROTOCOL_NATIVE_FLAG_REMAP, },
|
||||
};
|
||||
|
||||
static const struct pw_registry_proxy_events pw_protocol_native_registry_event_marshal = {
|
||||
PW_VERSION_REGISTRY_PROXY_EVENTS,
|
||||
static const struct pw_registry_events pw_protocol_native_registry_event_marshal = {
|
||||
PW_VERSION_REGISTRY_EVENTS,
|
||||
.global = ®istry_marshal_global,
|
||||
.global_remove = ®istry_marshal_global_remove,
|
||||
};
|
||||
|
|
@ -1062,8 +1062,8 @@ static const struct pw_registry_proxy_events pw_protocol_native_registry_event_m
|
|||
static const struct pw_protocol_marshal pw_protocol_native_registry_marshal = {
|
||||
PW_TYPE_INTERFACE_Registry,
|
||||
PW_VERSION_REGISTRY_V0,
|
||||
PW_REGISTRY_PROXY_V0_METHOD_NUM,
|
||||
PW_REGISTRY_PROXY_EVENT_NUM,
|
||||
PW_REGISTRY_V0_METHOD_NUM,
|
||||
PW_REGISTRY_EVENT_NUM,
|
||||
0,
|
||||
NULL,
|
||||
pw_protocol_native_registry_method_demarshal,
|
||||
|
|
|
|||
|
|
@ -150,8 +150,8 @@ error_exit:
|
|||
return res;
|
||||
}
|
||||
|
||||
static const struct pw_registry_proxy_methods registry_methods = {
|
||||
PW_VERSION_REGISTRY_PROXY_METHODS,
|
||||
static const struct pw_registry_methods registry_methods = {
|
||||
PW_VERSION_REGISTRY_METHODS,
|
||||
.bind = registry_bind,
|
||||
.destroy = registry_destroy
|
||||
};
|
||||
|
|
@ -238,7 +238,7 @@ static int core_error(void *object, uint32_t id, int seq, int res, const char *m
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct pw_registry_proxy * core_get_registry(void *object, uint32_t version, size_t user_data_size)
|
||||
static struct pw_registry * core_get_registry(void *object, uint32_t version, size_t user_data_size)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct pw_client *client = resource->client;
|
||||
|
|
@ -284,7 +284,7 @@ static struct pw_registry_proxy * core_get_registry(void *object, uint32_t versi
|
|||
}
|
||||
}
|
||||
|
||||
return (struct pw_registry_proxy *)registry_resource;
|
||||
return (struct pw_registry *)registry_resource;
|
||||
|
||||
error_resource:
|
||||
pw_log_error(NAME" %p: can't create registry resource: %m", this);
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ extern "C" {
|
|||
|
||||
#include <spa/utils/hook.h>
|
||||
|
||||
#define PW_VERSION_CORE 3
|
||||
#define PW_VERSION_CORE 3
|
||||
struct pw_core;
|
||||
#define PW_VERSION_REGISTRY_PROXY 3
|
||||
struct pw_registry_proxy;
|
||||
#define PW_VERSION_REGISTRY 3
|
||||
struct pw_registry;
|
||||
|
||||
/** The core information. Extra information can be added in later versions \memberof pw_introspect */
|
||||
struct pw_core_info {
|
||||
|
|
@ -262,7 +262,7 @@ struct pw_core_methods {
|
|||
* \param version the client version
|
||||
* \param user_data_size extra size
|
||||
*/
|
||||
struct pw_registry_proxy * (*get_registry) (void *object, uint32_t version,
|
||||
struct pw_registry * (*get_registry) (void *object, uint32_t version,
|
||||
size_t user_data_size);
|
||||
|
||||
/**
|
||||
|
|
@ -327,10 +327,10 @@ pw_core_errorf(struct pw_core *core, uint32_t id, int seq,
|
|||
return r;
|
||||
}
|
||||
|
||||
static inline struct pw_registry_proxy *
|
||||
static inline struct pw_registry *
|
||||
pw_core_get_registry(struct pw_core *core, uint32_t version, size_t user_data_size)
|
||||
{
|
||||
struct pw_registry_proxy *res = NULL;
|
||||
struct pw_registry *res = NULL;
|
||||
spa_interface_call_res((struct spa_interface*)core,
|
||||
struct pw_core_methods, res,
|
||||
get_registry, 0, version, user_data_size);
|
||||
|
|
@ -387,13 +387,13 @@ pw_core_create_object(struct pw_core *core,
|
|||
* 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
|
||||
#define PW_REGISTRY_EVENT_GLOBAL 0
|
||||
#define PW_REGISTRY_EVENT_GLOBAL_REMOVE 1
|
||||
#define PW_REGISTRY_EVENT_NUM 2
|
||||
|
||||
/** Registry events */
|
||||
struct pw_registry_proxy_events {
|
||||
#define PW_VERSION_REGISTRY_PROXY_EVENTS 0
|
||||
struct pw_registry_events {
|
||||
#define PW_VERSION_REGISTRY_EVENTS 0
|
||||
uint32_t version;
|
||||
/**
|
||||
* Notify of a new global object
|
||||
|
|
@ -422,19 +422,19 @@ struct pw_registry_proxy_events {
|
|||
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
|
||||
#define PW_REGISTRY_METHOD_ADD_LISTENER 0
|
||||
#define PW_REGISTRY_METHOD_BIND 1
|
||||
#define PW_REGISTRY_METHOD_DESTROY 2
|
||||
#define PW_REGISTRY_METHOD_NUM 3
|
||||
|
||||
/** Registry methods */
|
||||
struct pw_registry_proxy_methods {
|
||||
#define PW_VERSION_REGISTRY_PROXY_METHODS 0
|
||||
struct pw_registry_methods {
|
||||
#define PW_VERSION_REGISTRY_METHODS 0
|
||||
uint32_t version;
|
||||
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_registry_proxy_events *events,
|
||||
const struct pw_registry_events *events,
|
||||
void *data);
|
||||
/**
|
||||
* Bind to a global object
|
||||
|
|
@ -461,31 +461,31 @@ struct pw_registry_proxy_methods {
|
|||
int (*destroy) (void *object, uint32_t id);
|
||||
};
|
||||
|
||||
#define pw_registry_proxy_method(o,method,version,...) \
|
||||
#define pw_registry_method(o,method,version,...) \
|
||||
({ \
|
||||
int _res = -ENOTSUP; \
|
||||
spa_interface_call_res((struct spa_interface*)o, \
|
||||
struct pw_registry_proxy_methods, _res, \
|
||||
struct pw_registry_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__)
|
||||
#define pw_registry_add_listener(p,...) pw_registry_method(p,add_listener,0,__VA_ARGS__)
|
||||
|
||||
static inline void *
|
||||
pw_registry_proxy_bind(struct pw_registry_proxy *registry,
|
||||
pw_registry_bind(struct pw_registry *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,
|
||||
struct pw_registry_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_registry_destroy(p,...) pw_registry_method(p,destroy,0,__VA_ARGS__)
|
||||
|
||||
|
||||
/** Connect to a PipeWire instance \memberof pw_core
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ pw_core_resource_errorf(struct pw_resource *resource, uint32_t id, int seq,
|
|||
va_end(args);
|
||||
}
|
||||
|
||||
#define pw_registry_resource(r,m,v,...) pw_resource_call(r, struct pw_registry_proxy_events,m,v,##__VA_ARGS__)
|
||||
#define pw_registry_resource(r,m,v,...) pw_resource_call(r, struct pw_registry_events,m,v,##__VA_ARGS__)
|
||||
#define pw_registry_resource_global(r,...) pw_registry_resource(r,global,0,__VA_ARGS__)
|
||||
#define pw_registry_resource_global_remove(r,...) pw_registry_resource(r,global_remove,0,__VA_ARGS__)
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ static void test_core_abi(void)
|
|||
int (*sync) (void *object, uint32_t id, int seq);
|
||||
int (*pong) (void *object, uint32_t id, int seq);
|
||||
int (*error) (void *object, uint32_t id, int seq, int res, const char *error);
|
||||
struct pw_registry_proxy * (*get_registry) (void *object,
|
||||
struct pw_registry * (*get_registry) (void *object,
|
||||
uint32_t version, size_t user_data_size);
|
||||
void * (*create_object) (void *object,
|
||||
const char *factory_name,
|
||||
|
|
@ -94,37 +94,37 @@ static void test_core_abi(void)
|
|||
|
||||
static void test_registry_abi(void)
|
||||
{
|
||||
struct pw_registry_proxy_methods m;
|
||||
struct pw_registry_proxy_events e;
|
||||
struct pw_registry_methods m;
|
||||
struct pw_registry_events e;
|
||||
struct {
|
||||
uint32_t version;
|
||||
int (*add_listener) (void *object,
|
||||
struct spa_hook *listener,
|
||||
const struct pw_registry_proxy_events *events,
|
||||
const struct pw_registry_events *events,
|
||||
void *data);
|
||||
void * (*bind) (void *object, uint32_t id, uint32_t type, uint32_t version,
|
||||
size_t user_data_size);
|
||||
int (*destroy) (void *object, uint32_t id);
|
||||
} methods = { PW_VERSION_REGISTRY_PROXY_METHODS, };
|
||||
} methods = { PW_VERSION_REGISTRY_METHODS, };
|
||||
struct {
|
||||
uint32_t version;
|
||||
void (*global) (void *object, uint32_t id,
|
||||
uint32_t permissions, uint32_t type, uint32_t version,
|
||||
const struct spa_dict *props);
|
||||
void (*global_remove) (void *object, uint32_t id);
|
||||
} events = { PW_VERSION_REGISTRY_PROXY_EVENTS, };
|
||||
} events = { PW_VERSION_REGISTRY_EVENTS, };
|
||||
|
||||
TEST_FUNC(m, methods, version);
|
||||
TEST_FUNC(m, methods, add_listener);
|
||||
TEST_FUNC(m, methods, bind);
|
||||
TEST_FUNC(m, methods, destroy);
|
||||
spa_assert(PW_VERSION_REGISTRY_PROXY_METHODS == 0);
|
||||
spa_assert(PW_VERSION_REGISTRY_METHODS == 0);
|
||||
spa_assert(sizeof(m) == sizeof(methods));
|
||||
|
||||
TEST_FUNC(e, events, version);
|
||||
TEST_FUNC(e, events, global);
|
||||
TEST_FUNC(e, events, global_remove);
|
||||
spa_assert(PW_VERSION_REGISTRY_PROXY_EVENTS == 0);
|
||||
spa_assert(PW_VERSION_REGISTRY_EVENTS == 0);
|
||||
spa_assert(sizeof(e) == sizeof(events));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ struct remote_data {
|
|||
struct pw_core *core;
|
||||
struct spa_hook core_listener;
|
||||
struct spa_hook proxy_core_listener;
|
||||
struct pw_registry_proxy *registry_proxy;
|
||||
struct pw_registry *registry;
|
||||
struct spa_hook registry_listener;
|
||||
|
||||
struct pw_map globals;
|
||||
|
|
@ -364,8 +364,8 @@ static void registry_event_global_remove(void *data, uint32_t id)
|
|||
destroy_global(global, rd);
|
||||
}
|
||||
|
||||
static const struct pw_registry_proxy_events registry_events = {
|
||||
PW_VERSION_REGISTRY_PROXY_EVENTS,
|
||||
static const struct pw_registry_events registry_events = {
|
||||
PW_VERSION_REGISTRY_EVENTS,
|
||||
.global = registry_event_global,
|
||||
.global_remove = registry_event_global_remove,
|
||||
};
|
||||
|
|
@ -444,9 +444,8 @@ static bool do_connect(struct data *data, const char *cmd, char *args, char **er
|
|||
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 = pw_core_get_registry(rd->core, PW_VERSION_REGISTRY, 0);
|
||||
pw_registry_add_listener(rd->registry,
|
||||
&rd->registry_listener,
|
||||
®istry_events, rd);
|
||||
rd->prompt_pending = pw_core_sync(rd->core, 0, 0);
|
||||
|
|
@ -1166,7 +1165,7 @@ static bool bind_global(struct remote_data *rd, struct global *global, char **er
|
|||
return false;
|
||||
}
|
||||
|
||||
proxy = pw_registry_proxy_bind(rd->registry_proxy,
|
||||
proxy = pw_registry_bind(rd->registry,
|
||||
global->id,
|
||||
global->type,
|
||||
client_version,
|
||||
|
|
@ -1338,7 +1337,7 @@ static bool do_destroy(struct data *data, const char *cmd, char *args, char **er
|
|||
asprintf(error, "%s: unknown global %d", cmd, id);
|
||||
return false;
|
||||
}
|
||||
pw_registry_proxy_destroy(rd->registry_proxy, id);
|
||||
pw_registry_destroy(rd->registry, id);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ struct data {
|
|||
struct pw_core *core;
|
||||
struct spa_hook core_listener;
|
||||
|
||||
struct pw_registry_proxy *registry_proxy;
|
||||
struct pw_registry *registry;
|
||||
struct spa_hook registry_listener;
|
||||
|
||||
struct spa_list globals;
|
||||
|
|
@ -670,7 +670,7 @@ static void registry_event_global(void *data, uint32_t id, uint32_t permissions,
|
|||
return;
|
||||
}
|
||||
|
||||
proxy = pw_registry_proxy_bind(d->registry_proxy, id, type,
|
||||
proxy = pw_registry_bind(d->registry, id, type,
|
||||
client_version,
|
||||
sizeof(struct global));
|
||||
if (proxy == NULL)
|
||||
|
|
@ -697,8 +697,8 @@ static void registry_event_global(void *data, uint32_t id, uint32_t permissions,
|
|||
spa_list_insert(&d->globals, &g->link);
|
||||
}
|
||||
|
||||
static const struct pw_registry_proxy_events registry_events = {
|
||||
PW_VERSION_REGISTRY_PROXY_EVENTS,
|
||||
static const struct pw_registry_events registry_events = {
|
||||
PW_VERSION_REGISTRY_EVENTS,
|
||||
.global = registry_event_global,
|
||||
};
|
||||
|
||||
|
|
@ -833,9 +833,9 @@ int main(int argc, char *argv[])
|
|||
pw_core_add_listener(data.core,
|
||||
&data.core_listener,
|
||||
&core_events, &data);
|
||||
data.registry_proxy = pw_core_get_registry(data.core,
|
||||
PW_VERSION_REGISTRY_PROXY, 0);
|
||||
pw_registry_proxy_add_listener(data.registry_proxy,
|
||||
data.registry = pw_core_get_registry(data.core,
|
||||
PW_VERSION_REGISTRY, 0);
|
||||
pw_registry_add_listener(data.registry,
|
||||
&data.registry_listener,
|
||||
®istry_events, &data);
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ struct data {
|
|||
struct pw_core *core;
|
||||
struct spa_hook core_listener;
|
||||
|
||||
struct pw_registry_proxy *registry_proxy;
|
||||
struct pw_registry *registry;
|
||||
struct spa_hook registry_listener;
|
||||
|
||||
struct spa_list pending_list;
|
||||
|
|
@ -628,7 +628,7 @@ static void registry_event_global(void *data, uint32_t id,
|
|||
return;
|
||||
}
|
||||
|
||||
proxy = pw_registry_proxy_bind(d->registry_proxy, id, type,
|
||||
proxy = pw_registry_bind(d->registry, id, type,
|
||||
client_version,
|
||||
sizeof(struct proxy_data));
|
||||
if (proxy == NULL)
|
||||
|
|
@ -661,8 +661,8 @@ static void registry_event_global_remove(void *object, uint32_t id)
|
|||
printf("\tid: %u\n", id);
|
||||
}
|
||||
|
||||
static const struct pw_registry_proxy_events registry_events = {
|
||||
PW_VERSION_REGISTRY_PROXY_EVENTS,
|
||||
static const struct pw_registry_events registry_events = {
|
||||
PW_VERSION_REGISTRY_EVENTS,
|
||||
.global = registry_event_global,
|
||||
.global_remove = registry_event_global_remove,
|
||||
};
|
||||
|
|
@ -723,9 +723,9 @@ int main(int argc, char *argv[])
|
|||
pw_core_add_listener(data.core,
|
||||
&data.core_listener,
|
||||
&core_events, &data);
|
||||
data.registry_proxy = pw_core_get_registry(data.core,
|
||||
PW_VERSION_REGISTRY_PROXY, 0);
|
||||
pw_registry_proxy_add_listener(data.registry_proxy,
|
||||
data.registry = pw_core_get_registry(data.core,
|
||||
PW_VERSION_REGISTRY, 0);
|
||||
pw_registry_add_listener(data.registry,
|
||||
&data.registry_listener,
|
||||
®istry_events, &data);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue