mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
hooks: enforce version on hook emission
Pass the minimum required version to the hook emission and only call events when the handler is recent enough. Add some macros to make event emission easier to read.
This commit is contained in:
parent
a72e3cefd7
commit
a63523650d
27 changed files with 250 additions and 155 deletions
|
|
@ -183,7 +183,7 @@ static int client_node_demarshal_add_mem(void *object, void *data, size_t size)
|
|||
|
||||
memfd = pw_protocol_native_get_proxy_fd(proxy, memfd_idx);
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, add_mem,
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, add_mem, 0,
|
||||
mem_id,
|
||||
type,
|
||||
memfd, flags);
|
||||
|
|
@ -211,7 +211,7 @@ static int client_node_demarshal_transport(void *object, void *data, size_t size
|
|||
if (readfd == -1 || writefd == -1)
|
||||
return -EINVAL;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, transport, node_id,
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, transport, 0, node_id,
|
||||
readfd, writefd);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -232,7 +232,7 @@ static int client_node_demarshal_set_param(void *object, void *data, size_t size
|
|||
"O", ¶m, NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, set_param, seq, id, flags, param);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, set_param, 0, seq, id, flags, param);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -246,7 +246,7 @@ static int client_node_demarshal_event_event(void *object, void *data, size_t si
|
|||
if (spa_pod_parser_get(&prs, "[ O", &event, NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, event, event);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, event, 0, event);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -264,7 +264,7 @@ static int client_node_demarshal_command(void *object, void *data, size_t size)
|
|||
"O", &command, NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, command, seq, command);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, command, 0, seq, command);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -282,7 +282,7 @@ static int client_node_demarshal_add_port(void *object, void *data, size_t size)
|
|||
"i", &port_id, NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, add_port, seq, direction, port_id);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, add_port, 0, seq, direction, port_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -300,7 +300,7 @@ static int client_node_demarshal_remove_port(void *object, void *data, size_t si
|
|||
"i", &port_id, NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, remove_port, seq, direction, port_id);
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, remove_port, 0, seq, direction, port_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -322,7 +322,7 @@ static int client_node_demarshal_port_set_param(void *object, void *data, size_t
|
|||
"O", ¶m, NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, port_set_param,
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, port_set_param, 0,
|
||||
seq, direction, port_id, id, flags, param);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -384,7 +384,7 @@ static int client_node_demarshal_port_use_buffers(void *object, void *data, size
|
|||
d->data = SPA_UINT32_TO_PTR(data_id);
|
||||
}
|
||||
}
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, port_use_buffers, seq,
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, port_use_buffers, 0, seq,
|
||||
direction,
|
||||
port_id,
|
||||
mix_id,
|
||||
|
|
@ -407,7 +407,7 @@ static int client_node_demarshal_port_command(void *object, void *data, size_t s
|
|||
"O", &command, NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, port_command, direction,
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, port_command, 0, direction,
|
||||
port_id,
|
||||
command);
|
||||
return 0;
|
||||
|
|
@ -432,7 +432,7 @@ static int client_node_demarshal_port_set_io(void *object, void *data, size_t si
|
|||
"i", &sz, NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, port_set_io,
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, port_set_io, 0,
|
||||
seq,
|
||||
direction, port_id, mix_id,
|
||||
id, memid,
|
||||
|
|
@ -455,7 +455,7 @@ static int client_node_demarshal_set_io(void *object, void *data, size_t size)
|
|||
"i", &sz, NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, set_io,
|
||||
pw_proxy_notify(proxy, struct pw_client_node_proxy_events, set_io, 0,
|
||||
id, memid, off, sz);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -731,7 +731,7 @@ static int client_node_demarshal_done(void *object, void *data, size_t size)
|
|||
"i", &res, NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
pw_resource_do(resource, struct pw_client_node_proxy_methods, done, seq, res);
|
||||
pw_resource_do(resource, struct pw_client_node_proxy_methods, done, 0, seq, res);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -771,7 +771,7 @@ static int client_node_demarshal_update(void *object, void *data, size_t size)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
pw_resource_do(resource, struct pw_client_node_proxy_methods, update, change_mask,
|
||||
pw_resource_do(resource, struct pw_client_node_proxy_methods, update, 0, change_mask,
|
||||
max_input_ports,
|
||||
max_output_ports,
|
||||
n_params,
|
||||
|
|
@ -834,7 +834,7 @@ static int client_node_demarshal_port_update(void *object, void *data, size_t si
|
|||
}
|
||||
}
|
||||
|
||||
pw_resource_do(resource, struct pw_client_node_proxy_methods, port_update, direction,
|
||||
pw_resource_do(resource, struct pw_client_node_proxy_methods, port_update, 0, direction,
|
||||
port_id,
|
||||
change_mask,
|
||||
n_params,
|
||||
|
|
@ -854,7 +854,7 @@ static int client_node_demarshal_set_active(void *object, void *data, size_t siz
|
|||
"b", &active, NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
pw_resource_do(resource, struct pw_client_node_proxy_methods, set_active, active);
|
||||
pw_resource_do(resource, struct pw_client_node_proxy_methods, set_active, 0, active);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -870,7 +870,7 @@ static int client_node_demarshal_event_method(void *object, void *data, size_t s
|
|||
"O", &event, NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
pw_resource_do(resource, struct pw_client_node_proxy_methods, event, event);
|
||||
pw_resource_do(resource, struct pw_client_node_proxy_methods, event, 0, event);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -883,7 +883,7 @@ static int client_node_demarshal_destroy(void *object, void *data, size_t size)
|
|||
if (spa_pod_parser_get(&prs, "[", NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
pw_resource_do(resource, struct pw_client_node_proxy_methods, destroy);
|
||||
pw_resource_do(resource, struct pw_client_node_proxy_methods, destroy, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue