70 int (*
signal) (
void *data);
74#define spa_graph_link_signal(l) ((l)->signal((l)->signal_data))
76#define spa_graph_state_dec(s,c) (__atomic_sub_fetch(&(s)->pending, c, __ATOMIC_SEQ_CST) == 0)
82 spa_debug(
"link %p: state %p: pending %d/%d", link, state,
98#define SPA_VERSION_GRAPH_NODE_CALLBACKS 0
103 uint32_t port_id, uint32_t buffer_id);
119#define spa_graph_node_call(n,method,version,...) \
122 spa_callbacks_call_res(&(n)->callbacks, \
123 struct spa_graph_node_callbacks, __res, \
124 method, (version), ##__VA_ARGS__); \
128#define spa_graph_node_process(n) spa_graph_node_call((n), process, 0, (n))
129#define spa_graph_node_reuse_buffer(n,p,i) spa_graph_node_call((n), reuse_buffer, 0, (n), (p), (i))
155 spa_debug(
"graph %p run with state %p pending %d/%d", graph, graph->state,
156 graph->state->pending, graph->state->required);
163 spa_debug(
"graph %p node %p: state %p pending %d/%d status %d", graph, n,
215 link->state->required--;
240 spa_debug(
"node %p: sub process %p", node, graph);
272 spa_debug(
"node %p add to graph %p, state %p required %d",
279 spa_debug(
"node %p remove from graph %p, state %p required %d",
293 spa_debug(
"port %p init type %d id %d", port, direction, port_id);
294 port->direction = direction;
295 port->port_id = port_id;
303 spa_debug(
"port %p add to node %p", port, node);
327 port->peer->peer = NULL;
337 spa_debug(
"node %p: process state %p: %d, node %p", node, state, state->
status, n);
345 uint32_t port_id, uint32_t buffer_id)
static void spa_graph_node_set_callbacks(struct spa_graph_node *node, const struct spa_graph_node_callbacks *callbacks, void *data)
Definition: graph.h:268
static void spa_graph_state_reset(struct spa_graph_state *state)
Definition: graph.h:71
static void spa_graph_link_add(struct spa_graph_node *out, struct spa_graph_state *state, struct spa_graph_link *link)
Definition: graph.h:213
static const struct spa_graph_node_callbacks spa_graph_node_impl_default
Definition: graph.h:361
static void spa_graph_port_remove(struct spa_graph_port *port)
Definition: graph.h:318
static void spa_graph_init(struct spa_graph *graph, struct spa_graph_state *state)
Definition: graph.h:204
static void spa_graph_node_add(struct spa_graph *graph, struct spa_graph_node *node)
Definition: graph.h:276
static 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:354
#define spa_graph_link_signal(l)
Definition: graph.h:83
static int spa_graph_run(struct spa_graph *graph)
Definition: graph.h:159
static int spa_graph_node_impl_sub_process(void *data, struct spa_graph_node *node)
Definition: graph.h:247
static int spa_graph_node_trigger(struct spa_graph_node *node)
Definition: graph.h:150
static int spa_graph_node_impl_process(void *data, struct spa_graph_node *node)
Definition: graph.h:342
static void spa_graph_node_set_subgraph(struct spa_graph_node *node, struct spa_graph *subgraph)
Definition: graph.h:259
static const struct spa_graph_node_callbacks spa_graph_node_sub_impl_default
Definition: graph.h:254
static int spa_graph_link_trigger(struct spa_graph_link *link)
Definition: graph.h:87
static void spa_graph_node_init(struct spa_graph_node *node, struct spa_graph_state *state)
Definition: graph.h:231
static void spa_graph_port_init(struct spa_graph_port *port, enum spa_direction direction, uint32_t port_id, uint32_t flags)
Definition: graph.h:298
static int spa_graph_finish(struct spa_graph *graph)
Definition: graph.h:184
#define spa_debug(...)
Definition: graph.h:53
static void spa_graph_node_remove(struct spa_graph_node *node)
Definition: graph.h:287
static void spa_graph_port_add(struct spa_graph_node *node, struct spa_graph_port *port)
Definition: graph.h:310
#define spa_graph_state_dec(s, c)
Definition: graph.h:85
static int spa_graph_link_signal_graph(void *data)
Definition: graph.h:198
static void spa_graph_port_link(struct spa_graph_port *out, struct spa_graph_port *in)
Definition: graph.h:325
#define spa_graph_node_process(n)
Definition: graph.h:138
static void spa_graph_link_remove(struct spa_graph_link *link)
Definition: graph.h:223
static int spa_graph_link_signal_node(void *data)
Definition: graph.h:191
#define SPA_VERSION_GRAPH_NODE_CALLBACKS
Definition: graph.h:108
static void spa_graph_port_unlink(struct spa_graph_port *port)
Definition: graph.h:333
#define SPA_CALLBACKS_INIT(_funcs, _data)
Initialize the set of functions funcs as a spa_callbacks, together with _data.
Definition: hook.h:154
static void spa_list_init(struct spa_list *list)
Definition: list.h:55
static void spa_list_remove(struct spa_list *elem)
Definition: list.h:85
#define spa_list_for_each(pos, head, member)
Definition: list.h:127
#define spa_list_append(list, item)
Definition: list.h:97
#define spa_list_for_each_safe(pos, tmp, head, member)
Definition: list.h:145
#define SPA_STATUS_OK
Definition: io.h:100
#define spa_node_port_reuse_buffer(n,...)
Tell an output port to reuse a buffer.
Definition: spa/include/spa/node/node.h:761
#define spa_node_process(n)
Process the node.
Definition: spa/include/spa/node/node.h:764
spa_direction
Definition: defs.h:108
@ SPA_DIRECTION_INPUT
Definition: defs.h:109
@ SPA_DIRECTION_OUTPUT
Definition: defs.h:110
Callbacks, contains the structure with functions and the data passed to the functions.
Definition: hook.h:136
struct spa_graph_state * state
Definition: graph.h:78
struct spa_list link
Definition: graph.h:77
int(* signal)(void *data)
Definition: graph.h:79
void * signal_data
Definition: graph.h:80
int(* process)(void *data, struct spa_graph_node *node)
Definition: graph.h:111
int(* reuse_buffer)(void *data, struct spa_graph_node *node, uint32_t port_id, uint32_t buffer_id)
Definition: graph.h:112
uint32_t version
Definition: graph.h:109
uint32_t flags
node flags
Definition: graph.h:121
struct spa_list link
link in graph nodes list
Definition: graph.h:117
struct spa_callbacks callbacks
Definition: graph.h:125
struct spa_graph * graph
owner graph
Definition: graph.h:118
struct spa_graph * subgraph
subgraph or NULL
Definition: graph.h:124
struct spa_graph_link graph_link
link in graph
Definition: graph.h:123
struct spa_list links
list of links to next nodes
Definition: graph.h:120
struct spa_graph_state * state
state of the node
Definition: graph.h:122
struct spa_list ports[2]
list of input and output ports
Definition: graph.h:119
struct spa_list sched_link
link for scheduler
Definition: graph.h:126
struct spa_graph_node * node
owner node
Definition: graph.h:143
uint32_t port_id
port id
Definition: graph.h:145
struct spa_graph_port * peer
peer
Definition: graph.h:147
uint32_t flags
port flags
Definition: graph.h:146
enum spa_direction direction
port direction
Definition: graph.h:144
struct spa_list link
link in node port list
Definition: graph.h:142
int32_t pending
number of pending signals
Definition: graph.h:68
int32_t required
required number of signals
Definition: graph.h:67
int status
current status
Definition: graph.h:66
uint32_t flags
Definition: graph.h:100
struct spa_list nodes
Definition: graph.h:103
struct spa_graph_node * parent
Definition: graph.h:101
struct spa_graph_state * state
Definition: graph.h:102
Definition: spa/include/spa/node/node.h:61