PipeWire  0.2.0
loop.h
Go to the documentation of this file.
1 /* PipeWire
2  * Copyright (C) 2016 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_LOOP_H__
21 #define __PIPEWIRE_LOOP_H__
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include <spa/support/loop.h>
28 
29 #include <pipewire/properties.h>
30 
37 struct pw_loop {
38  struct spa_loop *loop;
39  struct spa_loop_control *control;
40  struct spa_loop_utils *utils;
41 };
42 
43 struct pw_loop *
44 pw_loop_new(struct pw_properties *properties);
45 
46 void
48 
49 #define pw_loop_add_source(l,...) spa_loop_add_source((l)->loop,__VA_ARGS__)
50 #define pw_loop_update_source(l,...) spa_loop_update_source(__VA_ARGS__)
51 #define pw_loop_remove_source(l,...) spa_loop_remove_source(__VA_ARGS__)
52 #define pw_loop_invoke(l,...) spa_loop_invoke((l)->loop,__VA_ARGS__)
53 
54 #define pw_loop_get_fd(l) spa_loop_control_get_fd((l)->control)
55 #define pw_loop_add_hook(l,...) spa_loop_control_add_hook((l)->control,__VA_ARGS__)
56 #define pw_loop_enter(l) spa_loop_control_enter((l)->control)
57 #define pw_loop_iterate(l,...) spa_loop_control_iterate((l)->control,__VA_ARGS__)
58 #define pw_loop_leave(l) spa_loop_control_leave((l)->control)
59 
60 #define pw_loop_add_io(l,...) spa_loop_utils_add_io((l)->utils,__VA_ARGS__)
61 #define pw_loop_update_io(l,...) spa_loop_utils_update_io((l)->utils,__VA_ARGS__)
62 #define pw_loop_add_idle(l,...) spa_loop_utils_add_idle((l)->utils,__VA_ARGS__)
63 #define pw_loop_enable_idle(l,...) spa_loop_utils_enable_idle((l)->utils,__VA_ARGS__)
64 #define pw_loop_add_event(l,...) spa_loop_utils_add_event((l)->utils,__VA_ARGS__)
65 #define pw_loop_signal_event(l,...) spa_loop_utils_signal_event((l)->utils,__VA_ARGS__)
66 #define pw_loop_add_timer(l,...) spa_loop_utils_add_timer((l)->utils,__VA_ARGS__)
67 #define pw_loop_update_timer(l,...) spa_loop_utils_update_timer((l)->utils,__VA_ARGS__)
68 #define pw_loop_add_signal(l,...) spa_loop_utils_add_signal((l)->utils,__VA_ARGS__)
69 #define pw_loop_destroy_source(l,...) spa_loop_utils_destroy_source((l)->utils,__VA_ARGS__)
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif /* __PIPEWIRE_LOOP_H__ */
void pw_loop_destroy(struct pw_loop *loop)
Destroy a loop.
Definition: loop.c:119
A collection of key/value pairs.
Definition: properties.h:38
PipeWire loop object provides an implementation of the spa loop interfaces.
Definition: loop.h:37
struct spa_loop * loop
wrapped loop
Definition: loop.h:38
struct spa_loop_utils * utils
loop utils
Definition: loop.h:40
struct pw_loop * pw_loop_new(struct pw_properties *properties)
Create a new loop.
Definition: loop.c:44
struct spa_loop_control * control
loop control
Definition: loop.h:39