Go to the documentation of this file.
136 #define SPA_CALLBACK_CHECK(c,m,v) ((c) && ((v) == 0 || (c)->version > (v)-1) && (c)->m)
142 #define SPA_CALLBACKS_INIT(_funcs,_data) (struct spa_callbacks){ _funcs, _data, }
165 #define SPA_INTERFACE_INIT(_type,_version,_funcs,_data) \
166 (struct spa_interface){ _type, _version, SPA_CALLBACKS_INIT(_funcs,_data), }
172 #define spa_callbacks_call(callbacks,type,method,vers,...) \
174 const type *_f = (const type *) (callbacks)->funcs; \
175 if (SPA_LIKELY(SPA_CALLBACK_CHECK(_f,method,vers))) \
176 _f->method((callbacks)->data, ## __VA_ARGS__); \
185 #define spa_callbacks_call_res(callbacks,type,res,method,vers,...) \
187 const type *_f = (const type *) (callbacks)->funcs; \
188 if (SPA_LIKELY(SPA_CALLBACK_CHECK(_f,method,vers))) \
189 res = _f->method((callbacks)->data, ## __VA_ARGS__); \
198 #define spa_interface_call(iface,method_type,method,vers,...) \
199 spa_callbacks_call(&(iface)->cb,method_type,method,vers,##__VA_ARGS__)
208 #define spa_interface_call_res(iface,method_type,res,method,vers,...) \
209 spa_callbacks_call_res(&(iface)->cb,method_type,res,method,vers,##__VA_ARGS__)
318 const void *funcs,
void *
data)
328 const void *funcs,
void *
data)
355 const void *funcs,
void *
data)
372 #define spa_hook_list_call_simple(l,type,method,vers,...) \
374 struct spa_hook_list *_l = l; \
375 struct spa_hook *_h, *_t; \
376 spa_list_for_each_safe(_h, _t, &_l->list, link) \
377 spa_callbacks_call(&_h->cb,type,method,vers, ## __VA_ARGS__); \
383 #define spa_hook_list_do_call(l,start,type,method,vers,once,...) \
385 struct spa_hook_list *list = l; \
386 struct spa_list *s = start ? (struct spa_list *)start : &list->list; \
387 struct spa_hook cursor = { 0 }, *ci; \
389 spa_list_cursor_start(cursor, s, link); \
390 spa_list_for_each_cursor(ci, cursor, &list->list, link) { \
391 const type *_f = (const type *)ci->cb.funcs; \
392 if (SPA_LIKELY(SPA_CALLBACK_CHECK(_f,method,vers))) { \
393 _f->method(ci->cb.data, ## __VA_ARGS__); \
399 spa_list_cursor_end(cursor, link); \
407 #define spa_hook_list_call(l,t,m,v,...) spa_hook_list_do_call(l,NULL,t,m,v,false,##__VA_ARGS__)
413 #define spa_hook_list_call_once(l,t,m,v,...) spa_hook_list_do_call(l,NULL,t,m,v,true,##__VA_ARGS__)
415 #define spa_hook_list_call_start(l,s,t,m,v,...) spa_hook_list_do_call(l,s,t,m,v,false,##__VA_ARGS__)
416 #define spa_hook_list_call_once_start(l,s,t,m,v,...) spa_hook_list_do_call(l,s,t,m,v,true,##__VA_ARGS__)
Definition: module-filter-chain.c:170
void spa_hook_list_join(struct spa_hook_list *list, struct spa_hook_list *save)
Definition: hook.h:366
struct spa_callbacks cb
Definition: hook.h:149
#define spa_zero(x)
Definition: defs.h:303
struct spa_list link
Definition: hook.h:296
user data to add to an object
Definition: filter.c:75
void spa_list_insert_list(struct spa_list *list, struct spa_list *other)
Definition: list.h:59
void spa_hook_list_append(struct spa_hook_list *list, struct spa_hook *hook, const void *funcs, void *data)
Append a hook.
Definition: hook.h:316
#define spa_list_consume(pos, head, member)
Definition: list.h:96
void spa_hook_list_isolate(struct spa_hook_list *list, struct spa_hook_list *save, struct spa_hook *hook, const void *funcs, void *data)
Definition: hook.h:352
#define spa_list_prepend(list, item)
Definition: list.h:84
void spa_list_remove(struct spa_list *elem)
Definition: list.h:69
A hook, contains the structure with functions and the data passed to the functions.
Definition: hook.h:295
Callbacks, contains the structure with functions and the data passed to the functions.
Definition: hook.h:130
void(* removed)(struct spa_hook *hook)
callback and data for the hook list, private to the hook_list implementor
Definition: hook.h:300
void spa_list_init(struct spa_list *list)
Definition: list.h:44
struct spa_callbacks cb
Definition: hook.h:297
const char * type
Definition: hook.h:147
void * data
Definition: hook.h:132
#define spa_list_is_empty(l)
Definition: list.h:49
A list of hooks.
Definition: hook.h:284
const void * funcs
Definition: hook.h:131
uint32_t version
Definition: hook.h:148
void spa_hook_remove(struct spa_hook *hook)
Remove a hook.
Definition: hook.h:336
void * priv
Definition: hook.h:301
void spa_hook_list_init(struct spa_hook_list *list)
Initialize a hook list to the empty list.
Definition: hook.h:305
bool spa_hook_list_is_empty(struct spa_hook_list *list)
Definition: hook.h:310
#define SPA_CALLBACKS_INIT(_funcs, _data)
Initialize the set of functions funcs as a spa_callbacks, together with _data.
Definition: hook.h:142
void spa_hook_list_prepend(struct spa_hook_list *list, struct spa_hook *hook, const void *funcs, void *data)
Prepend a hook.
Definition: hook.h:326
void spa_hook_list_clean(struct spa_hook_list *list)
Remove all hooks from the list.
Definition: hook.h:344
struct spa_list list
Definition: hook.h:285
#define spa_list_append(list, item)
Definition: list.h:81