mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
protocol: add flags to protocol marshal
Allows us to to select marshallers for implementation and binding.
This commit is contained in:
parent
d1e331e268
commit
8ddf579cc0
11 changed files with 150 additions and 92 deletions
|
|
@ -527,12 +527,13 @@ pw_protocol_native_device_event_demarshal[SPA_DEVICE_EVENT_NUM] =
|
|||
static const struct pw_protocol_marshal pw_protocol_native_client_device_marshal = {
|
||||
SPA_TYPE_INTERFACE_Device,
|
||||
SPA_VERSION_DEVICE,
|
||||
PW_PROTOCOL_MARSHAL_FLAG_IMPL,
|
||||
SPA_DEVICE_EVENT_NUM,
|
||||
SPA_DEVICE_METHOD_NUM,
|
||||
&pw_protocol_native_device_event_marshal,
|
||||
pw_protocol_native_device_event_demarshal,
|
||||
&pw_protocol_native_device_method_marshal,
|
||||
pw_protocol_native_device_method_demarshal,
|
||||
.client_marshal = &pw_protocol_native_device_event_marshal,
|
||||
.server_demarshal = pw_protocol_native_device_event_demarshal,
|
||||
.server_marshal = &pw_protocol_native_device_method_marshal,
|
||||
.client_demarshal = pw_protocol_native_device_method_demarshal,
|
||||
};
|
||||
|
||||
struct pw_protocol *pw_protocol_native_ext_client_device_init(struct pw_core *core)
|
||||
|
|
|
|||
|
|
@ -1150,12 +1150,13 @@ pw_protocol_native_client_node_event_demarshal[PW_CLIENT_NODE_PROXY_EVENT_NUM] =
|
|||
static const struct pw_protocol_marshal pw_protocol_native_client_node_marshal = {
|
||||
PW_TYPE_INTERFACE_ClientNode,
|
||||
PW_VERSION_CLIENT_NODE,
|
||||
0,
|
||||
PW_CLIENT_NODE_PROXY_METHOD_NUM,
|
||||
PW_CLIENT_NODE_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_client_node_method_marshal,
|
||||
&pw_protocol_native_client_node_method_demarshal,
|
||||
&pw_protocol_native_client_node_event_marshal,
|
||||
pw_protocol_native_client_node_event_demarshal,
|
||||
.client_marshal = &pw_protocol_native_client_node_method_marshal,
|
||||
.server_demarshal = &pw_protocol_native_client_node_method_demarshal,
|
||||
.server_marshal = &pw_protocol_native_client_node_event_marshal,
|
||||
.client_demarshal = pw_protocol_native_client_node_event_demarshal,
|
||||
};
|
||||
|
||||
struct pw_protocol *pw_protocol_native_ext_client_node_init(struct pw_core *core)
|
||||
|
|
|
|||
|
|
@ -496,9 +496,10 @@ static const struct pw_protocol_marshal pw_protocol_native_client_node_marshal =
|
|||
PW_VERSION_CLIENT_NODE0,
|
||||
PW_CLIENT_NODE0_PROXY_METHOD_NUM,
|
||||
PW_CLIENT_NODE0_PROXY_EVENT_NUM,
|
||||
0,
|
||||
NULL,
|
||||
&pw_protocol_native_client_node_method_demarshal,
|
||||
&pw_protocol_native_client_node_event_marshal,
|
||||
.server_demarshal = &pw_protocol_native_client_node_method_demarshal,
|
||||
.server_marshal = &pw_protocol_native_client_node_event_marshal,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -170,10 +170,10 @@ process_messages(struct client_data *data)
|
|||
}
|
||||
|
||||
marshal = pw_resource_get_marshal(resource);
|
||||
if (marshal == NULL || msg->opcode >= marshal->n_methods)
|
||||
if (marshal == NULL || msg->opcode >= marshal->n_client_methods)
|
||||
goto invalid_method;
|
||||
|
||||
demarshal = marshal->method_demarshal;
|
||||
demarshal = marshal->server_demarshal;
|
||||
if (!demarshal[msg->opcode].func) {
|
||||
res = -ENOENT;
|
||||
goto invalid_message;
|
||||
|
|
@ -633,14 +633,14 @@ on_remote_data(void *data, int fd, uint32_t mask)
|
|||
}
|
||||
|
||||
marshal = pw_proxy_get_marshal(proxy);
|
||||
if (marshal == NULL || msg->opcode >= marshal->n_events) {
|
||||
if (marshal == NULL || msg->opcode >= marshal->n_server_methods) {
|
||||
pw_log_error(NAME" %p: invalid method %u for %u (%d)",
|
||||
this, msg->opcode, msg->id,
|
||||
marshal ? marshal->n_events : (uint32_t)-1);
|
||||
marshal ? marshal->n_server_methods : (uint32_t)-1);
|
||||
continue;
|
||||
}
|
||||
|
||||
demarshal = marshal->event_demarshal;
|
||||
demarshal = marshal->client_demarshal;
|
||||
if (!demarshal[msg->opcode].func) {
|
||||
pw_log_error(NAME" %p: function %d not implemented on %u",
|
||||
this, msg->opcode, msg->id);
|
||||
|
|
|
|||
|
|
@ -1914,12 +1914,13 @@ pw_protocol_native_core_event_demarshal[PW_CORE_PROXY_EVENT_NUM] =
|
|||
static const struct pw_protocol_marshal pw_protocol_native_core_marshal = {
|
||||
PW_TYPE_INTERFACE_Core,
|
||||
PW_VERSION_CORE_PROXY,
|
||||
0,
|
||||
PW_CORE_PROXY_METHOD_NUM,
|
||||
PW_CORE_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_core_method_marshal,
|
||||
pw_protocol_native_core_method_demarshal,
|
||||
&pw_protocol_native_core_event_marshal,
|
||||
pw_protocol_native_core_event_demarshal,
|
||||
.client_marshal = &pw_protocol_native_core_method_marshal,
|
||||
.server_demarshal = pw_protocol_native_core_method_demarshal,
|
||||
.server_marshal = &pw_protocol_native_core_event_marshal,
|
||||
.client_demarshal = pw_protocol_native_core_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_registry_proxy_methods pw_protocol_native_registry_method_marshal = {
|
||||
|
|
@ -1953,12 +1954,13 @@ pw_protocol_native_registry_event_demarshal[PW_REGISTRY_PROXY_EVENT_NUM] =
|
|||
const struct pw_protocol_marshal pw_protocol_native_registry_marshal = {
|
||||
PW_TYPE_INTERFACE_Registry,
|
||||
PW_VERSION_REGISTRY_PROXY,
|
||||
0,
|
||||
PW_REGISTRY_PROXY_METHOD_NUM,
|
||||
PW_REGISTRY_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_registry_method_marshal,
|
||||
pw_protocol_native_registry_method_demarshal,
|
||||
&pw_protocol_native_registry_event_marshal,
|
||||
pw_protocol_native_registry_event_demarshal,
|
||||
.client_marshal = &pw_protocol_native_registry_method_marshal,
|
||||
.server_demarshal = pw_protocol_native_registry_method_demarshal,
|
||||
.server_marshal = &pw_protocol_native_registry_event_marshal,
|
||||
.client_demarshal = pw_protocol_native_registry_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_module_proxy_events pw_protocol_native_module_event_marshal = {
|
||||
|
|
@ -1987,12 +1989,13 @@ pw_protocol_native_module_method_demarshal[PW_MODULE_PROXY_METHOD_NUM] =
|
|||
const struct pw_protocol_marshal pw_protocol_native_module_marshal = {
|
||||
PW_TYPE_INTERFACE_Module,
|
||||
PW_VERSION_MODULE_PROXY,
|
||||
0,
|
||||
PW_MODULE_PROXY_METHOD_NUM,
|
||||
PW_MODULE_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_module_method_marshal,
|
||||
pw_protocol_native_module_method_demarshal,
|
||||
&pw_protocol_native_module_event_marshal,
|
||||
pw_protocol_native_module_event_demarshal,
|
||||
.client_marshal = &pw_protocol_native_module_method_marshal,
|
||||
.server_demarshal = pw_protocol_native_module_method_demarshal,
|
||||
.server_marshal = &pw_protocol_native_module_event_marshal,
|
||||
.client_demarshal = pw_protocol_native_module_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_factory_proxy_events pw_protocol_native_factory_event_marshal = {
|
||||
|
|
@ -2020,12 +2023,13 @@ pw_protocol_native_factory_method_demarshal[PW_FACTORY_PROXY_METHOD_NUM] =
|
|||
const struct pw_protocol_marshal pw_protocol_native_factory_marshal = {
|
||||
PW_TYPE_INTERFACE_Factory,
|
||||
PW_VERSION_FACTORY_PROXY,
|
||||
0,
|
||||
PW_FACTORY_PROXY_METHOD_NUM,
|
||||
PW_FACTORY_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_factory_method_marshal,
|
||||
pw_protocol_native_factory_method_demarshal,
|
||||
&pw_protocol_native_factory_event_marshal,
|
||||
pw_protocol_native_factory_event_demarshal,
|
||||
.client_marshal = &pw_protocol_native_factory_method_marshal,
|
||||
.server_demarshal = pw_protocol_native_factory_method_demarshal,
|
||||
.server_marshal = &pw_protocol_native_factory_event_marshal,
|
||||
.client_demarshal = pw_protocol_native_factory_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_device_proxy_methods pw_protocol_native_device_method_marshal = {
|
||||
|
|
@ -2057,12 +2061,13 @@ pw_protocol_native_device_event_demarshal[PW_DEVICE_PROXY_EVENT_NUM] = {
|
|||
static const struct pw_protocol_marshal pw_protocol_native_device_marshal = {
|
||||
PW_TYPE_INTERFACE_Device,
|
||||
PW_VERSION_DEVICE_PROXY,
|
||||
0,
|
||||
PW_DEVICE_PROXY_METHOD_NUM,
|
||||
PW_DEVICE_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_device_method_marshal,
|
||||
pw_protocol_native_device_method_demarshal,
|
||||
&pw_protocol_native_device_event_marshal,
|
||||
pw_protocol_native_device_event_demarshal,
|
||||
.client_marshal = &pw_protocol_native_device_method_marshal,
|
||||
.server_demarshal = pw_protocol_native_device_method_demarshal,
|
||||
.server_marshal = &pw_protocol_native_device_event_marshal,
|
||||
.client_demarshal = pw_protocol_native_device_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_node_proxy_methods pw_protocol_native_node_method_marshal = {
|
||||
|
|
@ -2099,12 +2104,13 @@ pw_protocol_native_node_event_demarshal[PW_NODE_PROXY_EVENT_NUM] = {
|
|||
static const struct pw_protocol_marshal pw_protocol_native_node_marshal = {
|
||||
PW_TYPE_INTERFACE_Node,
|
||||
PW_VERSION_NODE_PROXY,
|
||||
0,
|
||||
PW_NODE_PROXY_METHOD_NUM,
|
||||
PW_NODE_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_node_method_marshal,
|
||||
pw_protocol_native_node_method_demarshal,
|
||||
&pw_protocol_native_node_event_marshal,
|
||||
pw_protocol_native_node_event_demarshal,
|
||||
.client_marshal = &pw_protocol_native_node_method_marshal,
|
||||
.server_demarshal = pw_protocol_native_node_method_demarshal,
|
||||
.server_marshal = &pw_protocol_native_node_event_marshal,
|
||||
.client_demarshal = pw_protocol_native_node_event_demarshal,
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -2139,12 +2145,13 @@ pw_protocol_native_port_event_demarshal[PW_PORT_PROXY_EVENT_NUM] =
|
|||
static const struct pw_protocol_marshal pw_protocol_native_port_marshal = {
|
||||
PW_TYPE_INTERFACE_Port,
|
||||
PW_VERSION_PORT_PROXY,
|
||||
0,
|
||||
PW_PORT_PROXY_METHOD_NUM,
|
||||
PW_PORT_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_port_method_marshal,
|
||||
pw_protocol_native_port_method_demarshal,
|
||||
&pw_protocol_native_port_event_marshal,
|
||||
pw_protocol_native_port_event_demarshal,
|
||||
.client_marshal = &pw_protocol_native_port_method_marshal,
|
||||
.server_demarshal = pw_protocol_native_port_method_demarshal,
|
||||
.server_marshal = &pw_protocol_native_port_event_marshal,
|
||||
.client_demarshal = pw_protocol_native_port_event_demarshal,
|
||||
};
|
||||
|
||||
static const struct pw_client_proxy_methods pw_protocol_native_client_method_marshal = {
|
||||
|
|
@ -2182,12 +2189,13 @@ pw_protocol_native_client_event_demarshal[PW_CLIENT_PROXY_EVENT_NUM] =
|
|||
static const struct pw_protocol_marshal pw_protocol_native_client_marshal = {
|
||||
PW_TYPE_INTERFACE_Client,
|
||||
PW_VERSION_CLIENT_PROXY,
|
||||
0,
|
||||
PW_CLIENT_PROXY_METHOD_NUM,
|
||||
PW_CLIENT_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_client_method_marshal,
|
||||
pw_protocol_native_client_method_demarshal,
|
||||
&pw_protocol_native_client_event_marshal,
|
||||
pw_protocol_native_client_event_demarshal,
|
||||
.client_marshal = &pw_protocol_native_client_method_marshal,
|
||||
.server_demarshal = pw_protocol_native_client_method_demarshal,
|
||||
.server_marshal = &pw_protocol_native_client_event_marshal,
|
||||
.client_demarshal = pw_protocol_native_client_event_demarshal,
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -2216,12 +2224,13 @@ pw_protocol_native_link_event_demarshal[PW_LINK_PROXY_EVENT_NUM] =
|
|||
static const struct pw_protocol_marshal pw_protocol_native_link_marshal = {
|
||||
PW_TYPE_INTERFACE_Link,
|
||||
PW_VERSION_LINK_PROXY,
|
||||
0,
|
||||
PW_LINK_PROXY_METHOD_NUM,
|
||||
PW_LINK_PROXY_EVENT_NUM,
|
||||
&pw_protocol_native_link_method_marshal,
|
||||
pw_protocol_native_link_method_demarshal,
|
||||
&pw_protocol_native_link_event_marshal,
|
||||
pw_protocol_native_link_event_demarshal,
|
||||
.client_marshal = &pw_protocol_native_link_method_marshal,
|
||||
.server_demarshal = pw_protocol_native_link_method_demarshal,
|
||||
.server_marshal = &pw_protocol_native_link_event_marshal,
|
||||
.client_demarshal = pw_protocol_native_link_event_demarshal,
|
||||
};
|
||||
|
||||
void pw_protocol_native_init(struct pw_protocol *protocol)
|
||||
|
|
|
|||
|
|
@ -1042,6 +1042,7 @@ static const struct pw_protocol_marshal pw_protocol_native_core_marshal = {
|
|||
PW_VERSION_CORE_V0,
|
||||
PW_CORE_PROXY_V0_METHOD_NUM,
|
||||
PW_CORE_PROXY_EVENT_NUM,
|
||||
0,
|
||||
NULL,
|
||||
pw_protocol_native_core_method_demarshal,
|
||||
&pw_protocol_native_core_event_marshal,
|
||||
|
|
@ -1063,6 +1064,7 @@ static const struct pw_protocol_marshal pw_protocol_native_registry_marshal = {
|
|||
PW_VERSION_REGISTRY_V0,
|
||||
PW_REGISTRY_PROXY_V0_METHOD_NUM,
|
||||
PW_REGISTRY_PROXY_EVENT_NUM,
|
||||
0,
|
||||
NULL,
|
||||
pw_protocol_native_registry_method_demarshal,
|
||||
&pw_protocol_native_registry_event_marshal,
|
||||
|
|
@ -1079,6 +1081,7 @@ static const struct pw_protocol_marshal pw_protocol_native_module_marshal = {
|
|||
PW_VERSION_MODULE_V0,
|
||||
0,
|
||||
PW_MODULE_PROXY_EVENT_NUM,
|
||||
0,
|
||||
NULL, NULL,
|
||||
&pw_protocol_native_module_event_marshal,
|
||||
NULL
|
||||
|
|
@ -1094,6 +1097,7 @@ static const struct pw_protocol_marshal pw_protocol_native_factory_marshal = {
|
|||
PW_VERSION_FACTORY_V0,
|
||||
0,
|
||||
PW_FACTORY_PROXY_EVENT_NUM,
|
||||
0,
|
||||
NULL, NULL,
|
||||
&pw_protocol_native_factory_event_marshal,
|
||||
NULL,
|
||||
|
|
@ -1114,6 +1118,7 @@ static const struct pw_protocol_marshal pw_protocol_native_node_marshal = {
|
|||
PW_VERSION_NODE_V0,
|
||||
PW_NODE_PROXY_V0_METHOD_NUM,
|
||||
PW_NODE_PROXY_EVENT_NUM,
|
||||
0,
|
||||
NULL,
|
||||
pw_protocol_native_node_method_demarshal,
|
||||
&pw_protocol_native_node_event_marshal,
|
||||
|
|
@ -1136,6 +1141,7 @@ static const struct pw_protocol_marshal pw_protocol_native_port_marshal = {
|
|||
PW_VERSION_PORT_V0,
|
||||
PW_PORT_PROXY_V0_METHOD_NUM,
|
||||
PW_PORT_PROXY_EVENT_NUM,
|
||||
0,
|
||||
NULL,
|
||||
pw_protocol_native_port_method_demarshal,
|
||||
&pw_protocol_native_port_event_marshal,
|
||||
|
|
@ -1153,6 +1159,7 @@ static const struct pw_protocol_marshal pw_protocol_native_client_marshal = {
|
|||
PW_VERSION_CLIENT_V0,
|
||||
0,
|
||||
PW_CLIENT_PROXY_EVENT_NUM,
|
||||
0,
|
||||
NULL, NULL,
|
||||
&pw_protocol_native_client_event_marshal,
|
||||
NULL,
|
||||
|
|
@ -1168,6 +1175,7 @@ static const struct pw_protocol_marshal pw_protocol_native_link_marshal = {
|
|||
PW_VERSION_LINK_V0,
|
||||
0,
|
||||
PW_LINK_PROXY_EVENT_NUM,
|
||||
0,
|
||||
NULL, NULL,
|
||||
&pw_protocol_native_link_event_marshal,
|
||||
NULL
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue