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

@ -184,16 +184,6 @@ static int make_node(struct data *data, struct spa_node **node, const char *lib,
return -EBADF;
}
static void on_sink_done(void *data, int seq, int res)
{
printf("got done %d %d\n", seq, res);
}
static void on_sink_event(void *data, struct spa_event *event)
{
printf("got event %d\n", SPA_EVENT_TYPE(event));
}
static void update_props(struct data *data)
{
struct spa_pod_builder b;
@ -233,7 +223,7 @@ static void update_props(struct data *data)
data->volume_accum -= M_PI_M2;
}
static void on_sink_ready(void *_data, int status)
static int on_sink_ready(void *_data, int status)
{
struct data *data = _data;
@ -241,20 +231,20 @@ static void on_sink_ready(void *_data, int status)
spa_graph_node_process(&data->source_node);
spa_graph_node_process(&data->sink_node);
return 0;
}
static void
static int
on_sink_reuse_buffer(void *_data, uint32_t port_id, uint32_t buffer_id)
{
struct data *data = _data;
data->source_sink_io[0].buffer_id = buffer_id;
return 0;
}
static const struct spa_node_callbacks sink_callbacks = {
SPA_VERSION_NODE_CALLBACKS,
.done = on_sink_done,
.event = on_sink_event,
.ready = on_sink_ready,
.reuse_buffer = on_sink_reuse_buffer
};