PipeWire  0.1.4
private.h
Go to the documentation of this file.
1 /* PipeWire
2  * Copyright (C) 2015 Wim Taymans <wim.taymans@gmail.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef __PIPEWIRE_PRIVATE_H__
21 #define __PIPEWIRE_PRIVATE_H__
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include <spa/graph.h>
28 
29 #include <sys/socket.h>
30 
31 #include "pipewire/mem.h"
32 #include "pipewire/pipewire.h"
33 #include "pipewire/introspect.h"
34 
35 struct pw_command {
36  struct spa_list link;
37  const char *name;
38 };
39 
40 struct pw_protocol {
41  struct spa_list link;
42  struct pw_core *core;
44  char *name;
46  struct spa_list marshal_list;
47  struct spa_list client_list;
48  struct spa_list server_list;
49  struct spa_hook_list listener_list;
53  const void *extension;
55  void *user_data;
56 };
57 
58 struct pw_client {
59  struct pw_core *core;
60  struct spa_list link;
61  struct pw_global *global;
65  struct pw_client_info info;
66  bool ucred_valid;
67  struct ucred ucred;
71  struct pw_map objects;
72  uint32_t n_types;
73  struct pw_map types;
75  struct spa_list resource_list;
77  bool busy;
78 
79  struct spa_hook_list listener_list;
80 
82  struct spa_list protocol_link;
84  void *user_data;
85 };
86 
87 struct pw_global {
88  struct pw_core *core;
89  struct pw_client *owner;
92  struct spa_list link;
93  uint32_t id;
94  struct pw_global *parent;
96  uint32_t type;
97  uint32_t version;
100  void *object;
101 };
102 
103 struct pw_core {
104  struct pw_global *global;
106  struct pw_core_info info;
110  struct pw_type type;
115  struct pw_map globals;
117  struct spa_list protocol_list;
118  struct spa_list remote_list;
119  struct spa_list resource_list;
120  struct spa_list registry_resource_list;
121  struct spa_list module_list;
122  struct spa_list global_list;
123  struct spa_list client_list;
124  struct spa_list node_list;
125  struct spa_list node_factory_list;
126  struct spa_list link_list;
128  struct spa_hook_list listener_list;
129 
130  struct pw_loop *main_loop;
131  struct pw_loop *data_loop;
133 
134  struct spa_support support[4];
135  uint32_t n_support;
137  struct {
138  struct spa_graph graph;
139  } rt;
140 };
141 
142 struct pw_data_loop {
143  struct pw_loop *loop;
144 
145  struct spa_hook_list listener_list;
146 
147  struct spa_source *event;
148 
149  bool running;
150  pthread_t thread;
151 };
152 
153 struct pw_main_loop {
154  struct pw_loop *loop;
155 
156  struct spa_hook_list listener_list;
157 
158  bool running;
159 };
160 
161 struct pw_link {
162  struct pw_core *core;
163  struct spa_list link;
164  struct pw_global *global;
166  struct pw_link_info info;
169  enum pw_link_state state;
170  char *error;
172  struct spa_list resource_list;
174  struct spa_port_io io;
176  struct pw_port *output;
177  struct spa_list output_link;
178  struct pw_port *input;
179  struct spa_list input_link;
181  struct spa_hook_list listener_list;
182 
183  struct {
184  struct spa_graph_port out_port;
185  struct spa_graph_port in_port;
186  } rt;
187 
188  void *user_data;
189 };
190 
191 struct pw_module {
192  struct pw_core *core;
193  struct spa_list link;
194  struct pw_global *global;
196  struct pw_module_info info;
198  struct spa_list resource_list;
200  struct spa_hook_list listener_list;
201 
202  void *user_data;
203 };
204 
205 struct pw_node {
206  struct pw_core *core;
207  struct spa_list link;
208  struct pw_global *global;
210  struct pw_resource *owner;
213  struct pw_node_info info;
215  bool live;
216  struct spa_clock *clock;
218  struct spa_list resource_list;
223 
224  struct spa_list input_ports;
225  struct pw_map input_port_map;
229  struct spa_list output_ports;
230  struct pw_map output_port_map;
234  struct spa_hook_list listener_list;
235 
236  struct pw_loop *data_loop;
238  struct {
239  struct spa_graph *graph;
240  struct spa_graph_node node;
241  } rt;
242 
243  void *user_data;
244 };
245 
246 struct pw_port {
247  struct spa_list link;
249  struct pw_node *node;
251  enum pw_direction direction;
252  uint32_t port_id;
254 
255  enum pw_port_state state;
259 
260  struct spa_port_io io;
262  bool allocated;
263  struct pw_memblock buffer_mem;
264  struct spa_buffer **buffers;
265  uint32_t n_buffers;
267  struct spa_list links;
269  struct spa_hook_list listener_list;
270 
271  void *mix;
273  struct {
274  struct spa_graph *graph;
275  struct spa_graph_port port;
276  struct spa_graph_port mix_port;
277  struct spa_graph_node mix_node;
278  } rt;
280  void *user_data;
281 };
282 
283 
284 struct pw_resource {
285  struct pw_core *core;
286  struct spa_list link;
288  struct pw_client *client;
290  uint32_t id;
291  uint32_t permissions;
292  uint32_t type;
293  uint32_t version;
295  struct spa_hook implementation;
296  struct spa_hook_list implementation_list;
297  struct spa_hook_list listener_list;
298 
300 
302  void *user_data;
303 };
304 
305 
306 struct pw_proxy {
307  struct pw_remote *remote;
308  struct spa_list link;
310  uint32_t id;
312  struct spa_hook_list listener_list;
313  struct spa_hook_list proxy_listener_list;
314 
315  const struct pw_protocol_marshal *marshal;
317  void *user_data;
318 };
319 
320 struct pw_remote {
321  struct pw_core *core;
322  struct spa_list link;
325  struct pw_core_proxy *core_proxy;
326  struct pw_map objects;
328  struct pw_core_info *info;
330  uint32_t n_types;
331  struct pw_map types;
333  struct spa_list proxy_list;
334  struct spa_list stream_list;
335  struct spa_list remote_node_list;
339  enum pw_remote_state state;
340  char *error;
341 
342  struct spa_hook_list listener_list;
343 };
344 
345 
346 struct pw_stream {
347  struct pw_remote *remote;
348  struct spa_list link;
350  char *name;
351  uint32_t node_id;
355  enum pw_stream_state state;
356  char *error;
358  struct spa_hook_list listener_list;
359 };
360 
362  struct pw_core *core;
363  struct spa_list link;
364  struct pw_global *global;
366  const char *name;
370 
371  void *user_data;
372 };
373 
374 #ifdef __cplusplus
375 }
376 #endif
377 
378 #endif /* __PIPEWIRE_PRIVATE_H__ */
uint32_t id
per client unique id, index in client objects
Definition: private.h:290
const char * name
the factory name
Definition: private.h:366
A collection of key/value pairs.
Definition: properties.h:38
const struct pw_node_implementation * implementation
Implementation of core node functions.
Definition: private.h:221
struct pw_loop * loop
Definition: private.h:143
uint32_t id
client side id
Definition: private.h:310
uint32_t type
type of interface
Definition: private.h:96
uint32_t version
version of interface
Definition: private.h:97
Definition: protocol.h:77
bool busy
Definition: private.h:77
char * error
error reason when state is in error
Definition: private.h:356
Definition: protocol.h:66
PipeWire main-loop interface.
Definition: private.h:153
struct pw_core_proxy * core_proxy
proxy for the core object
Definition: private.h:325
uint32_t node_id
node id for remote node, available from CONFIGURE state and higher
Definition: private.h:351
pw_permission_func_t permission_func
get permissions of an object
Definition: private.h:112
bool allocated
if buffers are allocated
Definition: private.h:262
pw_bind_func_t bind
function to bind to the interface
Definition: private.h:98
char * error
Definition: private.h:340
void * mix
optional port buffer mix/split
Definition: private.h:271
uint32_t n_types
number of client types
Definition: private.h:72
struct pw_global * global
the global of the core
Definition: private.h:104
struct pw_core_info * info
info about the remote core
Definition: private.h:328
bool running
Definition: private.h:158
PipeWire loop interface provides an implementation of the spa loop interfaces.
Definition: loop.h:37
struct pw_core * core
core object
Definition: private.h:206
struct pw_core * core
the core
Definition: private.h:362
struct pw_properties * properties
Definition: private.h:253
const struct pw_node_factory_implementation * implementation
Definition: private.h:368
pthread_t thread
Definition: private.h:150
void * object
object associated with the interface
Definition: private.h:100
struct pw_client * owner
the owner of this object, NULL when the PipeWire server is the owner
Definition: private.h:89
Definition: protocol.h:38
uint32_t n_support
number of support items
Definition: private.h:135
pw_stream_state
The state of a stream.
Definition: stream.h:171
struct spa_source * event
Definition: private.h:147
struct pw_core * core
the core object
Definition: private.h:192
int(* pw_bind_func_t)(struct pw_global *global, struct pw_client *client, uint32_t permissions, uint32_t version, uint32_t id)
Definition: global.h:54
struct spa_buffer ** buffers
port buffers
Definition: private.h:264
struct pw_properties * properties
properties of the node
Definition: private.h:211
A global object visible to all clients.
Definition: private.h:87
Represents an object on the client side.
Definition: private.h:306
struct pw_loop * data_loop
data loop for data passing
Definition: private.h:131
struct pw_global * global
global object created for this client
Definition: private.h:61
pw_link_state
The different link states.
Definition: introspect.h:56
The core information.
Definition: introspect.h:76
uint32_t n_used_input_links
number of active input links
Definition: private.h:226
Definition: node.h:50
uint32_t permissions
resource permissions
Definition: private.h:291
bool running
Definition: private.h:149
struct spa_list link
link in list of commands
Definition: private.h:36
struct pw_global * global
global for this node
Definition: private.h:208
uint32_t n_types
number of client types
Definition: private.h:330
Client owned objects.
Definition: private.h:284
A dynamically loadable module.
Definition: private.h:191
char * name
type name of the protocol
Definition: private.h:44
PipeWire rt-loop object.
Definition: private.h:142
Represents a connection with the PipeWire server.
Definition: private.h:320
const void * extension
extension API
Definition: private.h:53
struct spa_clock * clock
handle to SPA clock if any
Definition: private.h:216
struct pw_protocol * protocol
protocol in use
Definition: private.h:81
struct pw_client * client
owner client
Definition: private.h:288
PipeWire node class.
Definition: private.h:205
struct pw_remote * remote
the owner remote of this proxy
Definition: private.h:307
uint32_t n_used_output_links
number of active output links
Definition: private.h:231
struct pw_core * core
core for this protocol
Definition: private.h:42
PipeWire stream object class.
Definition: private.h:346
bool ucred_valid
if the ucred member is valid
Definition: private.h:66
uint32_t port_id
port id
Definition: private.h:252
const char * name
command name
Definition: private.h:37
struct pw_properties * properties
extra properties
Definition: private.h:323
PipeWire type support struct.
Definition: type.h:48
PipeWire client object class.
Definition: private.h:58
void * user_data
extra user data
Definition: private.h:243
Manages protocols and their implementation.
Definition: private.h:40
PipeWire node factory interface.
Definition: private.h:361
uint32_t idle_used_output_links
number of active output to be idle
Definition: private.h:232
The client information.
Definition: introspect.h:119
struct pw_global * parent
parent global
Definition: private.h:94
void * user_data
Definition: private.h:371
uint32_t n_buffers
number of port buffers
Definition: private.h:265
pw_port_state
Definition: port.h:51
struct pw_global * global
global for this factory
Definition: private.h:364
uint32_t id
server id of the object
Definition: private.h:93
struct spa_graph * graph
Definition: private.h:239
void * permission_data
data passed to permission function
Definition: private.h:113
Memory block structure.
Definition: mem.h:43
struct pw_node * node
owner node
Definition: private.h:249
uint32_t type
type of the client interface
Definition: private.h:292
void * user_data
extra user data
Definition: private.h:280
void * user_data
module user_data
Definition: private.h:202
char * name
the name of the stream
Definition: private.h:350
struct pw_core * core
the core object
Definition: private.h:285
struct pw_properties * properties
properties of the stream
Definition: private.h:353
Definition: node-factory.h:44
const struct pw_protocol_marshal * marshal
Definition: private.h:299
struct pw_protocol_client * conn
the protocol client connection
Definition: private.h:337
The module information.
Definition: introspect.h:102
uint32_t version
version of the client interface
Definition: private.h:293
void * implementation_data
Definition: private.h:222
const struct pw_protocol_implementaton * implementation
implementation of the protocol
Definition: private.h:51
bool live
if the node is live
Definition: private.h:215
struct pw_properties * properties
properties of the core
Definition: private.h:108
const struct pw_port_implementation * implementation
Definition: private.h:257
Definition: port.h:60
struct pw_loop * data_loop
the data loop for this node
Definition: private.h:236
struct pw_data_loop * data_loop_impl
Definition: private.h:132
struct pw_global * global
global object for this module
Definition: private.h:194
struct pw_resource * core_resource
core resource object
Definition: private.h:69
const struct pw_protocol_marshal * marshal
protocol specific marshal functions
Definition: private.h:315
A configuration command.
Definition: private.h:35
void * user_data
extra user data
Definition: private.h:317
struct pw_loop * loop
Definition: private.h:154
void * user_data
extra user data
Definition: private.h:302
void * user_data
extra user data
Definition: private.h:84
struct spa_graph * graph
Definition: private.h:274
pw_remote_state
The state of a pw_remote.
Definition: remote.h:109
struct pw_core * core
core object
Definition: private.h:59
void * implementation_data
Definition: private.h:369
struct pw_remote * remote
the owner remote
Definition: private.h:347
struct pw_loop * main_loop
main loop for control
Definition: private.h:130
void * access_private
private data for access control
Definition: private.h:301
void * user_data
user data for the implementation
Definition: private.h:55
The port object.
Definition: private.h:246
struct pw_properties * properties
Client properties.
Definition: private.h:63
void * implementation_data
Definition: private.h:258
The node information.
Definition: introspect.h:135
uint32_t(* pw_permission_func_t)(struct pw_global *global, struct pw_client *client, void *data)
Definition: core.h:110
the core PipeWire object
Definition: private.h:103
pw_direction
The direction of a port.
Definition: introspect.h:47
struct pw_resource * owner
owner resource if any
Definition: private.h:210
A map.
Definition: map.h:44
struct pw_core * core
the core
Definition: private.h:88
struct pw_core * core
core
Definition: private.h:321
uint32_t idle_used_input_links
number of active input to be idle
Definition: private.h:227