5 #include <pulsecore/hook-list.h>
6 #include <pulsecore/log.h>
8 static pa_hook_result_t func1(const char *hook_data, const char *call_data, const char *slot_data) {
9 pa_log("(func1) hook=%s call=%s slot=%s", hook_data, call_data, slot_data);
13 static pa_hook_result_t func2(const char *hook_data, const char *call_data, const char *slot_data) {
14 pa_log("(func2) hook=%s call=%s slot=%s", hook_data, call_data, slot_data);
18 int main(int argc, char *argv[]) {
22 pa_hook_init(&hook, (void*) "hook");
24 pa_hook_connect(&hook, PA_HOOK_LATE, (pa_hook_cb_t) func1, (void*) "slot1");
25 slot = pa_hook_connect(&hook, PA_HOOK_NORMAL, (pa_hook_cb_t) func2, (void*) "slot2");
26 pa_hook_connect(&hook, PA_HOOK_NORMAL, (pa_hook_cb_t) func1, (void*) "slot3");
28 pa_hook_fire(&hook, (void*) "call1");
30 pa_hook_slot_free(slot);
32 pa_hook_fire(&hook, (void*) "call2");