mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
Add proxy destroy
Make the current destroy method on the core for proxies to remove the server side resource. Make a new destroy method on the registry to destroy globals. Remove the destroy method on the client-node media-session: monitor the dsp and device node states to manage the session state
This commit is contained in:
parent
ce4cfd78e7
commit
59f10ad453
10 changed files with 276 additions and 157 deletions
|
|
@ -1086,12 +1086,6 @@ static void client_node_event(void *data, struct spa_event *event)
|
|||
this->callbacks->event(this->callbacks_data, event);
|
||||
}
|
||||
|
||||
static void client_node_destroy(void *data)
|
||||
{
|
||||
struct impl *impl = data;
|
||||
pw_client_node_destroy(&impl->this);
|
||||
}
|
||||
|
||||
static struct pw_client_node_proxy_methods client_node_methods = {
|
||||
PW_VERSION_CLIENT_NODE_PROXY_METHODS,
|
||||
.done = client_node_done,
|
||||
|
|
@ -1099,7 +1093,6 @@ static struct pw_client_node_proxy_methods client_node_methods = {
|
|||
.port_update = client_node_port_update,
|
||||
.set_active = client_node_set_active,
|
||||
.event = client_node_event,
|
||||
.destroy = client_node_destroy,
|
||||
};
|
||||
|
||||
static void node_on_data_fd_events(struct spa_source *source)
|
||||
|
|
|
|||
|
|
@ -153,18 +153,6 @@ static void client_node_marshal_event_method(void *object, struct spa_event *eve
|
|||
pw_protocol_native_end_proxy(proxy, b);
|
||||
}
|
||||
|
||||
static void client_node_marshal_destroy(void *object)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
struct spa_pod_builder *b;
|
||||
|
||||
b = pw_protocol_native_begin_proxy(proxy, PW_CLIENT_NODE_PROXY_METHOD_DESTROY);
|
||||
|
||||
spa_pod_builder_add_struct(b);
|
||||
|
||||
pw_protocol_native_end_proxy(proxy, b);
|
||||
}
|
||||
|
||||
static int client_node_demarshal_add_mem(void *object, void *data, size_t size)
|
||||
{
|
||||
struct pw_proxy *proxy = object;
|
||||
|
|
@ -874,27 +862,13 @@ static int client_node_demarshal_event_method(void *object, void *data, size_t s
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int client_node_demarshal_destroy(void *object, void *data, size_t size)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_parser prs;
|
||||
|
||||
spa_pod_parser_init(&prs, data, size, 0);
|
||||
if (spa_pod_parser_get(&prs, "[", NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
pw_resource_do(resource, struct pw_client_node_proxy_methods, destroy, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct pw_client_node_proxy_methods pw_protocol_native_client_node_method_marshal = {
|
||||
PW_VERSION_CLIENT_NODE_PROXY_METHODS,
|
||||
&client_node_marshal_done,
|
||||
&client_node_marshal_update,
|
||||
&client_node_marshal_port_update,
|
||||
&client_node_marshal_set_active,
|
||||
&client_node_marshal_event_method,
|
||||
&client_node_marshal_destroy
|
||||
&client_node_marshal_event_method
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_client_node_method_demarshal[] = {
|
||||
|
|
@ -902,8 +876,7 @@ static const struct pw_protocol_native_demarshal pw_protocol_native_client_node_
|
|||
{ &client_node_demarshal_update, 0 },
|
||||
{ &client_node_demarshal_port_update, 0 },
|
||||
{ &client_node_demarshal_set_active, 0 },
|
||||
{ &client_node_demarshal_event_method, 0 },
|
||||
{ &client_node_demarshal_destroy, 0 },
|
||||
{ &client_node_demarshal_event_method, 0 }
|
||||
};
|
||||
|
||||
static const struct pw_client_node_proxy_events pw_protocol_native_client_node_event_marshal = {
|
||||
|
|
|
|||
|
|
@ -509,6 +509,22 @@ static int registry_demarshal_bind(void *object, void *data, size_t size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int registry_demarshal_destroy(void *object, void *data, size_t size)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
struct spa_pod_parser prs;
|
||||
uint32_t id;
|
||||
|
||||
spa_pod_parser_init(&prs, data, size, 0);
|
||||
if (spa_pod_parser_get(&prs,
|
||||
"["
|
||||
"i", &id, NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
pw_resource_do(resource, struct pw_registry_proxy_methods, destroy, 0, id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void module_marshal_info(void *object, struct pw_module_info *info)
|
||||
{
|
||||
struct pw_resource *resource = object;
|
||||
|
|
@ -1127,6 +1143,17 @@ static void registry_marshal_bind(void *object, uint32_t id,
|
|||
pw_protocol_native_end_proxy(proxy, b);
|
||||
}
|
||||
|
||||
static void 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);
|
||||
spa_pod_builder_add_struct(b,
|
||||
"i", id);
|
||||
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,
|
||||
&core_marshal_hello,
|
||||
|
|
@ -1177,10 +1204,12 @@ static const struct pw_protocol_marshal pw_protocol_native_core_marshal = {
|
|||
static const struct pw_registry_proxy_methods pw_protocol_native_registry_method_marshal = {
|
||||
PW_VERSION_REGISTRY_PROXY_METHODS,
|
||||
®istry_marshal_bind,
|
||||
®istry_marshal_destroy,
|
||||
};
|
||||
|
||||
static const struct pw_protocol_native_demarshal pw_protocol_native_registry_method_demarshal[] = {
|
||||
{ ®istry_demarshal_bind, 0, },
|
||||
{ ®istry_demarshal_destroy, 0, },
|
||||
};
|
||||
|
||||
static const struct pw_registry_proxy_events pw_protocol_native_registry_event_marshal = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue