PipeWire 0.3.15
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
29extern "C" {
30#endif
31
32#include <spa/utils/hook.h>
33
39struct pw_data_loop;
40
41#include <pipewire/loop.h>
42#include <pipewire/properties.h>
43
46#define PW_VERSION_DATA_LOOP_EVENTS 0
47 uint32_t version;
49 void (*destroy) (void *data);
50};
51
53struct pw_data_loop *
54pw_data_loop_new(const struct spa_dict *props);
55
58 struct spa_hook *listener,
59 const struct pw_data_loop_events *events,
60 void *data);
61
64int pw_data_loop_wait(struct pw_data_loop *loop, int timeout);
65
67void pw_data_loop_exit(struct pw_data_loop *loop);
68
70struct pw_loop *
72
75
78
81
84
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 */
PipeWire rt-loop object.
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:253
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
SPA_EXPORT int pw_data_loop_stop(struct pw_data_loop *loop)
Stop a data loop.
Definition: data-loop.c:227
SPA_EXPORT int pw_data_loop_start(struct pw_data_loop *loop)
Start a data loop.
Definition: data-loop.c:203
SPA_EXPORT void pw_data_loop_destroy(struct pw_data_loop *loop)
Destroy a data loop.
Definition: data-loop.c:164
static uint32_t int seq
Definition: core.h:325
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
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:180
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:189
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:259
void pw_data_loop_exit(struct pw_data_loop *loop)
make sure the thread will exit.
Definition: data-loop.c:55
Definition: filter.c:71
Loop events, use pw_data_loop_add_listener to add a listener.
Definition: data-loop.h:45
uint32_t version
Definition: data-loop.h:47
void(* destroy)(void *data)
The loop is destroyed.
Definition: data-loop.h:49
PipeWire loop object provides an implementation of the spa loop interfaces.
Definition: loop.h:41
struct spa_loop * loop
wrapped loop
Definition: loop.h:43