mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
Use errno for result errors
Make new enumeration for data transport status and use errno style error numbers for errors.
This commit is contained in:
parent
dda28b1589
commit
6fb0f580ea
86 changed files with 2019 additions and 1988 deletions
|
|
@ -70,9 +70,9 @@ struct spa_clock {
|
|||
* can be modified. The modifications will take effect after a call
|
||||
* to spa_clock::set_props.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when clock or props are %NULL
|
||||
* #SPA_RESULT_NOT_IMPLEMENTED when there are no properties
|
||||
* Returns: 0 on success
|
||||
* -EINVAL when clock or props are %NULL
|
||||
* -ENOTSUP when there are no properties
|
||||
* implemented on @clock
|
||||
*/
|
||||
int (*enum_params) (struct spa_clock *clock,
|
||||
|
|
@ -93,12 +93,11 @@ struct spa_clock {
|
|||
*
|
||||
* If @props is NULL, all the properties are reset to their defaults.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when clock is %NULL
|
||||
* #SPA_RESULT_NOT_IMPLEMENTED when no properties can be
|
||||
* Returns: 0 on success
|
||||
* -EINVAL when clock is %NULL
|
||||
* -ENOTSUP when no properties can be
|
||||
* modified on @clock.
|
||||
* #SPA_RESULT_WRONG_PROPERTY_TYPE when a property has the wrong
|
||||
* type.
|
||||
* -ENOENT when the param with id is not supported
|
||||
*/
|
||||
int (*set_param) (struct spa_clock *clock,
|
||||
uint32_t id, uint32_t flags,
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ static inline void spa_graph_data_port_check(struct spa_graph_data *data, struct
|
|||
struct spa_graph_node *node = port->node;
|
||||
uint32_t required = node->required[SPA_DIRECTION_INPUT];
|
||||
|
||||
if (port->io->status == SPA_RESULT_HAVE_BUFFER)
|
||||
if (port->io->status == SPA_STATUS_HAVE_BUFFER)
|
||||
node->ready[SPA_DIRECTION_INPUT]++;
|
||||
|
||||
spa_debug("port %p node %p check %d %d %d", port, node,
|
||||
|
|
@ -85,9 +85,9 @@ static inline bool spa_graph_data_iterate(struct spa_graph_data *data)
|
|||
switch (n->state) {
|
||||
case SPA_GRAPH_STATE_IN:
|
||||
state = spa_node_process_input(n->implementation);
|
||||
if (state == SPA_RESULT_NEED_BUFFER)
|
||||
if (state == SPA_STATUS_NEED_BUFFER)
|
||||
n->state = SPA_GRAPH_STATE_CHECK_IN;
|
||||
else if (state == SPA_RESULT_HAVE_BUFFER)
|
||||
else if (state == SPA_STATUS_HAVE_BUFFER)
|
||||
n->state = SPA_GRAPH_STATE_CHECK_OUT;
|
||||
spa_debug("node %p processed input state %d", n, n->state);
|
||||
if (n == data->node)
|
||||
|
|
@ -97,9 +97,9 @@ static inline bool spa_graph_data_iterate(struct spa_graph_data *data)
|
|||
|
||||
case SPA_GRAPH_STATE_OUT:
|
||||
state = spa_node_process_output(n->implementation);
|
||||
if (state == SPA_RESULT_NEED_BUFFER)
|
||||
if (state == SPA_STATUS_NEED_BUFFER)
|
||||
n->state = SPA_GRAPH_STATE_CHECK_IN;
|
||||
else if (state == SPA_RESULT_HAVE_BUFFER)
|
||||
else if (state == SPA_STATUS_HAVE_BUFFER)
|
||||
n->state = SPA_GRAPH_STATE_CHECK_OUT;
|
||||
spa_debug("node %p processed output state %d", n, n->state);
|
||||
spa_list_append(&data->ready, &n->ready_link);
|
||||
|
|
@ -109,14 +109,14 @@ static inline bool spa_graph_data_iterate(struct spa_graph_data *data)
|
|||
n->ready[SPA_DIRECTION_INPUT] = 0;
|
||||
spa_list_for_each(p, &n->ports[SPA_DIRECTION_INPUT], link) {
|
||||
struct spa_graph_node *pn = p->peer->node;
|
||||
if (p->io->status == SPA_RESULT_NEED_BUFFER) {
|
||||
if (p->io->status == SPA_STATUS_NEED_BUFFER) {
|
||||
if (pn != data->node
|
||||
|| pn->flags & SPA_GRAPH_NODE_FLAG_ASYNC) {
|
||||
pn->state = SPA_GRAPH_STATE_OUT;
|
||||
spa_list_append(&data->ready,
|
||||
&pn->ready_link);
|
||||
}
|
||||
} else if (p->io->status == SPA_RESULT_OK)
|
||||
} else if (p->io->status == SPA_STATUS_OK)
|
||||
n->ready[SPA_DIRECTION_INPUT]++;
|
||||
}
|
||||
case SPA_GRAPH_STATE_CHECK_OUT:
|
||||
|
|
@ -143,7 +143,7 @@ static inline int spa_graph_impl_need_input(void *data, struct spa_graph_node *n
|
|||
|
||||
while(spa_graph_data_iterate(data));
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *node)
|
||||
|
|
@ -157,7 +157,7 @@ static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *
|
|||
|
||||
while(spa_graph_data_iterate(data));
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct spa_graph_callbacks spa_graph_impl_default = {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ static inline int spa_graph_scheduler_default(struct spa_graph_node *node)
|
|||
else if (node->action == SPA_GRAPH_ACTION_OUT)
|
||||
res = spa_node_process_output(n);
|
||||
else
|
||||
res = SPA_RESULT_ERROR;
|
||||
res = -EBADF;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ static inline void spa_graph_port_check(struct spa_graph *graph, struct spa_grap
|
|||
{
|
||||
struct spa_graph_node *node = port->node;
|
||||
|
||||
if (port->io->status == SPA_RESULT_HAVE_BUFFER)
|
||||
if (port->io->status == SPA_STATUS_HAVE_BUFFER)
|
||||
node->ready++;
|
||||
|
||||
spa_debug("port %p node %p check %d %d %d", port, node, port->io->status, node->ready, node->required);
|
||||
|
|
@ -65,7 +65,7 @@ static inline void spa_graph_node_update(struct spa_graph *graph, struct spa_gra
|
|||
|
||||
node->ready = 0;
|
||||
spa_list_for_each(p, &node->ports[SPA_DIRECTION_INPUT], link) {
|
||||
if (p->io->status == SPA_RESULT_OK && !(node->flags & SPA_GRAPH_NODE_FLAG_ASYNC))
|
||||
if (p->io->status == SPA_STATUS_OK && !(node->flags & SPA_GRAPH_NODE_FLAG_ASYNC))
|
||||
node->ready++;
|
||||
}
|
||||
spa_debug("node %p update %d ready", node, node->ready);
|
||||
|
|
@ -111,11 +111,11 @@ next:
|
|||
|
||||
if (n->state != SPA_GRAPH_STATE_END) {
|
||||
spa_debug("node %p add ready for CHECK", n);
|
||||
if (state == SPA_RESULT_NEED_BUFFER)
|
||||
if (state == SPA_STATUS_NEED_BUFFER)
|
||||
n->state = SPA_GRAPH_STATE_CHECK_IN;
|
||||
else if (state == SPA_RESULT_HAVE_BUFFER)
|
||||
else if (state == SPA_STATUS_HAVE_BUFFER)
|
||||
n->state = SPA_GRAPH_STATE_CHECK_OUT;
|
||||
else if (state == SPA_RESULT_OK)
|
||||
else if (state == SPA_STATUS_OK)
|
||||
n->state = SPA_GRAPH_STATE_CHECK_OK;
|
||||
spa_list_append(&graph->ready, &n->ready_link);
|
||||
}
|
||||
|
|
@ -128,14 +128,14 @@ next:
|
|||
n->ready = 0;
|
||||
spa_list_for_each(p, &n->ports[SPA_DIRECTION_INPUT], link) {
|
||||
struct spa_graph_node *pn = p->peer->node;
|
||||
if (p->io->status == SPA_RESULT_NEED_BUFFER) {
|
||||
if (p->io->status == SPA_STATUS_NEED_BUFFER) {
|
||||
if (pn != graph->node
|
||||
|| pn->flags & SPA_GRAPH_NODE_FLAG_ASYNC) {
|
||||
pn->state = SPA_GRAPH_STATE_OUT;
|
||||
spa_debug("node %p add ready OUT", n);
|
||||
spa_list_append(&graph->ready, &pn->ready_link);
|
||||
}
|
||||
} else if (p->io->status == SPA_RESULT_OK)
|
||||
} else if (p->io->status == SPA_STATUS_OK)
|
||||
n->ready++;
|
||||
}
|
||||
break;
|
||||
|
|
@ -162,7 +162,7 @@ next:
|
|||
static inline void spa_graph_scheduler_pull(struct spa_graph *graph, struct spa_graph_node *node)
|
||||
{
|
||||
node->action = SPA_GRAPH_ACTION_CHECK;
|
||||
node->state = SPA_RESULT_NEED_BUFFER;
|
||||
node->state = SPA_STATUS_NEED_BUFFER;
|
||||
graph->node = node;
|
||||
spa_debug("node %p start pull", node);
|
||||
if (node->ready_link.next == NULL)
|
||||
|
|
|
|||
|
|
@ -44,11 +44,11 @@ static inline int spa_graph_impl_need_input(void *data, struct spa_graph_node *n
|
|||
continue;
|
||||
pnode = pport->node;
|
||||
spa_debug("node %p peer %p io %d %d", node, pnode, pport->io->status, pport->io->buffer_id);
|
||||
if (pport->io->status == SPA_RESULT_NEED_BUFFER) {
|
||||
if (pport->io->status == SPA_STATUS_NEED_BUFFER) {
|
||||
if (pnode->ready_link.next == NULL)
|
||||
spa_list_append(&ready, &pnode->ready_link);
|
||||
}
|
||||
else if (pport->io->status == SPA_RESULT_OK &&
|
||||
else if (pport->io->status == SPA_STATUS_OK &&
|
||||
!(pnode->flags & SPA_GRAPH_NODE_FLAG_ASYNC))
|
||||
node->ready[SPA_DIRECTION_INPUT]++;
|
||||
}
|
||||
|
|
@ -56,11 +56,11 @@ static inline int spa_graph_impl_need_input(void *data, struct spa_graph_node *n
|
|||
spa_list_for_each_safe(n, t, &ready, ready_link) {
|
||||
n->state = spa_node_process_output(n->implementation);
|
||||
spa_debug("peer %p processed out %d", n, n->state);
|
||||
if (n->state == SPA_RESULT_NEED_BUFFER)
|
||||
if (n->state == SPA_STATUS_NEED_BUFFER)
|
||||
spa_graph_need_input(n->graph, n);
|
||||
else {
|
||||
spa_list_for_each(p, &n->ports[SPA_DIRECTION_OUTPUT], link) {
|
||||
if (p->io->status == SPA_RESULT_HAVE_BUFFER)
|
||||
if (p->io->status == SPA_STATUS_HAVE_BUFFER)
|
||||
node->ready[SPA_DIRECTION_INPUT]++;
|
||||
}
|
||||
}
|
||||
|
|
@ -74,15 +74,15 @@ static inline int spa_graph_impl_need_input(void *data, struct spa_graph_node *n
|
|||
node->ready[SPA_DIRECTION_INPUT] == node->required[SPA_DIRECTION_INPUT]) {
|
||||
node->state = spa_node_process_input(node->implementation);
|
||||
spa_debug("node %p processed in %d", node, node->state);
|
||||
if (node->state == SPA_RESULT_HAVE_BUFFER) {
|
||||
if (node->state == SPA_STATUS_HAVE_BUFFER) {
|
||||
spa_list_for_each(p, &node->ports[SPA_DIRECTION_OUTPUT], link) {
|
||||
if (p->io->status == SPA_RESULT_HAVE_BUFFER)
|
||||
if (p->io->status == SPA_STATUS_HAVE_BUFFER)
|
||||
if (p->peer)
|
||||
p->peer->node->ready[SPA_DIRECTION_INPUT]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *node)
|
||||
|
|
@ -106,7 +106,7 @@ static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *
|
|||
}
|
||||
|
||||
pnode = pport->node;
|
||||
if (pport->io->status == SPA_RESULT_HAVE_BUFFER)
|
||||
if (pport->io->status == SPA_STATUS_HAVE_BUFFER)
|
||||
pnode->ready[SPA_DIRECTION_INPUT]++;
|
||||
|
||||
pready = pnode->ready[SPA_DIRECTION_INPUT];
|
||||
|
|
@ -123,12 +123,12 @@ static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *
|
|||
spa_list_for_each_safe(n, t, &ready, ready_link) {
|
||||
n->state = spa_node_process_input(n->implementation);
|
||||
spa_debug("node %p chain processed in %d", n, n->state);
|
||||
if (n->state == SPA_RESULT_HAVE_BUFFER)
|
||||
if (n->state == SPA_STATUS_HAVE_BUFFER)
|
||||
spa_graph_have_output(n->graph, n);
|
||||
else {
|
||||
n->ready[SPA_DIRECTION_INPUT] = 0;
|
||||
spa_list_for_each(p, &n->ports[SPA_DIRECTION_INPUT], link) {
|
||||
if (p->io->status == SPA_RESULT_OK &&
|
||||
if (p->io->status == SPA_STATUS_OK &&
|
||||
!(n->flags & SPA_GRAPH_NODE_FLAG_ASYNC))
|
||||
n->ready[SPA_DIRECTION_INPUT]++;
|
||||
}
|
||||
|
|
@ -139,14 +139,14 @@ static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *
|
|||
|
||||
node->state = spa_node_process_output(node->implementation);
|
||||
spa_debug("node %p processed out %d", node, node->state);
|
||||
if (node->state == SPA_RESULT_NEED_BUFFER) {
|
||||
if (node->state == SPA_STATUS_NEED_BUFFER) {
|
||||
node->ready[SPA_DIRECTION_INPUT] = 0;
|
||||
spa_list_for_each(p, &node->ports[SPA_DIRECTION_INPUT], link) {
|
||||
if (p->io->status == SPA_RESULT_OK && !(node->flags & SPA_GRAPH_NODE_FLAG_ASYNC))
|
||||
if (p->io->status == SPA_STATUS_OK && !(node->flags & SPA_GRAPH_NODE_FLAG_ASYNC))
|
||||
node->ready[SPA_DIRECTION_INPUT]++;
|
||||
}
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct spa_graph_callbacks spa_graph_impl_default = {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ static inline void check_input(struct spa_graph_node *node)
|
|||
debug("node %p input peer %p io %d %d\n", node, pnode, pport->io->status, pport->io->buffer_id);
|
||||
|
||||
pnode->ready[SPA_DIRECTION_OUTPUT]++;
|
||||
if (pport->io->status == SPA_RESULT_OK)
|
||||
if (pport->io->status == SPA_STATUS_OK)
|
||||
node->ready[SPA_DIRECTION_INPUT]++;
|
||||
|
||||
debug("node %p input peer %p out %d %d\n", node, pnode,
|
||||
|
|
@ -81,7 +81,7 @@ static inline void check_output(struct spa_graph_node *node)
|
|||
pnode = pport->node;
|
||||
debug("node %p output peer %p io %d %d\n", node, pnode, pport->io->status, pport->io->buffer_id);
|
||||
|
||||
if (pport->io->status == SPA_RESULT_HAVE_BUFFER) {
|
||||
if (pport->io->status == SPA_STATUS_HAVE_BUFFER) {
|
||||
pnode->ready[SPA_DIRECTION_INPUT]++;
|
||||
node->required[SPA_DIRECTION_OUTPUT]++;
|
||||
}
|
||||
|
|
@ -97,21 +97,21 @@ static inline void spa_graph_impl_activate(void *data, struct spa_graph_node *no
|
|||
int res;
|
||||
|
||||
debug("node %p activate %d\n", node, node->state);
|
||||
if (node->state == SPA_RESULT_NEED_BUFFER) {
|
||||
if (node->state == SPA_STATUS_NEED_BUFFER) {
|
||||
res = spa_node_process_input(node->implementation);
|
||||
debug("node %p process in %d\n", node, res);
|
||||
}
|
||||
else if (node->state == SPA_RESULT_HAVE_BUFFER) {
|
||||
else if (node->state == SPA_STATUS_HAVE_BUFFER) {
|
||||
res = spa_node_process_output(node->implementation);
|
||||
debug("node %p process out %d\n", node, res);
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
if (res == SPA_RESULT_NEED_BUFFER || (res == SPA_RESULT_OK && node->state == SPA_RESULT_NEED_BUFFER)) {
|
||||
if (res == SPA_STATUS_NEED_BUFFER || (res == SPA_STATUS_OK && node->state == SPA_STATUS_NEED_BUFFER)) {
|
||||
check_input(node);
|
||||
}
|
||||
else if (res == SPA_RESULT_HAVE_BUFFER) {
|
||||
else if (res == SPA_STATUS_HAVE_BUFFER) {
|
||||
check_output(node);
|
||||
}
|
||||
node->state = res;
|
||||
|
|
@ -125,7 +125,7 @@ static inline int spa_graph_impl_need_input(void *data, struct spa_graph_node *n
|
|||
|
||||
debug("node %p start pull\n", node);
|
||||
|
||||
node->state = SPA_RESULT_NEED_BUFFER;
|
||||
node->state = SPA_STATUS_NEED_BUFFER;
|
||||
node->ready[SPA_DIRECTION_INPUT] = 0;
|
||||
|
||||
spa_list_for_each(p, &node->ports[SPA_DIRECTION_INPUT], link) {
|
||||
|
|
@ -140,19 +140,19 @@ static inline int spa_graph_impl_need_input(void *data, struct spa_graph_node *n
|
|||
debug("node %p pull peer %p io %d %d\n", node, pnode, pport->io->status, pport->io->buffer_id);
|
||||
|
||||
pnode->ready[SPA_DIRECTION_OUTPUT]++;
|
||||
if (pport->io->status == SPA_RESULT_OK)
|
||||
if (pport->io->status == SPA_STATUS_OK)
|
||||
node->ready[SPA_DIRECTION_INPUT]++;
|
||||
|
||||
debug("node %p pull peer %p out %d %d\n", node, pnode, prequired, pnode->ready[SPA_DIRECTION_OUTPUT]);
|
||||
if (prequired > 0 && pnode->ready[SPA_DIRECTION_OUTPUT] >= prequired) {
|
||||
pnode->state = SPA_RESULT_HAVE_BUFFER;
|
||||
pnode->state = SPA_STATUS_HAVE_BUFFER;
|
||||
spa_graph_impl_activate(data, pnode);
|
||||
}
|
||||
}
|
||||
|
||||
debug("node %p end pull\n", node);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *node)
|
||||
|
|
@ -162,7 +162,7 @@ static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *
|
|||
|
||||
debug("node %p start push\n", node);
|
||||
|
||||
node->state = SPA_RESULT_HAVE_BUFFER;
|
||||
node->state = SPA_STATUS_HAVE_BUFFER;
|
||||
|
||||
node->ready[SPA_DIRECTION_OUTPUT] = 0;
|
||||
node->required[SPA_DIRECTION_OUTPUT] = 0;
|
||||
|
|
@ -179,13 +179,13 @@ static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *
|
|||
prequired = pnode->required[SPA_DIRECTION_INPUT];
|
||||
debug("node %p push peer %p io %d %d\n", node, pnode, pport->io->status, pport->io->buffer_id);
|
||||
|
||||
if (pport->io->status == SPA_RESULT_HAVE_BUFFER) {
|
||||
if (pport->io->status == SPA_STATUS_HAVE_BUFFER) {
|
||||
pnode->ready[SPA_DIRECTION_INPUT]++;
|
||||
node->required[SPA_DIRECTION_OUTPUT]++;
|
||||
}
|
||||
debug("node %p push peer %p in %d %d\n", node, pnode, prequired, pnode->ready[SPA_DIRECTION_INPUT]);
|
||||
if (prequired > 0 && pnode->ready[SPA_DIRECTION_INPUT] >= prequired) {
|
||||
pnode->state = SPA_RESULT_NEED_BUFFER;
|
||||
pnode->state = SPA_STATUS_NEED_BUFFER;
|
||||
spa_graph_impl_activate(data, pnode);
|
||||
}
|
||||
}
|
||||
|
|
@ -195,7 +195,7 @@ static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *
|
|||
}
|
||||
debug("node %p end push\n", node);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct spa_graph_callbacks spa_graph_impl_default = {
|
||||
|
|
|
|||
|
|
@ -44,18 +44,18 @@ static inline void spa_graph_impl_activate(void *data, struct spa_graph_node *no
|
|||
int res = node->state;
|
||||
|
||||
debug("node %p activate %d\n", node, node->state);
|
||||
if (node->state == SPA_RESULT_NEED_BUFFER) {
|
||||
if (node->state == SPA_STATUS_NEED_BUFFER) {
|
||||
res = spa_node_process_input(node->implementation);
|
||||
debug("node %p process in %d\n", node, res);
|
||||
}
|
||||
else if (node->state == SPA_RESULT_HAVE_BUFFER) {
|
||||
else if (node->state == SPA_STATUS_HAVE_BUFFER) {
|
||||
res = spa_node_process_output(node->implementation);
|
||||
debug("node %p process out %d\n", node, res);
|
||||
}
|
||||
|
||||
if (recurse && (res == SPA_RESULT_NEED_BUFFER || res == SPA_RESULT_OK))
|
||||
if (recurse && (res == SPA_STATUS_NEED_BUFFER || res == SPA_STATUS_OK))
|
||||
spa_graph_impl_need_input(data, node);
|
||||
else if (recurse && (res == SPA_RESULT_HAVE_BUFFER))
|
||||
else if (recurse && (res == SPA_STATUS_HAVE_BUFFER))
|
||||
spa_graph_impl_have_output(data, node);
|
||||
else
|
||||
node->state = res;
|
||||
|
|
@ -70,7 +70,7 @@ static inline int spa_graph_impl_need_input(void *data, struct spa_graph_node *n
|
|||
|
||||
debug("node %p start pull\n", node);
|
||||
|
||||
node->state = SPA_RESULT_NEED_BUFFER;
|
||||
node->state = SPA_STATUS_NEED_BUFFER;
|
||||
node->ready[SPA_DIRECTION_INPUT] = 0;
|
||||
required = node->required[SPA_DIRECTION_INPUT];
|
||||
|
||||
|
|
@ -85,15 +85,15 @@ static inline int spa_graph_impl_need_input(void *data, struct spa_graph_node *n
|
|||
prequired = pnode->required[SPA_DIRECTION_OUTPUT];
|
||||
debug("node %p pull peer %p io %d %d\n", node, pnode, pport->io->status, pport->io->buffer_id);
|
||||
|
||||
if (pport->io->status == SPA_RESULT_NEED_BUFFER)
|
||||
if (pport->io->status == SPA_STATUS_NEED_BUFFER)
|
||||
pnode->ready[SPA_DIRECTION_OUTPUT]++;
|
||||
else if (pport->io->status == SPA_RESULT_OK)
|
||||
else if (pport->io->status == SPA_STATUS_OK)
|
||||
node->ready[SPA_DIRECTION_INPUT]++;
|
||||
|
||||
debug("node %p pull peer %p out %d %d\n", node, pnode, prequired, pnode->ready[SPA_DIRECTION_OUTPUT]);
|
||||
if (prequired > 0 && pnode->ready[SPA_DIRECTION_OUTPUT] >= prequired) {
|
||||
if (pnode->state == SPA_RESULT_NEED_BUFFER)
|
||||
pnode->state = SPA_RESULT_HAVE_BUFFER;
|
||||
if (pnode->state == SPA_STATUS_NEED_BUFFER)
|
||||
pnode->state = SPA_STATUS_HAVE_BUFFER;
|
||||
spa_graph_impl_activate(data, pnode, true);
|
||||
}
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@ static inline int spa_graph_impl_need_input(void *data, struct spa_graph_node *n
|
|||
|
||||
debug("node %p end pull\n", node);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *node)
|
||||
|
|
@ -111,7 +111,7 @@ static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *
|
|||
|
||||
debug("node %p start push\n", node);
|
||||
|
||||
node->state = SPA_RESULT_HAVE_BUFFER;
|
||||
node->state = SPA_STATUS_HAVE_BUFFER;
|
||||
node->ready[SPA_DIRECTION_OUTPUT] = 0;
|
||||
node->required[SPA_DIRECTION_OUTPUT] = 0;
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *
|
|||
prequired = pnode->required[SPA_DIRECTION_INPUT];
|
||||
debug("node %p push peer %p io %d %d\n", node, pnode, pport->io->status, pport->io->buffer_id);
|
||||
|
||||
if (pport->io->status == SPA_RESULT_HAVE_BUFFER) {
|
||||
if (pport->io->status == SPA_STATUS_HAVE_BUFFER) {
|
||||
pnode->ready[SPA_DIRECTION_INPUT]++;
|
||||
node->required[SPA_DIRECTION_OUTPUT]++;
|
||||
}
|
||||
|
|
@ -141,7 +141,7 @@ static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *
|
|||
|
||||
debug("node %p end push\n", node);
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct spa_graph_callbacks spa_graph_impl_default = {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ static inline int spa_graph_impl_need_input(void *data, struct spa_graph_node *n
|
|||
}
|
||||
pnode = pport->node;
|
||||
|
||||
if (pport->io->status == SPA_RESULT_NEED_BUFFER) {
|
||||
if (pport->io->status == SPA_STATUS_NEED_BUFFER) {
|
||||
pnode->ready[SPA_DIRECTION_OUTPUT]++;
|
||||
node->required[SPA_DIRECTION_INPUT]++;
|
||||
}
|
||||
|
|
@ -70,13 +70,13 @@ static inline int spa_graph_impl_need_input(void *data, struct spa_graph_node *n
|
|||
pnode->state = spa_node_process_output(pnode->implementation);
|
||||
|
||||
spa_debug("peer %p processed out %d", pnode, pnode->state);
|
||||
if (pnode->state == SPA_RESULT_NEED_BUFFER)
|
||||
if (pnode->state == SPA_STATUS_NEED_BUFFER)
|
||||
spa_graph_need_input(pnode->graph, pnode);
|
||||
else if (pnode->state == SPA_RESULT_HAVE_BUFFER)
|
||||
else if (pnode->state == SPA_STATUS_HAVE_BUFFER)
|
||||
spa_graph_have_output(pnode->graph, pnode);
|
||||
}
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *node)
|
||||
|
|
@ -98,7 +98,7 @@ static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *
|
|||
}
|
||||
pnode = pport->node;
|
||||
|
||||
if (p->io->status == SPA_RESULT_HAVE_BUFFER) {
|
||||
if (p->io->status == SPA_STATUS_HAVE_BUFFER) {
|
||||
pnode->ready[SPA_DIRECTION_INPUT]++;
|
||||
node->required[SPA_DIRECTION_OUTPUT]++;
|
||||
}
|
||||
|
|
@ -113,13 +113,13 @@ static inline int spa_graph_impl_have_output(void *data, struct spa_graph_node *
|
|||
pnode->state = spa_node_process_input(pnode->implementation);
|
||||
|
||||
spa_debug("node %p chain processed in %d", pnode, pnode->state);
|
||||
if (pnode->state == SPA_RESULT_HAVE_BUFFER)
|
||||
if (pnode->state == SPA_STATUS_HAVE_BUFFER)
|
||||
spa_graph_have_output(pnode->graph, pnode);
|
||||
else if (pnode->state == SPA_RESULT_NEED_BUFFER)
|
||||
else if (pnode->state == SPA_STATUS_NEED_BUFFER)
|
||||
spa_graph_need_input(pnode->graph, pnode);
|
||||
}
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct spa_graph_callbacks spa_graph_impl_default = {
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ spa_graph_node_add(struct spa_graph *graph,
|
|||
struct spa_graph_node *node)
|
||||
{
|
||||
node->graph = graph;
|
||||
node->state = SPA_RESULT_OK;
|
||||
node->state = SPA_STATUS_OK;
|
||||
node->ready_link.next = NULL;
|
||||
spa_list_append(&graph->nodes, &node->link);
|
||||
spa_debug("node %p add", node);
|
||||
|
|
|
|||
|
|
@ -141,14 +141,29 @@ struct spa_monitor {
|
|||
* Set callbacks to receive asynchronous notifications from
|
||||
* the monitor.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* Returns: 0 on success
|
||||
* -errno on error
|
||||
*/
|
||||
int (*set_callbacks) (struct spa_monitor *monitor,
|
||||
const struct spa_monitor_callbacks *callbacks,
|
||||
void *data);
|
||||
|
||||
/**
|
||||
* spa_monitor::enum_items:
|
||||
* @monitor: a #spa_monitor
|
||||
* @item: result item
|
||||
* @index: index of the item
|
||||
*
|
||||
* Get the next item of the monitor. \a index should contain 0 to get the
|
||||
* first item and is updated with an opaque value that should be passed
|
||||
* unmodified to get the next items.
|
||||
*
|
||||
* Returns: 1 when an item is available
|
||||
* 0 when no more items are available
|
||||
* -errno on error
|
||||
*/
|
||||
int (*enum_items) (struct spa_monitor *monitor,
|
||||
struct spa_monitor_item **item, uint32_t index);
|
||||
struct spa_monitor_item **item, uint32_t *index);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -51,12 +51,18 @@ struct spa_range {
|
|||
* by the host and configured on all ports for which IO is requested.
|
||||
*/
|
||||
struct spa_port_io {
|
||||
uint32_t status; /**< the status code */
|
||||
#define SPA_STATUS_OK 0
|
||||
#define SPA_STATUS_NEED_BUFFER 1
|
||||
#define SPA_STATUS_HAVE_BUFFER 2
|
||||
#define SPA_STATUS_FORMAT_CHANGED 3
|
||||
#define SPA_STATUS_PORTS_CHANGED 4
|
||||
#define SPA_STATUS_PARAM_CHANGED 5
|
||||
int32_t status; /**< the status code */
|
||||
uint32_t buffer_id; /**< a buffer id */
|
||||
struct spa_range range; /**< the requested range */
|
||||
};
|
||||
|
||||
#define SPA_PORT_IO_INIT (struct spa_port_io) { SPA_RESULT_OK, SPA_ID_INVALID, }
|
||||
#define SPA_PORT_IO_INIT (struct spa_port_io) { SPA_STATUS_OK, SPA_ID_INVALID, }
|
||||
|
||||
/**
|
||||
* struct spa_port_info
|
||||
|
|
|
|||
|
|
@ -484,7 +484,7 @@ do { \
|
|||
|
||||
static inline void *
|
||||
spa_pod_builder_addv(struct spa_pod_builder *builder,
|
||||
const char *format, va_list args)
|
||||
const char *format, va_list args)
|
||||
{
|
||||
while (format) {
|
||||
switch (*format) {
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ static inline int spa_pod_object_fixate(struct spa_pod_object *obj)
|
|||
if (res->type == SPA_POD_TYPE_PROP)
|
||||
((struct spa_pod_prop *) res)->body.flags &= ~SPA_POD_PROP_FLAG_UNSET;
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <spa/pod/iter.h>
|
||||
|
|
@ -206,27 +207,27 @@ static inline int spa_pod_parser_getv(struct spa_pod_parser *parser,
|
|||
switch (*format) {
|
||||
case '<':
|
||||
if (pod == NULL || SPA_POD_TYPE(pod) != SPA_POD_TYPE_OBJECT)
|
||||
return SPA_RESULT_INCOMPATIBLE;
|
||||
return -EINVAL;
|
||||
if (++parser->depth >= SPA_POD_MAX_DEPTH)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
it = &parser->iter[parser->depth];
|
||||
spa_pod_iter_init(it, pod, SPA_POD_SIZE(pod), sizeof(struct spa_pod_object));
|
||||
goto read_pod;
|
||||
case '[':
|
||||
if (pod == NULL || SPA_POD_TYPE(pod) != SPA_POD_TYPE_STRUCT)
|
||||
return SPA_RESULT_INCOMPATIBLE;
|
||||
return -EINVAL;
|
||||
if (++parser->depth >= SPA_POD_MAX_DEPTH)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
it = &parser->iter[parser->depth];
|
||||
spa_pod_iter_init(it, pod, SPA_POD_SIZE(pod), sizeof(struct spa_pod_struct));
|
||||
goto read_pod;
|
||||
case ']': case '>':
|
||||
if (current != NULL)
|
||||
return SPA_RESULT_INCOMPATIBLE;
|
||||
return -EINVAL;
|
||||
if (--parser->depth < 0)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
return -EINVAL;
|
||||
|
||||
it = &parser->iter[parser->depth];
|
||||
current = spa_pod_iter_current(it);
|
||||
|
|
@ -268,12 +269,12 @@ static inline int spa_pod_parser_getv(struct spa_pod_parser *parser,
|
|||
case 'V':
|
||||
pod = (struct spa_pod *) prop;
|
||||
if (pod == NULL && required)
|
||||
return SPA_RESULT_NOT_FOUND;
|
||||
return -ENOENT;
|
||||
goto collect;
|
||||
default:
|
||||
if (pod == NULL || !spa_pod_parser_can_collect(pod, *format)) {
|
||||
if (required)
|
||||
return SPA_RESULT_NOT_FOUND;
|
||||
return -ENOENT;
|
||||
skip = true;
|
||||
}
|
||||
collect:
|
||||
|
|
|
|||
|
|
@ -158,14 +158,13 @@ struct spa_handle_factory {
|
|||
*
|
||||
* Enumerate the interface information for @factory.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_NOT_IMPLEMENTED when there are no interfaces
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when handle or info is %NULL
|
||||
* #SPA_RESULT_ENUM_END when there are no more infos
|
||||
* Returns: 1 when an item is available
|
||||
* 0 when no more items are available
|
||||
* -errno on error
|
||||
*/
|
||||
int (*enum_interface_info) (const struct spa_handle_factory *factory,
|
||||
const struct spa_interface_info **info,
|
||||
uint32_t index);
|
||||
uint32_t *index);
|
||||
};
|
||||
|
||||
#define spa_handle_factory_init(h,...) (h)->init((h),__VA_ARGS__)
|
||||
|
|
@ -183,7 +182,7 @@ struct spa_handle_factory {
|
|||
* #SPA_RESULT_ENUM_END when there are no more factories
|
||||
*/
|
||||
typedef int (*spa_handle_factory_enum_func_t) (const struct spa_handle_factory **factory,
|
||||
uint32_t index);
|
||||
uint32_t *index);
|
||||
|
||||
#define SPA_HANDLE_FACTORY_ENUM_FUNC_NAME "spa_handle_factory_enum"
|
||||
|
||||
|
|
@ -194,11 +193,11 @@ typedef int (*spa_handle_factory_enum_func_t) (const struct spa_handle_factory *
|
|||
*
|
||||
* The entry point in a plugin.
|
||||
*
|
||||
* Returns: #SPA_RESULT_OK on success
|
||||
* #SPA_RESULT_INVALID_ARGUMENTS when factory is %NULL
|
||||
* #SPA_RESULT_ENUM_END when there are no more factories
|
||||
* Returns: 1 on success
|
||||
* 0 when no more items are available
|
||||
* -errno on error
|
||||
*/
|
||||
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t index);
|
||||
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index);
|
||||
|
||||
void spa_handle_factory_register(const struct spa_handle_factory *factory);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,47 +30,6 @@ extern "C" {
|
|||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
|
||||
enum spa_result {
|
||||
SPA_RESULT_WAIT_SYNC = 2,
|
||||
SPA_RESULT_MODIFIED = 1,
|
||||
SPA_RESULT_OK = 0,
|
||||
SPA_RESULT_ERROR = -1,
|
||||
SPA_RESULT_ERRNO = -2,
|
||||
SPA_RESULT_NOT_FOUND = -3,
|
||||
SPA_RESULT_BUSY = -4,
|
||||
SPA_RESULT_NO_MEMORY = -5,
|
||||
SPA_RESULT_NO_PERMISSION = -6,
|
||||
SPA_RESULT_INVALID_ARGUMENTS = -7,
|
||||
SPA_RESULT_NOT_IMPLEMENTED = -8,
|
||||
SPA_RESULT_UNKNOWN_INTERFACE = -9,
|
||||
SPA_RESULT_UNEXPECTED = -10,
|
||||
SPA_RESULT_INCOMPATIBLE = -11,
|
||||
SPA_RESULT_INCOMPATIBLE_VERSION = -12,
|
||||
SPA_RESULT_INCOMPLETE = -13,
|
||||
SPA_RESULT_ENUM_END = -14,
|
||||
|
||||
SPA_RESULT_INACTIVE = -15,
|
||||
SPA_RESULT_INVALID_COMMAND = -16,
|
||||
|
||||
SPA_RESULT_INVALID_PORT = -17,
|
||||
SPA_RESULT_INVALID_DIRECTION = -18,
|
||||
SPA_RESULT_PORTS_CHANGED = -19,
|
||||
SPA_RESULT_TOO_MANY_PORTS = -20,
|
||||
|
||||
SPA_RESULT_PARAM_CHANGED = -21,
|
||||
SPA_RESULT_PARAM_UNSET = -22,
|
||||
SPA_RESULT_UNKNOWN_PARAM = -23,
|
||||
|
||||
SPA_RESULT_NO_FORMAT = -24,
|
||||
SPA_RESULT_FORMAT_CHANGED = -25,
|
||||
SPA_RESULT_INVALID_MEDIA_TYPE = -26,
|
||||
|
||||
SPA_RESULT_INVALID_BUFFER_ID = -27,
|
||||
SPA_RESULT_NO_BUFFERS = -28,
|
||||
SPA_RESULT_OUT_OF_BUFFERS = -29,
|
||||
SPA_RESULT_HAVE_BUFFER = -30,
|
||||
SPA_RESULT_NEED_BUFFER = -31,
|
||||
};
|
||||
|
||||
#define SPA_ASYNC_BIT (1 << 30)
|
||||
#define SPA_ASYNC_MASK (3 << 30)
|
||||
|
|
@ -184,6 +143,8 @@ struct spa_fraction {
|
|||
#define spa_memzero(x,l) (memset((x), 0, (l)))
|
||||
#define spa_zero(x) (spa_memzero(&(x), sizeof(x)))
|
||||
|
||||
#define spa_strerror(err) strerror(-(err))
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue