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
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 
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 *
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 */
res
static uint32_t int int res
Definition: core.h:326
data-loop.h
pw_loop_add_event
#define pw_loop_add_event(l,...)
Definition: loop.h:69
pw_log::pw_log_error
#define pw_log_error(...)
pw_data_loop
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_events
Loop events, use pw_data_loop_add_listener to add a listener.
Definition: data-loop.h:45
pw_loop_signal_event
#define pw_loop_signal_event(l,...)
Definition: loop.h:70
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
data
Definition: filter.c:71
pw_loop_leave
#define pw_loop_leave(l)
Definition: loop.h:63
pw_loop
Definition: loop.h:41
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_exit
SPA_EXPORT void pw_data_loop_exit(struct pw_data_loop *this)
make sure the thread will exit.
Definition: data-loop.c:55
pw_data_loop_events::version
uint32_t version
Definition: data-loop.h:47
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_invoke
SPA_EXPORT 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_events::destroy
void(* destroy)(void *data)
The loop is destroyed.
Definition: data-loop.h:49
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_wait
SPA_EXPORT int pw_data_loop_wait(struct pw_data_loop *this, int timeout)
wait for activity on the loop up to timeout milliseconds.
Definition: data-loop.c:36
pw_data_loop_add_listener
SPA_EXPORT 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_loop_destroy_source
#define pw_loop_destroy_source(l,...)
Definition: loop.h:74
NAME
#define NAME
Definition: data-loop.c:33
pw_log::pw_log_debug
#define pw_log_debug(...)
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
pw_loop::pw_loop_destroy
SPA_EXPORT void pw_loop_destroy(struct pw_loop *loop)
Destroy a loop.
Definition: loop.c:158
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
log.h
loop.h
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_loop_enter
#define pw_loop_enter(l)
Definition: loop.h:61
pw_loop::pw_loop_new
SPA_EXPORT struct pw_loop * pw_loop_new(const struct spa_dict *props)
Create a new loop.
Definition: loop.c:55
seq
static uint32_t int seq
Definition: core.h:325
properties.h
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_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_loop_invoke
#define pw_loop_invoke(l,...)
Definition: loop.h:57
pw_loop::loop
struct spa_loop * loop
wrapped loop
Definition: loop.h:43
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
pw_loop_iterate
#define pw_loop_iterate(l,...)
Definition: loop.h:62