Make done event on node

Replace the AsyncDone event with an explicit done callback in the node
to signal completion of an async operation.
Pass read and write fd together with the transport
This commit is contained in:
Wim Taymans 2017-06-09 17:24:18 +02:00
parent 0af8377d10
commit 34450ed7ed
24 changed files with 268 additions and 254 deletions

View file

@ -215,6 +215,11 @@ static int make_node(struct data *data, struct spa_node **node, const char *lib,
return SPA_RESULT_ERROR;
}
static void on_sink_done(struct spa_node *node, int seq, int res, void *user_data)
{
printf("got done %d %d\n", seq, res);
}
static void on_sink_event(struct spa_node *node, struct spa_event *event, void *user_data)
{
printf("got event %d\n", SPA_EVENT_TYPE(event));
@ -239,6 +244,7 @@ on_sink_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id
}
static const struct spa_node_callbacks sink_callbacks = {
&on_sink_done,
&on_sink_event,
&on_sink_need_input,
NULL,

View file

@ -226,6 +226,11 @@ static int make_node(struct data *data, struct spa_node **node, const char *lib,
return SPA_RESULT_ERROR;
}
static void on_sink_done(struct spa_node *node, int seq, int res, void *user_data)
{
printf("got done %d %d\n", seq, res);
}
static void on_sink_event(struct spa_node *node, struct spa_event *event, void *user_data)
{
printf("got event %d\n", SPA_EVENT_TYPE(event));
@ -281,6 +286,7 @@ on_sink_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id
}
static const struct spa_node_callbacks sink_callbacks = {
&on_sink_done,
&on_sink_event,
&on_sink_need_input,
NULL,

View file

@ -240,6 +240,12 @@ static void on_source_push(struct data *data)
}
}
static void on_sink_done(struct spa_node *node, int seq, int res, void *user_data)
{
struct data *data = user_data;
spa_log_trace(data->log, "got sink done %d %d", seq, res);
}
static void on_sink_event(struct spa_node *node, struct spa_event *event, void *user_data)
{
struct data *data = user_data;
@ -264,12 +270,19 @@ on_sink_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id
}
static const struct spa_node_callbacks sink_callbacks = {
&on_sink_done,
&on_sink_event,
&on_sink_need_input,
NULL,
&on_sink_reuse_buffer
};
static void on_source_done(struct spa_node *node, int seq, int res, void *user_data)
{
struct data *data = user_data;
spa_log_trace(data->log, "got source done %d %d", seq, res);
}
static void on_source_event(struct spa_node *node, struct spa_event *event, void *user_data)
{
struct data *data = user_data;
@ -286,6 +299,7 @@ static void on_source_have_output(struct spa_node *node, void *user_data)
}
static const struct spa_node_callbacks source_callbacks = {
&on_source_done,
&on_source_event,
NULL,
&on_source_have_output,

View file

@ -205,6 +205,11 @@ static int make_node(struct data *data, struct spa_node **node, const char *lib,
return SPA_RESULT_ERROR;
}
static void on_sink_done(struct spa_node *node, int seq, int res, void *user_data)
{
printf("got done %d %d\n", seq, res);
}
static void on_sink_event(struct spa_node *node, struct spa_event *event, void *user_data)
{
printf("got event %d\n", SPA_EVENT_TYPE(event));
@ -231,6 +236,7 @@ on_sink_reuse_buffer(struct spa_node *node, uint32_t port_id, uint32_t buffer_id
}
static const struct spa_node_callbacks sink_callbacks = {
&on_sink_done,
&on_sink_event,
&on_sink_need_input,
NULL,

View file

@ -176,6 +176,11 @@ static void handle_events(struct data *data)
}
}
static void on_source_done(struct spa_node *node, int seq, int res, void *user_data)
{
printf("got done %d %d\n", seq, res);
}
static void on_source_event(struct spa_node *node, struct spa_event *event, void *user_data)
{
struct data *data = user_data;
@ -256,6 +261,7 @@ static void on_source_have_output(struct spa_node *node, void *user_data)
}
static const struct spa_node_callbacks source_callbacks = {
&on_source_done,
&on_source_event,
NULL,
&on_source_have_output,