PipeWire: pipewire/impl-node.h Source File

PipeWire 1.4.0 |

Loading...
Searching...
No Matches
impl-node.h
Go to the documentation of this file.
1/* PipeWire */
2/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3/* SPDX-License-Identifier: MIT */
4
5#ifndef PIPEWIRE_IMPL_NODE_H
6#define PIPEWIRE_IMPL_NODE_H
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
22struct pw_impl_node;
23struct pw_impl_port;
24
25#include <spa/node/node.h>
26#include <spa/node/event.h>
27
28#include <pipewire/impl.h>
29
31struct pw_impl_node_events {
32#define PW_VERSION_IMPL_NODE_EVENTS 0
33 uint32_t version;
34
36 void (*destroy) (void *data);
37 /** the node is about to be freed */
38 void (*free) (void *data);
40 void (*initialized) (void *data);
41
43 void (*port_init) (void *data, struct pw_impl_port *port);
45 void (*port_added) (void *data, struct pw_impl_port *port);
47 void (*port_removed) (void *data, struct pw_impl_port *port);
48
50 void (*info_changed) (void *data, const struct pw_node_info *info);
52 void (*port_info_changed) (void *data, struct pw_impl_port *port,
53 const struct pw_port_info *info);
55 void (*active_changed) (void *data, bool active);
56
58 void (*state_request) (void *data, enum pw_node_state state);
60 void (*state_changed) (void *data, enum pw_node_state old,
61 enum pw_node_state state, const char *error);
62
64 void (*result) (void *data, int seq, int res, uint32_t type, const void *result);
65
67 void (*event) (void *data, const struct spa_event *event);
68
70 void (*driver_changed) (void *data, struct pw_impl_node *old, struct pw_impl_node *driver);
71
73 void (*peer_added) (void *data, struct pw_impl_node *peer);
75 void (*peer_removed) (void *data, struct pw_impl_node *peer);
76};
77
78struct pw_impl_node_rt_events {
79#define PW_VERSION_IMPL_NODE_RT_EVENTS 0
80 uint32_t version;
82 void (*drained) (void *data);
84 void (*xrun) (void *data);
85 /** the driver node starts processing */
86 void (*start) (void *data);
88 void (*complete) (void *data);
90 void (*incomplete) (void *data);
92 void (*timeout) (void *data);
93};
94
96 struct pw_impl_node *
97 pw_context_create_node(struct pw_context *context,
98 struct pw_properties *properties,
99 size_t user_data_size );
100
102int pw_impl_node_register(struct pw_impl_node *node,
103 struct pw_properties *properties );
104
106void pw_impl_node_destroy(struct pw_impl_node *node);
107
109const struct pw_node_info *pw_impl_node_get_info(struct pw_impl_node *node);
110
112void * pw_impl_node_get_user_data(struct pw_impl_node *node);
113
115struct pw_context *pw_impl_node_get_context(struct pw_impl_node *node);
116
118struct pw_global *pw_impl_node_get_global(struct pw_impl_node *node);
119
121const struct pw_properties *pw_impl_node_get_properties(struct pw_impl_node *node);
122
124int pw_impl_node_update_properties(struct pw_impl_node *node, const struct spa_dict *dict);
125
127int pw_impl_node_set_implementation(struct pw_impl_node *node, struct spa_node *spa_node);
128
130struct spa_node *pw_impl_node_get_implementation(struct pw_impl_node *node);
131
133void pw_impl_node_add_listener(struct pw_impl_node *node,
134 struct spa_hook *listener,
135 const struct pw_impl_node_events *events,
136 void *data);
137
139void pw_impl_node_add_rt_listener(struct pw_impl_node *node,
140 struct spa_hook *listener,
141 const struct pw_impl_node_rt_events *events,
142 void *data);
143void pw_impl_node_remove_rt_listener(struct pw_impl_node *node,
144 struct spa_hook *listener);
145
150int pw_impl_node_for_each_port(struct pw_impl_node *node,
151 enum pw_direction direction,
152 int (*callback) (void *data, struct pw_impl_port *port),
153 void *data);
154
155int pw_impl_node_for_each_param(struct pw_impl_node *node,
156 int seq, uint32_t param_id,
157 uint32_t index, uint32_t max,
158 const struct spa_pod *filter,
159 int (*callback) (void *data, int seq,
160 uint32_t id, uint32_t index, uint32_t next,
161 struct spa_pod *param),
162 void *data);
163
166struct pw_impl_port *
167 pw_impl_node_find_port(struct pw_impl_node *node, enum pw_direction direction, uint32_t port_id);
168
170uint32_t pw_impl_node_get_free_port_id(struct pw_impl_node *node, enum pw_direction direction);
171
172int pw_impl_node_initialized(struct pw_impl_node *node);
173
176int pw_impl_node_set_active(struct pw_impl_node *node, bool active);
177
179bool pw_impl_node_is_active(struct pw_impl_node *node);
180
182int pw_impl_node_send_command(struct pw_impl_node *node, const struct spa_command *command);
183
185int pw_impl_node_set_param(struct pw_impl_node *node,
186 uint32_t id, uint32_t flags, const struct spa_pod *param);
190
191#ifdef __cplusplus
192}
193#endif
194
195#endif /* PIPEWIRE_IMPL_NODE_H */
seq
uint32_t int seq
Definition core.h:432
res
uint32_t int int res
Definition core.h:433
pw_impl_node_find_port
struct pw_impl_port * pw_impl_node_find_port(struct pw_impl_node *node, enum pw_direction direction, uint32_t port_id)
Find the port with direction and port_id or NULL when not found.
Definition impl-node.c:2632
pw_impl_node_initialized
int pw_impl_node_initialized(struct pw_impl_node *node)
Definition impl-node.c:1014
pw_impl_node_set_implementation
int pw_impl_node_set_implementation(struct pw_impl_node *node, struct spa_node *spa_node)
Set the node implementation.
Definition impl-node.c:2290
pw_impl_node_add_listener
void pw_impl_node_add_listener(struct pw_impl_node *node, struct spa_hook *listener, const struct pw_impl_node_events *events, void *data)
Add an event listener.
Definition impl-node.c:2330
pw_impl_node_send_command
int pw_impl_node_send_command(struct pw_impl_node *node, const struct spa_command *command)
Check if a node is active, Since 0.3.39.
Definition impl-node.c:2856
pw_impl_node_is_active
bool pw_impl_node_is_active(struct pw_impl_node *node)
Check if a node is active.
Definition impl-node.c:2850
pw_impl_node_register
int pw_impl_node_register(struct pw_impl_node *node, struct pw_properties *properties)
Complete initialization of the node and register.
Definition impl-node.c:929
pw_impl_node_update_properties
int pw_impl_node_update_properties(struct pw_impl_node *node, const struct spa_dict *dict)
Update the node properties.
Definition impl-node.c:1793
pw_impl_node_remove_rt_listener
void pw_impl_node_remove_rt_listener(struct pw_impl_node *node, struct spa_hook *listener)
Definition impl-node.c:2375
pw_impl_node_get_context
struct pw_context * pw_impl_node_get_context(struct pw_impl_node *node)
Get the context of this node.
Definition impl-node.c:1750
pw_context_create_node
struct pw_impl_node * pw_context_create_node(struct pw_context *context, struct pw_properties *properties, size_t user_data_size)
Create a new node.
Definition impl-node.c:1610
pw_impl_node_set_active
int pw_impl_node_set_active(struct pw_impl_node *node, bool active)
Set a node active.
Definition impl-node.c:2828
pw_impl_node_add_rt_listener
void pw_impl_node_add_rt_listener(struct pw_impl_node *node, struct spa_hook *listener, const struct pw_impl_node_rt_events *events, void *data)
Add an rt_event listener.
Definition impl-node.c:2356
pw_impl_node_destroy
void pw_impl_node_destroy(struct pw_impl_node *node)
Destroy a node.
Definition impl-node.c:2389
pw_impl_node_get_global
struct pw_global * pw_impl_node_get_global(struct pw_impl_node *node)
Get the global of this node.
Definition impl-node.c:1756
pw_impl_node_set_param
int pw_impl_node_set_param(struct pw_impl_node *node, uint32_t id, uint32_t flags, const struct spa_pod *param)
Set a param on the node, Since 0.3.65.
Definition impl-node.c:2622
pw_impl_node_get_info
const struct pw_node_info * pw_impl_node_get_info(struct pw_impl_node *node)
Get the node info.
Definition impl-node.c:1738
pw_impl_node_get_implementation
struct spa_node * pw_impl_node_get_implementation(struct pw_impl_node *node)
Get the node implementation.
Definition impl-node.c:2324
pw_impl_node_get_properties
const struct pw_properties * pw_impl_node_get_properties(struct pw_impl_node *node)
Get the node properties.
Definition impl-node.c:1762
pw_impl_node_get_free_port_id
uint32_t pw_impl_node_get_free_port_id(struct pw_impl_node *node, enum pw_direction direction)
Get a free unused port_id from the node.
Definition impl-node.c:2667
pw_impl_node_for_each_port
int pw_impl_node_for_each_port(struct pw_impl_node *node, enum pw_direction direction, int(*callback)(void *data, struct pw_impl_port *port), void *data)
Iterate the ports in the given direction.
Definition impl-node.c:2487
pw_impl_node_get_user_data
void * pw_impl_node_get_user_data(struct pw_impl_node *node)
Get node user_data.
Definition impl-node.c:1744
pw_impl_node_for_each_param
int pw_impl_node_for_each_param(struct pw_impl_node *node, int seq, uint32_t param_id, uint32_t index, uint32_t max, const struct spa_pod *filter, int(*callback)(void *data, int seq, uint32_t id, uint32_t index, uint32_t next, struct spa_pod *param), void *data)
Definition impl-node.c:2538
pw_node_state
pw_node_state
The different node states.
Definition node.h:51
pw_direction
#define pw_direction
The direction of a port.
Definition port.h:51
impl.h
pipewire/impl.h
event.h
spa/node/event.h
node.h
spa/node/node.h
pw_context
pw_global
pw_impl_node_events
Node events, listen to them with pw_impl_node_add_listener.
Definition impl-node.h:37
pw_impl_node_events::peer_removed
void(* peer_removed)(void *data, struct pw_impl_node *peer)
a peer was removed
Definition impl-node.h:82
pw_impl_node_events::state_request
void(* state_request)(void *data, enum pw_node_state state)
a new state is requested on the node
Definition impl-node.h:65
pw_impl_node_events::destroy
void(* destroy)(void *data)
the node is destroyed
Definition impl-node.h:43
pw_impl_node_events::port_init
void(* port_init)(void *data, struct pw_impl_port *port)
a port is being initialized on the node
Definition impl-node.h:50
pw_impl_node_events::peer_added
void(* peer_added)(void *data, struct pw_impl_node *peer)
a peer was added
Definition impl-node.h:80
pw_impl_node_events::result
void(* result)(void *data, int seq, int res, uint32_t type, const void *result)
a result was received
Definition impl-node.h:71
pw_impl_node_events::version
uint32_t version
Definition impl-node.h:40
pw_impl_node_events::free
void(* free)(void *data)
the node is about to be freed
Definition impl-node.h:45
pw_impl_node_events::port_info_changed
void(* port_info_changed)(void *data, struct pw_impl_port *port, const struct pw_port_info *info)
a port on the node changed info
Definition impl-node.h:59
pw_impl_node_events::active_changed
void(* active_changed)(void *data, bool active)
the node active state changed
Definition impl-node.h:62
pw_impl_node_events::port_removed
void(* port_removed)(void *data, struct pw_impl_port *port)
a port was removed
Definition impl-node.h:54
pw_impl_node_events::event
void(* event)(void *data, const struct spa_event *event)
an event is emitted
Definition impl-node.h:74
pw_impl_node_events::info_changed
void(* info_changed)(void *data, const struct pw_node_info *info)
the node info changed
Definition impl-node.h:57
pw_impl_node_events::port_added
void(* port_added)(void *data, struct pw_impl_port *port)
a port was added
Definition impl-node.h:52
pw_impl_node_events::initialized
void(* initialized)(void *data)
the node is initialized
Definition impl-node.h:47
pw_impl_node_events::driver_changed
void(* driver_changed)(void *data, struct pw_impl_node *old, struct pw_impl_node *driver)
the driver of the node changed
Definition impl-node.h:77
pw_impl_node_events::state_changed
void(* state_changed)(void *data, enum pw_node_state old, enum pw_node_state state, const char *error)
the state of the node changed
Definition impl-node.h:67
pw_impl_node_rt_events
Definition impl-node.h:85
pw_impl_node_rt_events::incomplete
void(* incomplete)(void *data)
the driver node did not complete processing
Definition impl-node.h:98
pw_impl_node_rt_events::xrun
void(* xrun)(void *data)
the node had an xrun
Definition impl-node.h:92
pw_impl_node_rt_events::timeout
void(* timeout)(void *data)
the node had a timeout
Definition impl-node.h:100
pw_impl_node_rt_events::complete
void(* complete)(void *data)
the driver node completed processing
Definition impl-node.h:96
pw_impl_node_rt_events::drained
void(* drained)(void *data)
the node is drained
Definition impl-node.h:90
pw_impl_node
pw_impl_port
pw_node_info
The node information.
Definition node.h:65
pw_port_info
Definition port.h:60
pw_properties
Definition properties.h:39
pw_properties::dict
struct spa_dict dict
dictionary of key/values
Definition properties.h:40
spa_command
Definition command.h:29
spa_dict
Definition dict.h:51
spa_event
Definition event.h:28
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:427
spa_node
Definition node.h:51
spa_pod
Definition pod.h:43