]> code.delx.au - pulseaudio/blob - src/tests/hook-list-test.c
merge 'lennart' branch back into trunk.
[pulseaudio] / src / tests / hook-list-test.c
1 /* $Id$ */
2
3 #ifdef HAVE_CONFIG_H
4 #include <config.h>
5 #endif
6
7 #include <pulsecore/hook-list.h>
8 #include <pulsecore/log.h>
9
10 static pa_hook_result_t func1(const char*hook_data, const char*call_data, const char*slot_data) {
11 pa_log("(func1) hook=%s call=%s slot=%s", hook_data, call_data, slot_data);
12 return PA_HOOK_OK;
13 }
14
15 static pa_hook_result_t func2(const char*hook_data, const char*call_data, const char*slot_data) {
16 pa_log("(func2) hook=%s call=%s slot=%s", hook_data, call_data, slot_data);
17 return PA_HOOK_OK;
18 }
19
20 int main(int argc, char *argv[]) {
21 pa_hook hook;
22 pa_hook_slot *slot;
23
24 pa_hook_init(&hook, (void*) "hook");
25
26 pa_hook_connect(&hook, (pa_hook_cb_t) func1, (void*) "slot1");
27 slot = pa_hook_connect(&hook, (pa_hook_cb_t) func2, (void*) "slot2");
28 pa_hook_connect(&hook, (pa_hook_cb_t) func1, (void*) "slot3");
29
30 pa_hook_fire(&hook, (void*) "call1");
31
32 pa_hook_slot_free(slot);
33
34 pa_hook_fire(&hook, (void*) "call2");
35
36 pa_hook_free(&hook);
37
38 return 0;
39 }