session-manager: fix protocol

Add separate types for interfaces and implementation
Fix some bugs in the protocol
Add some introspection support in cli
This commit is contained in:
Wim Taymans 2019-11-04 16:42:55 +01:00
parent 29254b688a
commit 085f1822b9
9 changed files with 166 additions and 27 deletions

View file

@ -251,7 +251,7 @@ int client_endpoint_factory_init(struct pw_module *module)
factory = pw_factory_new(core,
"client-endpoint",
PW_TYPE_INTERFACE_Endpoint,
PW_TYPE_INTERFACE_ClientEndpoint,
PW_VERSION_CLIENT_ENDPOINT_PROXY,
NULL,
sizeof(*data));

View file

@ -251,7 +251,7 @@ int client_session_factory_init(struct pw_module *module)
factory = pw_factory_new(core,
"client-session",
PW_TYPE_INTERFACE_Session,
PW_TYPE_INTERFACE_ClientSession,
PW_VERSION_CLIENT_SESSION_PROXY,
NULL,
sizeof(*data));

View file

@ -208,7 +208,7 @@ int endpoint_stream_update(struct endpoint_stream *this,
}
if (!this->info.name)
this->info.name = strdup(info->name);
this->info.name = info->name ? strdup(info->name) : NULL;
this->info.change_mask = info->change_mask;
spa_list_for_each(resource, &this->global->resource_list, link) {

View file

@ -286,6 +286,7 @@ int endpoint_init(struct endpoint *this,
const char *keys[] = {
PW_KEY_FACTORY_ID,
PW_KEY_CLIENT_ID,
PW_KEY_DEVICE_ID,
NULL
};

View file

@ -144,8 +144,6 @@ do { \
SPA_POD_Int(&version), \
SPA_POD_Int(&(info)->id), \
SPA_POD_Int(&(info)->change_mask), \
SPA_POD_Int(&(info)->n_params), \
SPA_POD_Int(&(info)->props->n_items), \
NULL) < 0) \
return -EINVAL; \
\
@ -314,7 +312,8 @@ static int client_endpoint_marshal_set_id (void *object, uint32_t id)
b = pw_protocol_native_begin_resource(resource,
PW_CLIENT_ENDPOINT_PROXY_EVENT_SET_ID, NULL);
spa_pod_builder_add (b, SPA_POD_Int(id), NULL);
spa_pod_builder_add_struct(b,
SPA_POD_Int(id));
return pw_protocol_native_end_resource(resource, b);
}
@ -327,7 +326,8 @@ static int client_endpoint_marshal_set_session_id (void *object, uint32_t id)
b = pw_protocol_native_begin_resource(resource,
PW_CLIENT_ENDPOINT_PROXY_EVENT_SET_SESSION_ID, NULL);
spa_pod_builder_add (b, SPA_POD_Int(id), NULL);
spa_pod_builder_add_struct(b,
SPA_POD_Int(id));
return pw_protocol_native_end_resource(resource, b);
}
@ -573,7 +573,7 @@ static int client_endpoint_demarshal_stream_update(void *object,
spa_pod_parser_init(&prs[0], msg->data, msg->size);
if (spa_pod_parser_push_struct(&prs[0], &f[0]) < 0 ||
spa_pod_parser_get(&prs[0],
SPA_POD_Int(&stream_id),
SPA_POD_Int(&stream_id),
SPA_POD_Int(&change_mask),
SPA_POD_Int(&n_params), NULL) < 0)
return -EINVAL;
@ -630,9 +630,9 @@ pw_protocol_native_client_endpoint_method_demarshal[PW_CLIENT_ENDPOINT_PROXY_MET
};
static const struct pw_protocol_marshal pw_protocol_native_client_endpoint_marshal = {
PW_TYPE_INTERFACE_Endpoint,
PW_TYPE_INTERFACE_ClientEndpoint,
PW_VERSION_CLIENT_ENDPOINT_PROXY,
PW_PROTOCOL_MARSHAL_FLAG_IMPL,
0,
PW_CLIENT_ENDPOINT_PROXY_METHOD_NUM,
PW_CLIENT_ENDPOINT_PROXY_EVENT_NUM,
&pw_protocol_native_client_endpoint_method_marshal,
@ -653,7 +653,8 @@ static int client_session_marshal_set_id (void *object, uint32_t id)
b = pw_protocol_native_begin_resource(resource,
PW_CLIENT_SESSION_PROXY_EVENT_SET_ID, NULL);
spa_pod_builder_add (b, SPA_POD_Int(id), NULL);
spa_pod_builder_add_struct(b,
SPA_POD_Int(id));
return pw_protocol_native_end_resource(resource, b);
}
@ -719,7 +720,8 @@ static int client_session_marshal_destroy_link (void *object, uint32_t link_id)
b = pw_protocol_native_begin_resource(resource,
PW_CLIENT_SESSION_PROXY_EVENT_DESTROY_LINK, NULL);
spa_pod_builder_add(b, SPA_POD_Int(link_id), NULL);
spa_pod_builder_add_struct(b,
SPA_POD_Int(link_id));
return pw_protocol_native_end_resource(resource, b);
}
@ -1037,9 +1039,9 @@ pw_protocol_native_client_session_method_demarshal[PW_CLIENT_SESSION_PROXY_METHO
};
static const struct pw_protocol_marshal pw_protocol_native_client_session_marshal = {
PW_TYPE_INTERFACE_Session,
PW_TYPE_INTERFACE_ClientSession,
PW_VERSION_CLIENT_SESSION_PROXY,
PW_PROTOCOL_MARSHAL_FLAG_IMPL,
0,
PW_CLIENT_SESSION_PROXY_METHOD_NUM,
PW_CLIENT_SESSION_PROXY_EVENT_NUM,
&pw_protocol_native_client_session_method_marshal,