PipeWire 0.2.6

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/utils/defs.h>
28 #include <spa/utils/hook.h>
29
38 struct pw_core;
39
40 #include <pipewire/type.h>
41 #include <pipewire/client.h>
42 #include <pipewire/global.h>
43 #include <pipewire/introspect.h>
44 #include <pipewire/loop.h>
45 #include <pipewire/factory.h>
46 #include <pipewire/port.h>
47 #include <pipewire/properties.h>
48
76 #define PW_PERM_R 0400
77 #define PW_PERM_W 0200
78 #define PW_PERM_X 0100
80 #define PW_PERM_RWX (PW_PERM_R|PW_PERM_W|PW_PERM_X)
81
82 #define PW_PERM_IS_R(p) (((p)&PW_PERM_R) == PW_PERM_R)
83 #define PW_PERM_IS_W(p) (((p)&PW_PERM_W) == PW_PERM_W)
84 #define PW_PERM_IS_X(p) (((p)&PW_PERM_X) == PW_PERM_X)
85
87 struct pw_core_events {
88 #define PW_VERSION_CORE_EVENTS 0
89 uint32_t version;
90
92 void (*destroy) (void *data);
94 void (*free) (void *data);
96 void (*info_changed) (void *data, struct pw_core_info *info);
98 void (*global_added) (void *data, struct pw_global *global);
100 void (*global_removed) (void *data, struct pw_global *global);
101 };
102
104 #define PW_CORE_PROP_USER_NAME "pipewire.core.user-name"
105
106 #define PW_CORE_PROP_HOST_NAME "pipewire.core.host-name"
107
108 #define PW_CORE_PROP_NAME "pipewire.core.name"
109
110 #define PW_CORE_PROP_VERSION "pipewire.core.version"
111
112 #define PW_CORE_PROP_DAEMON "pipewire.daemon"
113
115 struct pw_core * pw_core_new(struct pw_loop *main_loop, struct pw_properties *props);
116
118 void pw_core_destroy(struct pw_core *core);
119
121 void pw_core_add_listener(struct pw_core *core,
122 struct spa_hook *listener,
123 const struct pw_core_events *events,
124 void *data);
125
127 struct pw_type *pw_core_get_type(struct pw_core *core);
128
130 const struct pw_core_info *pw_core_get_info(struct pw_core *core);
131
133 struct pw_global *pw_core_get_global(struct pw_core *core);
134
136 const struct pw_properties *pw_core_get_properties(struct pw_core *core);
137
139 int pw_core_update_properties(struct pw_core *core, const struct spa_dict *dict);
140
142 const struct spa_support *pw_core_get_support(struct pw_core *core, uint32_t *n_support);
143
145 struct pw_loop *pw_core_get_main_loop(struct pw_core *core);
146
151 int pw_core_for_each_global(struct pw_core *core,
152 int (*callback) (void *data, struct pw_global *global),
153 void *data);
154
156 struct pw_global *pw_core_find_global(struct pw_core *core,
157 uint32_t id );
158
160 struct pw_factory *
161 pw_core_find_factory(struct pw_core *core ,
162 const char *name );
163
164 #ifdef __cplusplus
165 }
166 #endif
167
168 #endif /* __PIPEWIRE_CORE_H__ */
pw_core_get_properties
const struct pw_properties * pw_core_get_properties(struct pw_core *core)
Get the core properties.
Definition: core.c:571
pw_properties
A collection of key/value pairs.
Definition: properties.h:38
pw_core_events
core events emited by the core object added with pw_core_add_listener
Definition: core.h:88
pw_core::pw_core_destroy
SPA_EXPORT void pw_core_destroy(struct pw_core *core)
Destroy a core object.
Definition: core.c:486
introspect.h
pw_loop
PipeWire loop object provides an implementation of the spa loop interfaces.
Definition: loop.h:37
pw_core_get_info
const struct pw_core_info * pw_core_get_info(struct pw_core *core)
Get the core info object.
Definition: core.c:531
pw_properties::dict
struct spa_dict dict
Definition: properties.h:39
pw_core_events::destroy
void(* destroy)(void *data)
The core is being destroyed.
Definition: core.h:93
pw_core_get_support
const struct spa_support * pw_core_get_support(struct pw_core *core, uint32_t *n_support)
Get the core support objects.
Definition: core.c:558
pw_core_events::version
uint32_t version
Definition: core.h:90
pw_core
the core PipeWire object
pw_core_find_global
struct pw_global * pw_core_find_global(struct pw_core *core, uint32_t id)
Find a core global by id.
Definition: core.c:631
pw_core_info
The core information.
Definition: introspect.h:76
global.h
pw_type::core
uint32_t core
Definition: type.h:54
pw_core_events::global_removed
void(* global_removed)(void *data, struct pw_global *global)
a global object was removed
Definition: core.h:101
pw_core::pw_core_find_factory
SPA_EXPORT struct pw_factory * pw_core_find_factory(struct pw_core *core, const char *name)
Find a factory by name.
Definition: core.c:883
loop.h
pw_core_events::free
void(* free)(void *data)
The core is being freed.
Definition: core.h:95
pw_factory
PipeWire factory interface.
pw_core_get_global
struct pw_global * pw_core_get_global(struct pw_core *core)
Get the core global object.
Definition: core.c:537
pw_type
PipeWire type support struct.
Definition: type.h:51
pw_core_events::info_changed
void(* info_changed)(void *data, struct pw_core_info *info)
The core info changed, use pw_core_get_info() to get the updated info.
Definition: core.h:97
factory.h
pw_core_for_each_global
int pw_core_for_each_global(struct pw_core *core, int(*callback)(void *data, struct pw_global *global), void *data)
Iterate the globals of the core.
Definition: core.c:613
properties.h
pw_core_get_type
struct pw_type * pw_core_get_type(struct pw_core *core)
Get the type object of a core.
Definition: core.c:552
port.h
pw_global
A global object visible to remote clients.
pw_core_get_main_loop
struct pw_loop * pw_core_get_main_loop(struct pw_core *core)
get the core main loop
Definition: core.c:565
client.h
pw_core_add_listener
void pw_core_add_listener(struct pw_core *core, struct spa_hook *listener, const struct pw_core_events *events, void *data)
Add a new event listener to a core.
Definition: core.c:543
pw_core::pw_core_new
SPA_EXPORT struct pw_core * pw_core_new(struct pw_loop *main_loop, struct pw_properties *properties)
Create a new core object.
Definition: core.c:377
pw_core_events::global_added
void(* global_added)(void *data, struct pw_global *global)
a new global object was added
Definition: core.h:99
pw_core::pw_core_update_properties
SPA_EXPORT int pw_core_update_properties(struct pw_core *core, const struct spa_dict *dict)
Update core properties.
Definition: core.c:586
type.h