PipeWire  0.3.66
data-loop.h
Go to the documentation of this file.
1 /* PipeWire */
2 /* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3 /* SPDX-License-Identifier: MIT */
4 
5 #ifndef PIPEWIRE_DATA_LOOP_H
6 #define PIPEWIRE_DATA_LOOP_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #include <spa/utils/hook.h>
13 #include <spa/support/thread.h>
14 
27 struct pw_data_loop;
28 
29 #include <pipewire/loop.h>
30 #include <pipewire/properties.h>
31 
33 struct pw_data_loop_events {
34 #define PW_VERSION_DATA_LOOP_EVENTS 0
35  uint32_t version;
37  void (*destroy) (void *data);
38 };
39 
41 struct pw_data_loop *
42 pw_data_loop_new(const struct spa_dict *props);
43 
45 void pw_data_loop_add_listener(struct pw_data_loop *loop,
46  struct spa_hook *listener,
47  const struct pw_data_loop_events *events,
48  void *data);
49 
52 int pw_data_loop_wait(struct pw_data_loop *loop, int timeout);
53 
55 void pw_data_loop_exit(struct pw_data_loop *loop);
56 
58 struct pw_loop *
60 
63 
66 
69 
73 struct spa_thread *pw_data_loop_get_thread(struct pw_data_loop *loop);
74 
77 int pw_data_loop_invoke(struct pw_data_loop *loop,
78  spa_invoke_func_t func, uint32_t seq, const void *data, size_t size,
79  bool block, void *user_data);
80 
84  struct spa_thread_utils *impl);
89 #ifdef __cplusplus
90 }
91 #endif
92 
93 #endif /* PIPEWIRE_DATA_LOOP_H */
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:18
int pw_data_loop_start(struct pw_data_loop *loop)
Start the processing thread.
Definition: data-loop.c:177
void pw_data_loop_set_thread_utils(struct pw_data_loop *loop, struct spa_thread_utils *impl)
Set a custom spa_thread_utils for this loop.
Definition: data-loop.c:268
int pw_data_loop_stop(struct pw_data_loop *loop)
Stop the processing thread.
Definition: data-loop.c:207
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:154
struct spa_thread * pw_data_loop_get_thread(struct pw_data_loop *loop)
Get the thread object.
Definition: data-loop.c:247
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:164
struct pw_data_loop * pw_data_loop_new(const struct spa_dict *props)
Make a new loop.
Definition: data-loop.c:127
void pw_data_loop_destroy(struct pw_data_loop *loop)
Destroy the loop.
Definition: data-loop.c:137
bool pw_data_loop_in_thread(struct pw_data_loop *loop)
Check if the current thread is the processing thread.
Definition: data-loop.c:235
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:253
void pw_data_loop_exit(struct pw_data_loop *loop)
make sure the thread will exit.
Definition: data-loop.c:37
int(* spa_invoke_func_t)(struct spa_loop *loop, bool async, uint32_t seq, const void *data, size_t size, void *user_data)
Definition: spa/include/spa/support/loop.h:66
spa/utils/hook.h
pipewire/properties.h
spa/support/thread.h
pipewire/loop.h
Loop events, use pw_data_loop_add_listener to add a listener.
Definition: data-loop.h:38
uint32_t version
Definition: data-loop.h:41
void(* destroy)(void *data)
The loop is destroyed.
Definition: data-loop.h:43
Definition: src/pipewire/loop.h:31
struct spa_loop * loop
wrapped loop
Definition: src/pipewire/loop.h:33
Definition: utils/dict.h:39
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:331
Definition: spa/include/spa/support/thread.h:45