Improve async handling

Don't use special callback in node to receive the results. Instead,
use a generic result callback to receive the result. This makes things
a bit more symetric and generic again because then you can choose how
to match the result to the request and you have a generic way to handle
both the sync and async case. We can then also remove the wait method.
This also makes the remote interface and spa interface to objects very
similar.

Make a helper object to receive and dispatch results. Use this in the
helper for enum_params.

Make device use the same result callbacks.
This commit is contained in:
Wim Taymans 2019-02-25 12:29:57 +01:00
parent 98463b689b
commit d2c18c7b1a
64 changed files with 1298 additions and 1141 deletions

View file

@ -97,6 +97,8 @@ struct data {
bool rebuild_fds;
struct pollfd fds[16];
unsigned int n_fds;
struct spa_pending_queue pending;
};
#define MIN_LATENCY 1024
@ -375,7 +377,8 @@ static int negotiate_formats(struct data *data)
if ((res = spa_node_port_enum_params_sync(data->sink,
SPA_DIRECTION_INPUT, 0,
SPA_PARAM_EnumFormat, &state,
filter, &format, &b)) != 1)
filter, &format, &b,
&data->pending)) != 1)
return -EBADF;
spa_log_debug(&default_log.log, "sink set_param");
@ -511,6 +514,8 @@ int main(int argc, char *argv[])
data.data_loop.remove_source = do_remove_source;
data.data_loop.invoke = do_invoke;
spa_pending_queue_init(&data.pending);
if ((str = getenv("SPA_DEBUG")))
data.log->level = atoi(str);