interfaces: improve remote API

Add return values to events and method callbacks. This makes it
possible to pass any error or async return value.
Add sync/done/error in both directions so that both proxy and resource
and perform/reply sync and produce errors.
Return a SPA_ASYNC from remote method calls (and events), keep the
sequence number in the connection.
With the core sync/done we can remove the client-node done method and
it's internal sequence number along with the seq number in method calls.
We can also use the method/event async return value to perform a sync
with as the unique sequence number for this method.
Add sync method and done/error event to proxy and resource.
This commit is contained in:
Wim Taymans 2019-02-18 12:31:36 +01:00
parent 0d8821096a
commit eea062ee53
41 changed files with 1180 additions and 817 deletions

View file

@ -476,8 +476,7 @@ on_remote_data(void *data, int fd, enum spa_io mask)
if (mask & SPA_IO_IN) {
uint8_t opcode;
uint32_t id;
uint32_t size;
uint32_t id, size;
void *message;
while (!impl->disconnecting
@ -773,11 +772,11 @@ static int impl_ext_get_proxy_fd(struct pw_proxy *proxy, uint32_t index)
return pw_protocol_native_connection_get_fd(impl->connection, index);
}
static void impl_ext_end_proxy(struct pw_proxy *proxy,
static int impl_ext_end_proxy(struct pw_proxy *proxy,
struct spa_pod_builder *builder)
{
struct client *impl = SPA_CONTAINER_OF(proxy->remote->conn, struct client, this);
pw_protocol_native_connection_end(impl->connection, builder);
return pw_protocol_native_connection_end(impl->connection, builder);
}
static struct spa_pod_builder *
@ -798,11 +797,11 @@ static int impl_ext_get_resource_fd(struct pw_resource *resource, uint32_t index
return pw_protocol_native_connection_get_fd(data->connection, index);
}
static void impl_ext_end_resource(struct pw_resource *resource,
static int impl_ext_end_resource(struct pw_resource *resource,
struct spa_pod_builder *builder)
{
struct client_data *data = resource->client->user_data;
pw_protocol_native_connection_end(data->connection, builder);
return pw_protocol_native_connection_end(data->connection, builder);
}
const static struct pw_protocol_native_ext protocol_ext_impl = {