PipeWire  0.1.4
core.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_CORE_H__
21 #define __PIPEWIRE_CORE_H__
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include <spa/hook.h>
28 #include <spa/format.h>
29 
39 struct pw_core;
40 
41 #include <pipewire/client.h>
42 #include <pipewire/global.h>
43 #include <pipewire/introspect.h>
44 #include <pipewire/loop.h>
45 #include <pipewire/node-factory.h>
46 #include <pipewire/port.h>
47 #include <pipewire/properties.h>
48 #include <pipewire/type.h>
49 
104 #define PW_PERM_R 0400
105 #define PW_PERM_W 0200
106 #define PW_PERM_X 0100
108 #define PW_PERM_RWX (PW_PERM_R|PW_PERM_W|PW_PERM_X)
109 typedef uint32_t (*pw_permission_func_t) (struct pw_global *global,
110  struct pw_client *client, void *data);
111 
112 #define PW_PERM_IS_R(p) (((p)&PW_PERM_R) == PW_PERM_R)
113 #define PW_PERM_IS_W(p) (((p)&PW_PERM_W) == PW_PERM_W)
114 #define PW_PERM_IS_X(p) (((p)&PW_PERM_X) == PW_PERM_X)
116 struct pw_core_events {
117 #define PW_VERSION_CORE_EVENTS 0
118  uint32_t version;
120  void (*destroy) (void *data);
122  void (*free) (void *data);
124  void (*info_changed) (void *data, struct pw_core_info *info);
126  void (*global_added) (void *data, struct pw_global *global);
128  void (*global_removed) (void *data, struct pw_global *global);
129 };
130 
131 struct pw_core *
132 pw_core_new(struct pw_loop *main_loop, struct pw_properties *props);
133 
134 void pw_core_destroy(struct pw_core *core);
135 
136 void pw_core_add_listener(struct pw_core *core,
137  struct spa_hook *listener,
138  const struct pw_core_events *events,
139  void *data);
140 
141 void pw_core_set_permission_callback(struct pw_core *core,
142  pw_permission_func_t callback,
143  void *data);
144 
145 struct pw_type *pw_core_get_type(struct pw_core *core);
146 
147 const struct pw_core_info *pw_core_get_info(struct pw_core *core);
148 
149 struct pw_global *pw_core_get_global(struct pw_core *core);
150 
151 const struct pw_properties *pw_core_get_properties(struct pw_core *core);
152 
153 const struct spa_support *pw_core_get_support(struct pw_core *core, uint32_t *n_support);
154 
155 struct pw_loop *pw_core_get_main_loop(struct pw_core *core);
156 
157 void pw_core_update_properties(struct pw_core *core, const struct spa_dict *dict);
158 
160 bool pw_core_for_each_global(struct pw_core *core,
161  bool (*callback) (void *data, struct pw_global *global),
162  void *data);
163 
164 struct pw_global *pw_core_find_global(struct pw_core *core, uint32_t id);
165 
166 struct spa_format *
167 pw_core_find_format(struct pw_core *core,
168  struct pw_port *output,
169  struct pw_port *input,
170  struct pw_properties *props,
171  uint32_t n_format_filters,
172  struct spa_format **format_filters,
173  char **error);
174 
175 struct pw_port *
176 pw_core_find_port(struct pw_core *core,
177  struct pw_port *other_port,
178  uint32_t id,
179  struct pw_properties *props,
180  uint32_t n_format_filters,
181  struct spa_format **format_filters,
182  char **error);
183 
184 struct pw_node_factory *
185 pw_core_find_node_factory(struct pw_core *core, const char *name);
186 
187 #ifdef __cplusplus
188 }
189 #endif
190 
191 #endif /* __PIPEWIRE_CORE_H__ */
const struct pw_properties * pw_core_get_properties(struct pw_core *core)
Definition: core.c:471
const char * name
the factory name
Definition: private.h:366
A collection of key/value pairs.
Definition: properties.h:38
Definition: core.h:117
struct pw_port * pw_core_find_port(struct pw_core *core, struct pw_port *other_port, uint32_t id, struct pw_properties *props, uint32_t n_format_filters, struct spa_format **format_filters, char **error)
PipeWire loop interface provides an implementation of the spa loop interfaces.
Definition: loop.h:37
const struct pw_core_info * pw_core_get_info(struct pw_core *core)
Definition: core.c:429
void(* destroy)(void *data)
Definition: core.h:121
void pw_core_set_permission_callback(struct pw_core *core, pw_permission_func_t callback, void *data)
Definition: core.c:447
const struct spa_support * pw_core_get_support(struct pw_core *core, uint32_t *n_support)
Definition: core.c:460
uint32_t version
Definition: core.h:119
A global object visible to all clients.
Definition: private.h:87
struct pw_global * pw_core_find_global(struct pw_core *core, uint32_t id)
Definition: core.c:516
The core information.
Definition: introspect.h:76
bool pw_core_for_each_global(struct pw_core *core, bool(*callback)(void *data, struct pw_global *global), void *data)
iterate the globals
Definition: core.c:504
uint32_t core
Definition: type.h:51
void(* global_removed)(void *data, struct pw_global *global)
Definition: core.h:129
void(* free)(void *data)
Definition: core.h:123
struct pw_global * pw_core_get_global(struct pw_core *core)
Definition: core.c:434
struct pw_core * pw_core_new(struct pw_loop *main_loop, struct pw_properties *props)
PipeWire type support struct.
Definition: type.h:48
void(* info_changed)(void *data, struct pw_core_info *info)
Definition: core.h:125
PipeWire client object class.
Definition: private.h:58
struct spa_format * pw_core_find_format(struct pw_core *core, struct pw_port *output, struct pw_port *input, struct pw_properties *props, uint32_t n_format_filters, struct spa_format **format_filters, char **error)
PipeWire node factory interface.
Definition: private.h:361
void pw_core_destroy(struct pw_core *core)
void pw_core_update_properties(struct pw_core *core, const struct spa_dict *dict)
struct pw_type * pw_core_get_type(struct pw_core *core)
Definition: core.c:455
struct pw_loop * pw_core_get_main_loop(struct pw_core *core)
Definition: core.c:466
struct pw_loop * main_loop
main loop for control
Definition: private.h:130
The port object.
Definition: private.h:246
struct pw_node_factory * pw_core_find_node_factory(struct pw_core *core, const char *name)
void pw_core_add_listener(struct pw_core *core, struct spa_hook *listener, const struct pw_core_events *events, void *data)
Definition: core.c:439
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
void(* global_added)(void *data, struct pw_global *global)
Definition: core.h:127
struct pw_core * core
the core
Definition: private.h:88