PipeWire  0.3.30
src/pipewire/loop.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_LOOP_H
26 #define PIPEWIRE_LOOP_H
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include <spa/support/loop.h>
33 #include <spa/utils/dict.h>
34 
47 struct pw_loop {
48  struct spa_system *system;
49  struct spa_loop *loop;
52 };
53 
54 struct pw_loop *
55 pw_loop_new(const struct spa_dict *props);
56 
57 void
59 
60 #define pw_loop_add_source(l,...) spa_loop_add_source((l)->loop,__VA_ARGS__)
61 #define pw_loop_update_source(l,...) spa_loop_update_source((l)->loop,__VA_ARGS__)
62 #define pw_loop_remove_source(l,...) spa_loop_remove_source((l)->loop,__VA_ARGS__)
63 #define pw_loop_invoke(l,...) spa_loop_invoke((l)->loop,__VA_ARGS__)
64 
65 #define pw_loop_get_fd(l) spa_loop_control_get_fd((l)->control)
66 #define pw_loop_add_hook(l,...) spa_loop_control_add_hook((l)->control,__VA_ARGS__)
67 #define pw_loop_enter(l) spa_loop_control_enter((l)->control)
68 #define pw_loop_iterate(l,...) spa_loop_control_iterate((l)->control,__VA_ARGS__)
69 #define pw_loop_leave(l) spa_loop_control_leave((l)->control)
70 
71 #define pw_loop_add_io(l,...) spa_loop_utils_add_io((l)->utils,__VA_ARGS__)
72 #define pw_loop_update_io(l,...) spa_loop_utils_update_io((l)->utils,__VA_ARGS__)
73 #define pw_loop_add_idle(l,...) spa_loop_utils_add_idle((l)->utils,__VA_ARGS__)
74 #define pw_loop_enable_idle(l,...) spa_loop_utils_enable_idle((l)->utils,__VA_ARGS__)
75 #define pw_loop_add_event(l,...) spa_loop_utils_add_event((l)->utils,__VA_ARGS__)
76 #define pw_loop_signal_event(l,...) spa_loop_utils_signal_event((l)->utils,__VA_ARGS__)
77 #define pw_loop_add_timer(l,...) spa_loop_utils_add_timer((l)->utils,__VA_ARGS__)
78 #define pw_loop_update_timer(l,...) spa_loop_utils_update_timer((l)->utils,__VA_ARGS__)
79 #define pw_loop_add_signal(l,...) spa_loop_utils_add_signal((l)->utils,__VA_ARGS__)
80 #define pw_loop_destroy_source(l,...) spa_loop_utils_destroy_source((l)->utils,__VA_ARGS__)
81 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif /* PIPEWIRE_LOOP_H */
pw_loop_new
SPA_EXPORT struct pw_loop * pw_loop_new(const struct spa_dict *props)
Create a new loop.
Definition: loop.c:54
control
Definition: stream.c:86
NAME
#define NAME
Definition: loop.c:38
SPA_SUPPORT_INIT
#define SPA_SUPPORT_INIT(type, data)
Definition: plugin.h:107
loop.h
pw_get_support
uint32_t pw_get_support(struct spa_support *support, uint32_t max_support)
Definition: pipewire.c:230
pw_loop
Definition: src/pipewire/loop.h:47
SPA_EXPORT
#define SPA_EXPORT
Definition: defs.h:208
impl
Definition: control.c:33
pw_loop::utils
struct spa_loop_utils * utils
loop utils
Definition: src/pipewire/loop.h:51
res
static uint32_t int int res
Definition: core.h:329
spa_loop
Definition: build-11172026/doc/spa/support/loop.h:44
SPA_CONTAINER_OF
#define SPA_CONTAINER_OF(p, t, m)
Definition: defs.h:170
spa_system
Definition: system.h:52
SPA_NAME_SUPPORT_LOOP
#define SPA_NAME_SUPPORT_LOOP
A Loop/LoopControl/LoopUtils interface.
Definition: names.h:44
pw_loop::control
struct spa_loop_control * control
loop control
Definition: src/pipewire/loop.h:50
pw_loop::system
struct spa_system * system
system utils
Definition: src/pipewire/loop.h:48
loop.h
spa_loop_control
Definition: build-11172026/doc/spa/support/loop.h:48
type.h
spa_handle
Definition: plugin.h:44
spa_dict
Definition: utils/dict.h:48
spa_dict_lookup
const char * spa_dict_lookup(const struct spa_dict *dict, const char *key)
Definition: utils/dict.h:99
SPA_TYPE_INTERFACE_LoopControl
#define SPA_TYPE_INTERFACE_LoopControl
Definition: build-11172026/doc/spa/support/loop.h:46
spa_strerror
#define spa_strerror(err)
Definition: result.h:51
result.h
spa_handle_get_interface
#define spa_handle_get_interface(h,...)
Definition: plugin.h:73
pw_unload_spa_handle
int pw_unload_spa_handle(struct spa_handle *handle)
Definition: pipewire.c:318
SPA_TYPE_INTERFACE_System
#define SPA_TYPE_INTERFACE_System
a collection of core system functions
Definition: system.h:48
PW_KEY_LIBRARY_NAME_LOOP
#define PW_KEY_LIBRARY_NAME_LOOP
name of the loop library to use
Definition: src/pipewire/keys.h:56
impl::this
struct pw_control this
Definition: control.c:34
pw_loop_destroy
SPA_EXPORT void pw_loop_destroy(struct pw_loop *loop)
Destroy a loop.
Definition: loop.c:156
spa_loop_utils
Definition: build-11172026/doc/spa/support/loop.h:52
SPA_TYPE_INTERFACE_Loop
#define SPA_TYPE_INTERFACE_Loop
Definition: build-11172026/doc/spa/support/loop.h:41
pw_load_spa_handle
struct spa_handle * pw_load_spa_handle(const char *lib, const char *factory_name, const struct spa_dict *info, uint32_t n_support, const struct spa_support support[])
Definition: pipewire.c:239
SPA_NAME_SUPPORT_SYSTEM
#define SPA_NAME_SUPPORT_SYSTEM
A System interface.
Definition: names.h:46
pipewire.h
names.h
pw_loop::loop
struct spa_loop * loop
wrapped loop
Definition: src/pipewire/loop.h:49
SPA_TYPE_INTERFACE_LoopUtils
#define SPA_TYPE_INTERFACE_LoopUtils
Definition: build-11172026/doc/spa/support/loop.h:50
spa_support
Extra supporting infrastructure passed to the init() function of a factory.
Definition: plugin.h:89
PW_KEY_LIBRARY_NAME_SYSTEM
#define PW_KEY_LIBRARY_NAME_SYSTEM
name of the system library to use
Definition: src/pipewire/keys.h:55
log.h
support
Definition: pipewire.c:77
pw_log_error
#define pw_log_error(...)
Definition: src/pipewire/log.h:86
dict.h