PipeWire
0.3.33
|
A SPA Hook is a data structure to keep track of callbacks. More...
Data Structures | |
struct | spa_hook_list |
A list of hooks. More... | |
struct | spa_hook |
A hook, contains the structure with functions and the data passed to the functions. More... | |
Macros | |
#define | spa_hook_list_call_simple(l, type, method, vers, ...) |
#define | spa_hook_list_do_call(l, start, type, method, vers, once, ...) |
Call all hooks in a list, starting from the given one and optionally stopping after calling the first non-NULL function, returns the number of methods called. More... | |
#define | spa_hook_list_call(l, t, m, v, ...) spa_hook_list_do_call(l,NULL,t,m,v,false,##__VA_ARGS__) |
Call the method named m for each element in list l. More... | |
#define | spa_hook_list_call_once(l, t, m, v, ...) spa_hook_list_do_call(l,NULL,t,m,v,true,##__VA_ARGS__) |
Call the method named m for each element in list l, stopping after the first invocation. More... | |
#define | spa_hook_list_call_start(l, s, t, m, v, ...) spa_hook_list_do_call(l,s,t,m,v,false,##__VA_ARGS__) |
#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__) |
Functions | |
void | spa_hook_list_init (struct spa_hook_list *list) |
Initialize a hook list to the empty list. More... | |
bool | spa_hook_list_is_empty (struct spa_hook_list *list) |
void | spa_hook_list_append (struct spa_hook_list *list, struct spa_hook *hook, const void *funcs, void *data) |
Append a hook. More... | |
void | spa_hook_list_prepend (struct spa_hook_list *list, struct spa_hook *hook, const void *funcs, void *data) |
Prepend a hook. More... | |
void | spa_hook_remove (struct spa_hook *hook) |
Remove a hook. More... | |
void | spa_hook_list_clean (struct spa_hook_list *list) |
Remove all hooks from the list. More... | |
void | spa_hook_list_isolate (struct spa_hook_list *list, struct spa_hook_list *save, struct spa_hook *hook, const void *funcs, void *data) |
void | spa_hook_list_join (struct spa_hook_list *list, struct spa_hook_list *save) |
A SPA Hook is a data structure to keep track of callbacks.
It is similar to the SPA Interfaces and typically used where an implementation allows for multiple external callback functions. For example, an implementation may use a hook list to implement signals with each caller using a hook to register callbacks to be invoked on those signals.
The below (pseudo)code is a minimal example outlining the use of hooks:
In the caller, the hooks can be used like this:
#define spa_hook_list_call | ( | l, | |
t, | |||
m, | |||
v, | |||
... | |||
) | spa_hook_list_do_call(l,NULL,t,m,v,false,##__VA_ARGS__) |
Call the method named m for each element in list l.
t specifies the type of the callback struct.
#define spa_hook_list_call_once | ( | l, | |
t, | |||
m, | |||
v, | |||
... | |||
) | spa_hook_list_do_call(l,NULL,t,m,v,true,##__VA_ARGS__) |
Call the method named m for each element in list l, stopping after the first invocation.
t specifies the type of the callback struct.
#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__) |
#define spa_hook_list_call_simple | ( | l, | |
type, | |||
method, | |||
vers, | |||
... | |||
) |
#define spa_hook_list_call_start | ( | l, | |
s, | |||
t, | |||
m, | |||
v, | |||
... | |||
) | spa_hook_list_do_call(l,s,t,m,v,false,##__VA_ARGS__) |
#define spa_hook_list_do_call | ( | l, | |
start, | |||
type, | |||
method, | |||
vers, | |||
once, | |||
... | |||
) |
Call all hooks in a list, starting from the given one and optionally stopping after calling the first non-NULL function, returns the number of methods called.
|
inline |
Append a hook.
References spa_hook::cb, spa_hook::link, spa_hook_list::list, SPA_CALLBACKS_INIT, spa_list_append, and spa_zero.
Referenced by pw_context_add_listener(), pw_control_add_listener(), pw_data_loop_add_listener(), pw_filter_get_state(), pw_global_add_listener(), pw_impl_client_add_listener(), pw_impl_core_add_listener(), pw_impl_device_add_listener(), pw_impl_factory_add_listener(), pw_impl_link_add_listener(), pw_impl_metadata_add_listener(), pw_impl_module_add_listener(), pw_impl_node_add_listener(), pw_impl_port_add_listener(), pw_main_loop_add_listener(), pw_mempool_add_listener(), pw_protocol_add_listener(), pw_proxy_add_listener(), pw_proxy_add_object_listener(), pw_resource_add_listener(), pw_resource_add_object_listener(), pw_stream_get_state(), pw_thread_loop_add_listener(), sm_object_add_listener(), and spa_hook_list_isolate().
|
inline |
Remove all hooks from the list.
References spa_hook_list::list, spa_hook_remove(), and spa_list_consume.
Referenced by pw_control_destroy(), pw_data_loop_destroy(), pw_impl_core_destroy(), pw_impl_factory_destroy(), pw_impl_module_destroy(), pw_main_loop_destroy(), pw_mempool_destroy(), pw_protocol_destroy(), and pw_thread_loop_destroy().
|
inline |
Initialize a hook list to the empty list.
References spa_hook_list::list, and spa_list_init().
Referenced by pw_context_create_core(), pw_context_create_device(), pw_context_create_factory(), pw_context_create_metadata(), pw_context_create_port(), pw_control_new(), pw_mempool_new(), pw_protocol_new(), pw_resource_new(), and spa_hook_list_isolate().
|
inline |
References spa_hook_list::list, and spa_list_is_empty.
|
inline |
References spa_hook_list::list, spa_hook_list_append(), spa_hook_list_init(), and spa_list_insert_list().
Referenced by sm_media_session_add_listener().
|
inline |
References spa_hook_list::list, and spa_list_insert_list().
Referenced by sm_media_session_add_listener().
|
inline |
Prepend a hook.
References spa_hook::cb, spa_hook::link, spa_hook_list::list, SPA_CALLBACKS_INIT, spa_list_prepend, and spa_zero.
|
inline |
Remove a hook.
References spa_hook::link, spa_hook::removed, and spa_list_remove().
Referenced by pw_filter_destroy(), pw_filter_disconnect(), pw_impl_client_destroy(), pw_impl_core_destroy(), pw_impl_factory_destroy(), pw_impl_metadata_destroy(), pw_impl_metadata_set_implementation(), pw_impl_module_destroy(), pw_stream_destroy(), pw_stream_disconnect(), pw_thread_loop_destroy(), and spa_hook_list_clean().