21#include <spa/utils/atomic.h>
51 int (*
signal) (
void *data);
55#define spa_graph_link_signal(l) ((l)->signal((l)->signal_data))
57#define spa_graph_state_dec(s) (SPA_ATOMIC_DEC(s->pending) == 0)
63 spa_debug(
"link %p: state %p: pending %d/%d", link, state,
79#define SPA_VERSION_GRAPH_NODE_CALLBACKS 0
84 uint32_t port_id, uint32_t buffer_id);
100#define spa_graph_node_call(n,method,version,...) \
103 spa_callbacks_call_res(&(n)->callbacks, \
104 struct spa_graph_node_callbacks, __res, \
105 method, (version), ##__VA_ARGS__); \
109#define spa_graph_node_process(n) spa_graph_node_call((n), process, 0, (n))
110#define spa_graph_node_reuse_buffer(n,p,i) spa_graph_node_call((n), reuse_buffer, 0, (n), (p), (i))
136 spa_debug(
"graph %p run with state %p pending %d/%d", graph, graph->state,
137 graph->state->pending, graph->state->required);
144 spa_debug(
"graph %p node %p: state %p pending %d/%d status %d", graph, n,
196 link->state->required--;
197 spa_debug(
"link %p state %p remove %d", link, link->state, link->state->required);
208 node->subgraph = NULL;
210 node->state->
required = node->state->pending = 0;
213 node->graph_link.signal_data = node;
220 struct spa_graph *graph = node->subgraph;
221 spa_debug(
"node %p: sub process %p", node, graph);
233 node->subgraph = subgraph;
252 node->state->required++;
253 spa_debug(
"node %p add to graph %p, state %p required %d",
254 node, graph, node->state, node->state->required);
260 spa_debug(
"node %p remove from graph %p, state %p required %d",
261 node, node->graph, node->state, node->state->required);
263 node->state->required--;
274 spa_debug(
"port %p init type %d id %d", port, direction, port_id);
275 port->direction = direction;
276 port->port_id = port_id;
284 spa_debug(
"port %p add to node %p", port, node);
308 port->peer->peer = NULL;
318 spa_debug(
"node %p: process state %p: %d, node %p", node, state, state->
status, n);
326 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:249
static void spa_graph_state_reset(struct spa_graph_state *state)
Definition graph.h:52
static void spa_graph_link_add(struct spa_graph_node *out, struct spa_graph_state *state, struct spa_graph_link *link)
Definition graph.h:194
static const struct spa_graph_node_callbacks spa_graph_node_impl_default
Definition graph.h:342
static void spa_graph_port_remove(struct spa_graph_port *port)
Definition graph.h:299
static void spa_graph_init(struct spa_graph *graph, struct spa_graph_state *state)
Definition graph.h:185
static void spa_graph_node_add(struct spa_graph *graph, struct spa_graph_node *node)
Definition graph.h:257
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:335
#define spa_graph_link_signal(l)
Definition graph.h:64
static int spa_graph_run(struct spa_graph *graph)
Definition graph.h:140
static int spa_graph_node_impl_sub_process(void *data, struct spa_graph_node *node)
Definition graph.h:228
static int spa_graph_node_trigger(struct spa_graph_node *node)
Definition graph.h:131
static int spa_graph_node_impl_process(void *data, struct spa_graph_node *node)
Definition graph.h:323
static void spa_graph_node_set_subgraph(struct spa_graph_node *node, struct spa_graph *subgraph)
Definition graph.h:240
static const struct spa_graph_node_callbacks spa_graph_node_sub_impl_default
Definition graph.h:235
static int spa_graph_link_trigger(struct spa_graph_link *link)
Definition graph.h:68
static void spa_graph_node_init(struct spa_graph_node *node, struct spa_graph_state *state)
Definition graph.h:212
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:279
static int spa_graph_finish(struct spa_graph *graph)
Definition graph.h:165
#define spa_debug(...)
Definition graph.h:34
static void spa_graph_node_remove(struct spa_graph_node *node)
Definition graph.h:268
static void spa_graph_port_add(struct spa_graph_node *node, struct spa_graph_port *port)
Definition graph.h:291
static int spa_graph_link_signal_graph(void *data)
Definition graph.h:179
static void spa_graph_port_link(struct spa_graph_port *out, struct spa_graph_port *in)
Definition graph.h:306
#define spa_graph_node_process(n)
Definition graph.h:119
static void spa_graph_link_remove(struct spa_graph_link *link)
Definition graph.h:204
static int spa_graph_link_signal_node(void *data)
Definition graph.h:172
#define SPA_VERSION_GRAPH_NODE_CALLBACKS
Definition graph.h:89
#define spa_graph_state_dec(s)
Definition graph.h:66
static void spa_graph_port_unlink(struct spa_graph_port *port)
Definition graph.h:314
#define SPA_CALLBACKS_INIT(_funcs, _data)
Initialize the set of functions funcs as a spa_callbacks, together with _data.
Definition hook.h:134
static void spa_list_init(struct spa_list *list)
Definition list.h:35
static void spa_list_remove(struct spa_list *elem)
Definition list.h:65
#define spa_list_for_each(pos, head, member)
Definition list.h:107
#define spa_list_append(list, item)
Definition list.h:77
#define spa_list_for_each_safe(pos, tmp, head, member)
Definition list.h:125
#define SPA_STATUS_OK
Definition io.h:82
#define spa_node_port_reuse_buffer(n,...)
Tell an output port to reuse a buffer.
Definition node.h:762
#define spa_node_process(n)
Process the node.
Definition node.h:766
#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:116
struct spa_graph_state * state
Definition graph.h:59
int(* signal)(void *data)
Definition graph.h:60
void * signal_data
Definition graph.h:61
int(* process)(void *data, struct spa_graph_node *node)
Definition graph.h:92
int(* reuse_buffer)(void *data, struct spa_graph_node *node, uint32_t port_id, uint32_t buffer_id)
Definition graph.h:93
uint32_t version
Definition graph.h:90
uint32_t flags
node flags
Definition graph.h:102
struct spa_callbacks callbacks
Definition graph.h:106
struct spa_graph * graph
owner graph
Definition graph.h:99
struct spa_graph * subgraph
subgraph or NULL
Definition graph.h:105
struct spa_graph_link graph_link
link in graph
Definition graph.h:104
struct spa_list links
list of links to next nodes
Definition graph.h:101
struct spa_graph_state * state
state of the node
Definition graph.h:103
struct spa_list ports[2]
list of input and output ports
Definition graph.h:100
struct spa_list sched_link
link for scheduler
Definition graph.h:107
struct spa_graph_node * node
owner node
Definition graph.h:124
uint32_t port_id
port id
Definition graph.h:126
struct spa_graph_port * peer
peer
Definition graph.h:128
uint32_t flags
port flags
Definition graph.h:127
enum spa_direction direction
port direction
Definition graph.h:125
int32_t pending
number of pending signals
Definition graph.h:49
int32_t required
required number of signals
Definition graph.h:48
int status
current status
Definition graph.h:47
uint32_t flags
Definition graph.h:81
struct spa_list nodes
Definition graph.h:84
struct spa_graph_node * parent
Definition graph.h:82
struct spa_graph_state * state
Definition graph.h:83