svolume: add comment
[pulseaudio-mirror.git] / src / tests / hook-list-test.c
blob452e47765da072be9f46c0dc209e68de6aa20d55
1 #ifdef HAVE_CONFIG_H
2 #include <config.h>
3 #endif
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);
10 return PA_HOOK_OK;
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);
15 return PA_HOOK_OK;
18 int main(int argc, char *argv[]) {
19 pa_hook hook;
20 pa_hook_slot *slot;
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");
34 pa_hook_done(&hook);
36 return 0;