Use hal interface
[platform/adaptation/emulator/audio-hal-emul.git] / hal-backend-audio.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <stdint.h>
4 #include <errno.h>
5 #include <tizen-audio.h>
6 #include <hal/hal-common-interface.h>
7
8 static int audio_emul_init(void **data)
9 {
10     hal_backend_audio_funcs *funcs;
11
12     funcs = calloc(1, sizeof(hal_backend_audio_funcs));
13     if (!funcs)
14         return -ENOMEM;
15
16     funcs->init = audio_init;
17     funcs->deinit = audio_deinit;
18     funcs->get_volume_level_max = audio_get_volume_level_max;
19     funcs->set_volume_level = audio_set_volume_level;
20     funcs->get_volume_value = audio_get_volume_value;
21     funcs->get_volume_mute = audio_get_volume_mute;
22     funcs->set_volume_mute = audio_set_volume_mute;
23     funcs->update_route = audio_update_route;
24     funcs->update_route_option = audio_update_route_option;
25     funcs->notify_stream_connection_changed = audio_notify_stream_connection_changed;
26     funcs->pcm_open = audio_pcm_open;
27     funcs->pcm_start = audio_pcm_start;
28     funcs->pcm_stop = audio_pcm_stop;
29     funcs->pcm_close = audio_pcm_close;
30     funcs->pcm_avail = audio_pcm_avail;
31     funcs->pcm_write = audio_pcm_write;
32     funcs->pcm_read = audio_pcm_read;
33     funcs->pcm_get_fd = audio_pcm_get_fd;
34     funcs->pcm_recover = audio_pcm_recover;
35     funcs->pcm_get_params = audio_pcm_get_params;
36     funcs->pcm_set_params = audio_pcm_set_params;
37
38     *data = (void *)funcs;
39
40     return 0;
41 }
42
43 static void audio_emul_exit(void *data)
44 {
45     if (!data)
46         return;
47
48     free(data);
49 }
50
51 hal_backend hal_backend_audio_data = {
52     .name = "audio-emul",
53     .vendor = "Tizen",
54     .abi_version = HAL_ABI_VERSION_TIZEN_6_5,
55     .init = audio_emul_init,
56     .exit = audio_emul_exit,
57 };