mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
core: add bound_props event
this event extends the bound_id event and sends the global properties as well. This can be used to get the object.serial, for example. It can also be used in the future to let the server generate unique property values, like the node.name, and let the client know about the new property value.
This commit is contained in:
parent
59cd5670d7
commit
fb8709716c
14 changed files with 111 additions and 29 deletions
|
|
@ -395,6 +395,27 @@ static int core_event_demarshal_bound_id(void *data, const struct pw_protocol_na
|
|||
return pw_proxy_notify(proxy, struct pw_core_events, bound_id, 0, id, global_id);
|
||||
}
|
||||
|
||||
static int core_event_demarshal_bound_props(void *data, const struct pw_protocol_native_message *msg)
|
||||
{
|
||||
struct pw_proxy *proxy = data;
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t id, global_id;
|
||||
struct spa_pod_frame f[2];
|
||||
struct spa_dict props = SPA_DICT_INIT(NULL, 0);
|
||||
|
||||
spa_pod_parser_init(&prs, msg->data, msg->size);
|
||||
if (spa_pod_parser_push_struct(&prs, &f[0]) < 0)
|
||||
return -EINVAL;
|
||||
if (spa_pod_parser_get(&prs,
|
||||
SPA_POD_Int(&id),
|
||||
SPA_POD_Int(&global_id), NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
parse_dict_struct(&prs, &f[1], &props);
|
||||
|
||||
return pw_proxy_notify(proxy, struct pw_core_events, bound_props, 1, id, global_id, &props);
|
||||
}
|
||||
|
||||
static int core_event_demarshal_add_mem(void *data, const struct pw_protocol_native_message *msg)
|
||||
{
|
||||
struct pw_proxy *proxy = data;
|
||||
|
|
@ -526,6 +547,25 @@ static void core_event_marshal_bound_id(void *data, uint32_t id, uint32_t global
|
|||
pw_protocol_native_end_resource(resource, b);
|
||||
}
|
||||
|
||||
static void core_event_marshal_bound_props(void *data, uint32_t id, uint32_t global_id, const struct spa_dict *props)
|
||||
{
|
||||
struct pw_resource *resource = data;
|
||||
struct spa_pod_builder *b;
|
||||
struct spa_pod_frame f;
|
||||
|
||||
b = pw_protocol_native_begin_resource(resource, PW_CORE_EVENT_BOUND_PROPS, NULL);
|
||||
|
||||
spa_pod_builder_push_struct(b, &f);
|
||||
spa_pod_builder_add(b,
|
||||
SPA_POD_Int(id),
|
||||
SPA_POD_Int(global_id),
|
||||
NULL);
|
||||
push_dict(b, props);
|
||||
spa_pod_builder_pop(b, &f);
|
||||
|
||||
pw_protocol_native_end_resource(resource, b);
|
||||
}
|
||||
|
||||
static void core_event_marshal_add_mem(void *data, uint32_t id, uint32_t type, int fd, uint32_t flags)
|
||||
{
|
||||
struct pw_resource *resource = data;
|
||||
|
|
@ -1863,6 +1903,7 @@ static const struct pw_core_events pw_protocol_native_core_event_marshal = {
|
|||
.bound_id = &core_event_marshal_bound_id,
|
||||
.add_mem = &core_event_marshal_add_mem,
|
||||
.remove_mem = &core_event_marshal_remove_mem,
|
||||
.bound_props = &core_event_marshal_bound_props,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal
|
||||
|
|
@ -1876,6 +1917,7 @@ pw_protocol_native_core_event_demarshal[PW_CORE_EVENT_NUM] =
|
|||
[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, },
|
||||
[PW_CORE_EVENT_BOUND_PROPS] = { &core_event_demarshal_bound_props, 0, },
|
||||
};
|
||||
|
||||
static const struct pw_protocol_marshal pw_protocol_native_core_marshal = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue