21#include <spa/utils/atomic.h>
30 #define SPA_API_GRAPH SPA_API_IMPL
32 #define SPA_API_GRAPH static inline
64#define spa_graph_link_signal(l) ((l)->signal((l)->signal_data))
66#define spa_graph_state_dec(s) (SPA_ATOMIC_DEC(s->pending) == 0)
72 spa_debug(
"link %p: state %p: pending %d/%d", link, state,
88#define SPA_VERSION_GRAPH_NODE_CALLBACKS 0
93 uint32_t port_id, uint32_t buffer_id);
109#define spa_graph_node_call(n,method,version,...) \
112 spa_callbacks_call_res(&(n)->callbacks, \
113 struct spa_graph_node_callbacks, __res, \
114 method, (version), ##__VA_ARGS__); \
118#define spa_graph_node_process(n) spa_graph_node_call((n), process, 0, (n))
119#define spa_graph_node_reuse_buffer(n,p,i) spa_graph_node_call((n), reuse_buffer, 0, (n), (p), (i))
145 spa_debug(
"graph %p run with state %p pending %d/%d", graph, graph->state,
146 graph->state->pending, graph->state->required);
153 spa_debug(
"graph %p node %p: state %p pending %d/%d status %d", graph, n,
217 node->subgraph = NULL;
219 node->state->
required = node->state->pending = 0;
222 node->graph_link.signal_data = node;
229 struct spa_graph *graph = node->subgraph;
230 spa_debug(
"node %p: sub process %p", node, graph);
242 node->subgraph = subgraph;
244 spa_debug(
"node %p set subgraph %p", node, subgraph);
261 node->state->required++;
262 spa_debug(
"node %p add to graph %p, state %p required %d",
263 node, graph, node->state, node->state->required);
269 spa_debug(
"node %p remove from graph %p, state %p required %d",
270 node, node->graph, node->state, node->state->required);
272 node->state->required--;
283 spa_debug(
"port %p init type %d id %d", port, direction, port_id);
284 port->direction = direction;
285 port->port_id = port_id;
293 spa_debug(
"port %p add to node %p", port, node);
315 spa_debug(
"port %p unlink from %p", port, port->peer);
317 port->peer->peer = NULL;
317 port->peer->peer = NULL; {
…}
327 spa_debug(
"node %p: process state %p: %d, node %p", node, state, state->
status, n);
335 uint32_t port_id, uint32_t buffer_id)
SPA_API_GRAPH void spa_graph_link_remove(struct spa_graph_link *link)
Definition graph.h:215
SPA_API_GRAPH void spa_graph_state_reset(struct spa_graph_state *state)
Definition graph.h:63
SPA_API_GRAPH void spa_graph_port_init(struct spa_graph_port *port, enum spa_direction direction, uint32_t port_id, uint32_t flags)
Definition graph.h:290
static const struct spa_graph_node_callbacks spa_graph_node_impl_default
Definition graph.h:353
SPA_API_GRAPH void spa_graph_node_remove(struct spa_graph_node *node)
Definition graph.h:279
#define SPA_API_GRAPH
Definition graph.h:39
#define spa_graph_link_signal(l)
Definition graph.h:75
SPA_API_GRAPH void spa_graph_node_init(struct spa_graph_node *node, struct spa_graph_state *state)
Definition graph.h:223
SPA_API_GRAPH int spa_graph_node_trigger(struct spa_graph_node *node)
Definition graph.h:142
SPA_API_GRAPH int spa_graph_finish(struct spa_graph *graph)
Definition graph.h:176
SPA_API_GRAPH int spa_graph_node_impl_process(void *data, struct spa_graph_node *node)
Definition graph.h:334
SPA_API_GRAPH void spa_graph_port_unlink(struct spa_graph_port *port)
Definition graph.h:325
SPA_API_GRAPH void spa_graph_port_remove(struct spa_graph_port *port)
Definition graph.h:310
SPA_API_GRAPH int spa_graph_node_impl_reuse_buffer(void *data, struct spa_graph_node *node, uint32_t port_id, uint32_t buffer_id)
Definition graph.h:346
SPA_API_GRAPH void spa_graph_node_add(struct spa_graph *graph, struct spa_graph_node *node)
Definition graph.h:268
static const struct spa_graph_node_callbacks spa_graph_node_sub_impl_default
Definition graph.h:246
SPA_API_GRAPH void spa_graph_node_set_subgraph(struct spa_graph_node *node, struct spa_graph *subgraph)
Definition graph.h:251
SPA_API_GRAPH int spa_graph_link_trigger(struct spa_graph_link *link)
Definition graph.h:79
#define spa_debug(...)
Definition graph.h:45
SPA_API_GRAPH void spa_graph_port_link(struct spa_graph_port *out, struct spa_graph_port *in)
Definition graph.h:317
SPA_API_GRAPH void spa_graph_port_add(struct spa_graph_node *node, struct spa_graph_port *port)
Definition graph.h:302
SPA_API_GRAPH int spa_graph_run(struct spa_graph *graph)
Definition graph.h:151
#define spa_graph_node_process(n)
Definition graph.h:130
SPA_API_GRAPH void spa_graph_link_add(struct spa_graph_node *out, struct spa_graph_state *state, struct spa_graph_link *link)
Definition graph.h:205
SPA_API_GRAPH void spa_graph_node_set_callbacks(struct spa_graph_node *node, const struct spa_graph_node_callbacks *callbacks, void *data)
Definition graph.h:260
SPA_API_GRAPH int spa_graph_link_signal_node(void *data)
Definition graph.h:183
SPA_API_GRAPH void spa_graph_init(struct spa_graph *graph, struct spa_graph_state *state)
Definition graph.h:196
#define SPA_VERSION_GRAPH_NODE_CALLBACKS
Definition graph.h:100
#define spa_graph_state_dec(s)
Definition graph.h:77
SPA_API_GRAPH int spa_graph_link_signal_graph(void *data)
Definition graph.h:190
SPA_API_GRAPH int spa_graph_node_impl_sub_process(void *data, struct spa_graph_node *node)
Definition graph.h:239
#define SPA_CALLBACKS_INIT(_funcs, _data)
Initialize the set of functions funcs as a spa_callbacks, together with _data.
Definition hook.h:144
SPA_API_LIST void spa_list_init(struct spa_list *list)
Definition list.h:47
SPA_API_LIST void spa_list_remove(struct spa_list *elem)
Definition list.h:77
#define spa_list_for_each(pos, head, member)
Definition list.h:119
#define spa_list_append(list, item)
Definition list.h:89
#define spa_list_for_each_safe(pos, tmp, head, member)
Definition list.h:137
#define SPA_STATUS_OK
Definition io.h:82
SPA_API_NODE int spa_node_port_reuse_buffer(struct spa_node *object, uint32_t port_id, uint32_t buffer_id)
Definition node.h:808
SPA_API_NODE int spa_node_process(struct spa_node *object)
Definition node.h:818
#define SPA_UNUSED
Definition defs.h:307
spa_direction
Definition defs.h:106
@ SPA_DIRECTION_INPUT
Definition defs.h:107
@ SPA_DIRECTION_OUTPUT
Definition defs.h:108
Callbacks, contains the structure with functions and the data passed to the functions.
Definition hook.h:126
struct spa_graph_state * state
Definition graph.h:70
struct spa_list link
Definition graph.h:69
int(* signal)(void *data)
Definition graph.h:71
void * signal_data
Definition graph.h:72
int(* process)(void *data, struct spa_graph_node *node)
Definition graph.h:103
int(* reuse_buffer)(void *data, struct spa_graph_node *node, uint32_t port_id, uint32_t buffer_id)
Definition graph.h:104
uint32_t version
Definition graph.h:101
uint32_t flags
node flags
Definition graph.h:113
struct spa_list link
link in graph nodes list
Definition graph.h:109
struct spa_callbacks callbacks
Definition graph.h:117
struct spa_graph * graph
owner graph
Definition graph.h:110
struct spa_graph * subgraph
subgraph or NULL
Definition graph.h:116
struct spa_graph_link graph_link
link in graph
Definition graph.h:115
struct spa_list links
list of links to next nodes
Definition graph.h:112
struct spa_graph_state * state
state of the node
Definition graph.h:114
struct spa_list ports[2]
list of input and output ports
Definition graph.h:111
struct spa_list sched_link
link for scheduler
Definition graph.h:118
struct spa_graph_node * node
owner node
Definition graph.h:135
uint32_t port_id
port id
Definition graph.h:137
struct spa_graph_port * peer
peer
Definition graph.h:139
uint32_t flags
port flags
Definition graph.h:138
enum spa_direction direction
port direction
Definition graph.h:136
struct spa_list link
link in node port list
Definition graph.h:134
int32_t pending
number of pending signals
Definition graph.h:60
int32_t required
required number of signals
Definition graph.h:59
int status
current status
Definition graph.h:58
uint32_t flags
Definition graph.h:92
struct spa_list nodes
Definition graph.h:95
struct spa_graph_node * parent
Definition graph.h:93
struct spa_graph_state * state
Definition graph.h:94