Add support for async results

Add an async result code and an event to signal the completion.
Use async return values to signal completion of a method and potential
state change.
Add selected format to port update message.
Make it possible to parse into a custom copy of the command memory.
Remove state change events from the elements, we now just update the
state.
Implement async results in the proxy element
Add support for removing buffers in the client.
Fix up pinossink
Deal with async return in the links.
This commit is contained in:
Wim Taymans 2016-09-22 08:55:30 +02:00
parent 27acab7532
commit 68148188fa
25 changed files with 456 additions and 406 deletions

View file

@ -34,7 +34,7 @@
#define PINOS_LINK_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), PINOS_TYPE_LINK, PinosLinkPrivate))
#define MAX_BUFFERS 64
#define MAX_BUFFERS 16
struct _PinosLinkPrivate
{
@ -498,7 +498,7 @@ do_allocation (PinosLink *this, SpaNodeState in_state, SpaNodeState out_state)
}
g_debug ("allocated out_buffers %p from output port", priv->out_buffers);
}
else if (in_flags & SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS) {
if (in_flags & SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS) {
g_debug ("using out_buffers %p on input port", priv->out_buffers);
if ((res = spa_node_port_use_buffers (this->input_node->node, this->input_port,
priv->out_buffers, priv->n_out_buffers)) < 0) {
@ -563,6 +563,7 @@ check_states (PinosLink *this)
SpaResult res;
SpaNodeState in_state, out_state;
again:
in_state = this->input_node->node->state;
out_state = this->output_node->node->state;
@ -577,9 +578,21 @@ check_states (PinosLink *this)
if ((res = do_start (this, in_state, out_state)) < 0)
return res;
if (this->input_node->node->state != in_state)
goto again;
if (this->output_node->node->state != out_state)
goto again;
return SPA_RESULT_OK;
}
static gboolean
do_check_states (PinosLink *this)
{
check_states (this);
return G_SOURCE_REMOVE;
}
static void
on_node_state_notify (GObject *obj,
GParamSpec *pspec,
@ -588,7 +601,7 @@ on_node_state_notify (GObject *obj,
PinosLink *this = user_data;
g_debug ("link %p: node %p state change", this, obj);
check_states (this);
g_idle_add ((GSourceFunc) do_check_states, this);
}
static void