PipeWire: data-loop.h Source File

PipeWire 0.3.20

data-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_DATA_LOOP_H
26 #define PIPEWIRE_DATA_LOOP_H
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #include <spa/utils/hook.h>
33
39 struct pw_data_loop;
40
41 #include <pipewire/loop.h>
42 #include <pipewire/properties.h>
43
45 struct pw_data_loop_events {
46 #define PW_VERSION_DATA_LOOP_EVENTS 0
47 uint32_t version;
49 void (*destroy) (void *data);
50 };
51
53 struct pw_data_loop *
54 pw_data_loop_new(const struct spa_dict *props);
55
57 void pw_data_loop_add_listener(struct pw_data_loop *loop,
58 struct spa_hook *listener,
59 const struct pw_data_loop_events *events,
60 void *data);
61
64 int pw_data_loop_wait(struct pw_data_loop *loop, int timeout);
65
67 void pw_data_loop_exit(struct pw_data_loop *loop);
68
70 struct pw_loop *
71 pw_data_loop_get_loop(struct pw_data_loop *loop);
72
74 void pw_data_loop_destroy(struct pw_data_loop *loop);
75
77 int pw_data_loop_start(struct pw_data_loop *loop);
78
80 int pw_data_loop_stop(struct pw_data_loop *loop);
81
83 bool pw_data_loop_in_thread(struct pw_data_loop *loop);
84
87 int pw_data_loop_invoke(struct pw_data_loop *loop,
88 spa_invoke_func_t func, uint32_t seq, const void *data, size_t size,
89 bool block, void *user_data);
90
91 #ifdef __cplusplus
92 }
93 #endif
94
95 #endif /* PIPEWIRE_DATA_LOOP_H */
pw_data_loop
PipeWire rt-loop object.
pw_data_loop::pw_data_loop_in_thread
SPA_EXPORT bool pw_data_loop_in_thread(struct pw_data_loop *loop)
Check if we are inside the data loop.
Definition: data-loop.c:256
pw_data_loop::pw_data_loop_new
SPA_EXPORT struct pw_data_loop * pw_data_loop_new(const struct spa_dict *props)
Create a new pw_data_loop.
Definition: data-loop.c:153
pw_data_loop::pw_data_loop_stop
SPA_EXPORT int pw_data_loop_stop(struct pw_data_loop *loop)
Stop a data loop.
Definition: data-loop.c:230
pw_data_loop::pw_data_loop_start
SPA_EXPORT int pw_data_loop_start(struct pw_data_loop *loop)
Start a data loop.
Definition: data-loop.c:206
pw_data_loop::pw_data_loop_destroy
SPA_EXPORT void pw_data_loop_destroy(struct pw_data_loop *loop)
Destroy a data loop.
Definition: data-loop.c:164
seq
static uint32_t int seq
Definition: core.h:325
pw_data_loop_wait
int pw_data_loop_wait(struct pw_data_loop *loop, int timeout)
wait for activity on the loop up to timeout milliseconds.
Definition: data-loop.c:36
pw_data_loop_add_listener
void pw_data_loop_add_listener(struct pw_data_loop *loop, struct spa_hook *listener, const struct pw_data_loop_events *events, void *data)
Add an event listener to loop.
Definition: data-loop.c:183
pw_data_loop_get_loop
struct pw_loop * pw_data_loop_get_loop(struct pw_data_loop *loop)
Get the loop implementation of this data loop.
Definition: data-loop.c:192
pw_data_loop_invoke
int pw_data_loop_invoke(struct pw_data_loop *loop, spa_invoke_func_t func, uint32_t seq, const void *data, size_t size, bool block, void *user_data)
invoke func in the context of the thread or in the caller thread when the loop is not running.
Definition: data-loop.c:262
pw_data_loop_exit
void pw_data_loop_exit(struct pw_data_loop *loop)
make sure the thread will exit.
Definition: data-loop.c:55
loop.h
properties.h
data
Definition: filter.c:74
pw_data_loop_events
Loop events, use pw_data_loop_add_listener to add a listener.
Definition: data-loop.h:45
pw_data_loop_events::version
uint32_t version
Definition: data-loop.h:47
pw_data_loop_events::destroy
void(* destroy)(void *data)
The loop is destroyed.
Definition: data-loop.h:49
pw_loop
PipeWire loop object provides an implementation of the spa loop interfaces.
Definition: loop.h:41
pw_loop::loop
struct spa_loop * loop
wrapped loop
Definition: loop.h:43