45 #define SPA_TYPE_INTERFACE_Loop SPA_TYPE_INFO_INTERFACE_BASE "Loop"
46 #define SPA_TYPE_INTERFACE_DataLoop SPA_TYPE_INFO_INTERFACE_BASE "DataLoop"
47 #define SPA_VERSION_LOOP 0
50 #define SPA_TYPE_INTERFACE_LoopControl SPA_TYPE_INFO_INTERFACE_BASE "LoopControl"
51 #define SPA_VERSION_LOOP_CONTROL 0
54 #define SPA_TYPE_INTERFACE_LoopUtils SPA_TYPE_INFO_INTERFACE_BASE "LoopUtils"
55 #define SPA_VERSION_LOOP_UTILS 0
84 #define SPA_VERSION_LOOP_METHODS 0
100 int (*
invoke) (
void *object,
109 #define spa_loop_method(o,method,version,...) \
111 int _res = -ENOTSUP; \
112 struct spa_loop *_o = o; \
113 spa_interface_call_res(&_o->iface, \
114 struct spa_loop_methods, _res, \
115 method, version, ##__VA_ARGS__); \
119 #define spa_loop_add_source(l,...) spa_loop_method(l,add_source,0,##__VA_ARGS__)
120 #define spa_loop_update_source(l,...) spa_loop_method(l,update_source,0,##__VA_ARGS__)
121 #define spa_loop_remove_source(l,...) spa_loop_method(l,remove_source,0,##__VA_ARGS__)
122 #define spa_loop_invoke(l,...) spa_loop_method(l,invoke,0,##__VA_ARGS__)
129 #define SPA_VERSION_LOOP_CONTROL_HOOKS 0
133 void (*
before) (
void *data);
136 void (*
after) (
void *data);
139 #define spa_loop_control_hook_before(l) \
141 struct spa_hook_list *_l = l; \
142 struct spa_hook *_h; \
143 spa_list_for_each_reverse(_h, &_l->list, link) \
144 spa_callbacks_call(&_h->cb, struct spa_loop_control_hooks, before, 0); \
147 #define spa_loop_control_hook_after(l) \
149 struct spa_hook_list *_l = l; \
150 struct spa_hook *_h; \
151 spa_list_for_each(_h, &_l->list, link) \
152 spa_callbacks_call(&_h->cb, struct spa_loop_control_hooks, after, 0); \
161 #define SPA_VERSION_LOOP_CONTROL_METHODS 0
164 int (*
get_fd) (
void *object);
184 void (*
enter) (
void *object);
191 void (*
leave) (
void *object);
202 int (*
iterate) (
void *object,
int timeout);
205 #define spa_loop_control_method_v(o,method,version,...) \
207 struct spa_loop_control *_o = o; \
208 spa_interface_call(&_o->iface, \
209 struct spa_loop_control_methods, \
210 method, version, ##__VA_ARGS__); \
213 #define spa_loop_control_method_r(o,method,version,...) \
215 int _res = -ENOTSUP; \
216 struct spa_loop_control *_o = o; \
217 spa_interface_call_res(&_o->iface, \
218 struct spa_loop_control_methods, _res, \
219 method, version, ##__VA_ARGS__); \
223 #define spa_loop_control_get_fd(l) spa_loop_control_method_r(l,get_fd,0)
224 #define spa_loop_control_add_hook(l,...) spa_loop_control_method_v(l,add_hook,0,__VA_ARGS__)
225 #define spa_loop_control_enter(l) spa_loop_control_method_v(l,enter,0)
226 #define spa_loop_control_leave(l) spa_loop_control_method_v(l,leave,0)
227 #define spa_loop_control_iterate(l,...) spa_loop_control_method_r(l,iterate,0,__VA_ARGS__)
241 #define SPA_VERSION_LOOP_UTILS_METHODS 0
257 struct spa_source *(*add_event) (
void *object,
265 struct timespec *value,
266 struct timespec *interval,
268 struct spa_source *(*add_signal) (
void *object,
278 #define spa_loop_utils_method_v(o,method,version,...) \
280 struct spa_loop_utils *_o = o; \
281 spa_interface_call(&_o->iface, \
282 struct spa_loop_utils_methods, \
283 method, version, ##__VA_ARGS__); \
286 #define spa_loop_utils_method_r(o,method,version,...) \
288 int _res = -ENOTSUP; \
289 struct spa_loop_utils *_o = o; \
290 spa_interface_call_res(&_o->iface, \
291 struct spa_loop_utils_methods, _res, \
292 method, version, ##__VA_ARGS__); \
295 #define spa_loop_utils_method_s(o,method,version,...) \
297 struct spa_source *_res = NULL; \
298 struct spa_loop_utils *_o = o; \
299 spa_interface_call_res(&_o->iface, \
300 struct spa_loop_utils_methods, _res, \
301 method, version, ##__VA_ARGS__); \
306 #define spa_loop_utils_add_io(l,...) spa_loop_utils_method_s(l,add_io,0,__VA_ARGS__)
307 #define spa_loop_utils_update_io(l,...) spa_loop_utils_method_r(l,update_io,0,__VA_ARGS__)
308 #define spa_loop_utils_add_idle(l,...) spa_loop_utils_method_s(l,add_idle,0,__VA_ARGS__)
309 #define spa_loop_utils_enable_idle(l,...) spa_loop_utils_method_r(l,enable_idle,0,__VA_ARGS__)
310 #define spa_loop_utils_add_event(l,...) spa_loop_utils_method_s(l,add_event,0,__VA_ARGS__)
311 #define spa_loop_utils_signal_event(l,...) spa_loop_utils_method_r(l,signal_event,0,__VA_ARGS__)
312 #define spa_loop_utils_add_timer(l,...) spa_loop_utils_method_s(l,add_timer,0,__VA_ARGS__)
313 #define spa_loop_utils_update_timer(l,...) spa_loop_utils_method_r(l,update_timer,0,__VA_ARGS__)
314 #define spa_loop_utils_add_signal(l,...) spa_loop_utils_method_s(l,add_signal,0,__VA_ARGS__)
315 #define spa_loop_utils_destroy_source(l,...) spa_loop_utils_method_v(l,destroy_source,0,__VA_ARGS__)
void(* spa_source_timer_func_t)(void *data, uint64_t expirations)
Definition: loop.h:266
void(* spa_source_event_func_t)(void *data, uint64_t count)
Definition: loop.h:265
void(* spa_source_signal_func_t)(void *data, int signal_number)
Definition: loop.h:267
void(* spa_source_idle_func_t)(void *data)
Definition: loop.h:264
void(* spa_source_func_t)(struct spa_source *source)
Definition: loop.h:73
int(* spa_invoke_func_t)(struct spa_loop *loop, bool async, uint32_t seq, const void *data, size_t size, void *user_data)
Definition: loop.h:84
void(* spa_source_io_func_t)(void *data, int fd, uint32_t mask)
Definition: loop.h:263
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:342
Control hooks.
Definition: loop.h:150
void(* before)(void *data)
Executed right before waiting for events.
Definition: loop.h:156
uint32_t version
Definition: loop.h:153
void(* after)(void *data)
Executed right after waiting for events.
Definition: loop.h:159
Control an event loop.
Definition: loop.h:181
int(* get_fd)(void *object)
Definition: loop.h:188
int(* iterate)(void *object, int timeout)
Perform one iteration of the loop.
Definition: loop.h:226
void(* enter)(void *object)
Enter a loop.
Definition: loop.h:208
void(* add_hook)(void *object, struct spa_hook *hook, const struct spa_loop_control_hooks *hooks, void *data)
Add a hook.
Definition: loop.h:196
void(* leave)(void *object)
Leave a loop.
Definition: loop.h:215
uint32_t version
Definition: loop.h:186
struct spa_interface iface
Definition: loop.h:62
Register sources and work items to an event loop.
Definition: loop.h:94
int(* add_source)(void *object, struct spa_source *source)
add a source to the loop
Definition: loop.h:102
int(* remove_source)(void *object, struct spa_source *source)
remove a source from the loop
Definition: loop.h:110
int(* invoke)(void *object, spa_invoke_func_t func, uint32_t seq, const void *data, size_t size, bool block, void *user_data)
invoke a function in the context of this loop
Definition: loop.h:114
int(* update_source)(void *object, struct spa_source *source)
update the source io mask
Definition: loop.h:106
uint32_t version
Definition: loop.h:99
Create sources for an event loop.
Definition: loop.h:272
int(* update_io)(void *object, struct spa_source *source, uint32_t mask)
Definition: loop.h:285
int(* enable_idle)(void *object, struct spa_source *source, bool enabled)
Definition: loop.h:290
int(* signal_event)(void *object, struct spa_source *source)
Definition: loop.h:294
int(* update_timer)(void *object, struct spa_source *source, struct timespec *value, struct timespec *interval, bool absolute)
Definition: loop.h:298
void(* destroy_source)(void *object, struct spa_source *source)
destroy a source allocated with this interface.
Definition: loop.h:310
uint32_t version
Definition: loop.h:277
struct spa_interface iface
Definition: loop.h:68
struct spa_interface iface
Definition: loop.h:56
uint32_t rmask
Definition: loop.h:81
void * data
Definition: loop.h:78
uint32_t mask
Definition: loop.h:80
spa_source_func_t func
Definition: loop.h:77
int fd
Definition: loop.h:79
struct spa_loop * loop
Definition: loop.h:76