PipeWire: pipewire/impl-node.h Source File

PipeWire 0.3.59

impl-node.h
Go to the documentation of this file.
1/* PipeWire
2 *
3 * Copyright © 2018 Wim Taymans
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25#ifndef PIPEWIRE_IMPL_NODE_H
26#define PIPEWIRE_IMPL_NODE_H
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
42struct pw_impl_node;
43struct pw_impl_port;
44
45#include <spa/node/node.h>
46#include <spa/node/event.h>
47
48#include <pipewire/impl.h>
49
51struct pw_impl_node_events {
52#define PW_VERSION_IMPL_NODE_EVENTS 0
53 uint32_t version;
54
56 void (*destroy) (void *data);
58 void (*free) (void *data);
60 void (*initialized) (void *data);
61
63 void (*port_init) (void *data, struct pw_impl_port *port);
65 void (*port_added) (void *data, struct pw_impl_port *port);
67 void (*port_removed) (void *data, struct pw_impl_port *port);
68
70 void (*info_changed) (void *data, const struct pw_node_info *info);
72 void (*port_info_changed) (void *data, struct pw_impl_port *port,
73 const struct pw_port_info *info);
75 void (*active_changed) (void *data, bool active);
76
78 void (*state_request) (void *data, enum pw_node_state state);
80 void (*state_changed) (void *data, enum pw_node_state old,
81 enum pw_node_state state, const char *error);
82
84 void (*result) (void *data, int seq, int res, uint32_t type, const void *result);
85
87 void (*event) (void *data, const struct spa_event *event);
88
90 void (*driver_changed) (void *data, struct pw_impl_node *old, struct pw_impl_node *driver);
91
93 void (*peer_added) (void *data, struct pw_impl_node *peer);
95 void (*peer_removed) (void *data, struct pw_impl_node *peer);
96};
97
99struct pw_impl_node *
100 pw_context_create_node(struct pw_context *context,
101 struct pw_properties *properties,
102 size_t user_data_size );
103
105int pw_impl_node_register(struct pw_impl_node *node,
106 struct pw_properties *properties );
107
109void pw_impl_node_destroy(struct pw_impl_node *node);
110
112const struct pw_node_info *pw_impl_node_get_info(struct pw_impl_node *node);
113
115void * pw_impl_node_get_user_data(struct pw_impl_node *node);
116
118struct pw_context *pw_impl_node_get_context(struct pw_impl_node *node);
119
121struct pw_global *pw_impl_node_get_global(struct pw_impl_node *node);
122
124const struct pw_properties *pw_impl_node_get_properties(struct pw_impl_node *node);
125
127int pw_impl_node_update_properties(struct pw_impl_node *node, const struct spa_dict *dict);
128
130int pw_impl_node_set_implementation(struct pw_impl_node *node, struct spa_node *spa_node);
131
133struct spa_node *pw_impl_node_get_implementation(struct pw_impl_node *node);
134
136void pw_impl_node_add_listener(struct pw_impl_node *node,
137 struct spa_hook *listener,
138 const struct pw_impl_node_events *events,
139 void *data);
140
145int pw_impl_node_for_each_port(struct pw_impl_node *node,
146 enum pw_direction direction,
147 int (*callback) (void *data, struct pw_impl_port *port),
148 void *data);
149
150int pw_impl_node_for_each_param(struct pw_impl_node *node,
151 int seq, uint32_t param_id,
152 uint32_t index, uint32_t max,
153 const struct spa_pod *filter,
154 int (*callback) (void *data, int seq,
155 uint32_t id, uint32_t index, uint32_t next,
156 struct spa_pod *param),
157 void *data);
158
161struct pw_impl_port *
162 pw_impl_node_find_port(struct pw_impl_node *node, enum pw_direction direction, uint32_t port_id);
163
165uint32_t pw_impl_node_get_free_port_id(struct pw_impl_node *node, enum pw_direction direction);
166
167int pw_impl_node_initialized(struct pw_impl_node *node);
168
171int pw_impl_node_set_active(struct pw_impl_node *node, bool active);
172
174bool pw_impl_node_is_active(struct pw_impl_node *node);
175
177int pw_impl_node_send_command(struct pw_impl_node *node, const struct spa_command *command);
182#ifdef __cplusplus
183}
184#endif
185
186#endif /* PIPEWIRE_IMPL_NODE_H */
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:2060
pw_impl_node_initialized
int pw_impl_node_initialized(struct pw_impl_node *node)
Definition: impl-node.c:787
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:1788
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:1817
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:2268
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:2262
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:707
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:1382
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:1339
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:1212
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:2240
pw_impl_node_destroy
void pw_impl_node_destroy(struct pw_impl_node *node)
Destroy a node.
Definition: impl-node.c:1832
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:1345
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:1327
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:1811
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:1351
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:2095
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:1914
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:1333
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:1969
pw_node_state
pw_node_state
The different node states.
Definition: node.h:63
pw_direction
#define pw_direction
The direction of a port.
Definition: port.h:63
impl.h
pipewire/impl.h
event.h
spa/node/event.h
node.h
spa/node/node.h
pw_context
pw_global
Definition: context.h:67
pw_impl_node_events
Node events, listen to them with pw_impl_node_add_listener.
Definition: impl-node.h:57
pw_impl_node_events::peer_removed
void(* peer_removed)(void *data, struct pw_impl_node *peer)
a peer was removed
Definition: impl-node.h:102
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:85
pw_impl_node_events::destroy
void(* destroy)(void *data)
the node is destroyed
Definition: impl-node.h:63
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:70
pw_impl_node_events::peer_added
void(* peer_added)(void *data, struct pw_impl_node *peer)
a peer was added
Definition: impl-node.h:100
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:91
pw_impl_node_events::version
uint32_t version
Definition: impl-node.h:60
pw_impl_node_events::free
void(* free)(void *data)
the node is about to be freed
Definition: impl-node.h:65
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:79
pw_impl_node_events::active_changed
void(* active_changed)(void *data, bool active)
the node active state changed
Definition: impl-node.h:82
pw_impl_node_events::port_removed
void(* port_removed)(void *data, struct pw_impl_port *port)
a port was removed
Definition: impl-node.h:74
pw_impl_node_events::event
void(* event)(void *data, const struct spa_event *event)
an event is emitted
Definition: impl-node.h:94
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:77
pw_impl_node_events::port_added
void(* port_added)(void *data, struct pw_impl_port *port)
a port was added
Definition: impl-node.h:72
pw_impl_node_events::initialized
void(* initialized)(void *data)
the node is initialized
Definition: impl-node.h:67
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:97
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:87
pw_impl_node
pw_impl_port
Definition: impl.h:47
pw_node_info
The node information.
Definition: node.h:77
pw_port_info
Definition: port.h:72
pw_properties
Definition: properties.h:53
pw_properties::dict
struct spa_dict dict
dictionary of key/values
Definition: properties.h:54
spa_command
Definition: command.h:49
spa_dict
Definition: dict.h:59
spa_event
Definition: event.h:48
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:351
spa_node
Definition: node.h:61
spa_pod
Definition: pod.h:63