Merge 1. Support DOCK Audio 2. Fix build breaks
[framework/multimedia/libmm-sound.git] / include / mm_ipc.h
1 /*
2  * libmm-sound
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Seungbae Shin <seungbae.shin@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #ifndef __MM_SOUND_IPC_H__
23 #define __MM_SOUND_IPC_H__
24
25 #include <stdio.h>
26 #include <unistd.h>
27
28 #include "mm_sound.h"
29
30 #define FILE_PATH 512
31
32 typedef enum {
33     MM_IPC_SUCCESS,
34     MM_IPC_WARNING,
35     MM_IPC_ERROR,
36     MM_IPC_PROCESS,
37 } mm_ipc_async_state;
38
39 typedef struct
40 {
41         /* Recieve data */
42         int msgid;
43         int msgtype;
44         int code;
45         
46         /* Send data */
47         int keytone;
48         int repeat;
49         int tone;
50         double volume;
51         int memptr;
52         int memsize;
53         int sharedkey;
54         char filename[FILE_PATH];
55
56         /* Device */
57         int route;
58         int device_in;
59         int device_out;
60         int is_available;
61         int route_list[MM_SOUND_ROUTE_NUM];
62
63         /* Common data */
64         int handle;
65         void *callback;
66         void *cbdata;
67         int samplerate;
68         int channels;
69         int volume_table;
70         int session_type;
71         int priority;
72         int handle_route;
73 } mmsound_ipc_t;
74
75 typedef struct
76 {
77         long msg_type;
78         mmsound_ipc_t sound_msg;
79 } mm_ipc_msg_t;
80
81 typedef void (*mm_ipc_callback_t)(int code, int size);
82
83 int MMSoundGetTime(char *position);
84 int MMIpcCreate(const int key);
85 int MMIpcDestroy(const int key);
86 int MMIpcSendMsg(const int key, mm_ipc_msg_t *msg);
87 int MMIpcRecvMsg(const int key, mm_ipc_msg_t *msg);
88
89 int MMIpcSendMsgAsync(const char *ipcname, mm_ipc_msg_t *msg, mm_ipc_callback_t callback);
90 int MMIpcRecvMsgAsync(const char *ipcname, mm_ipc_msg_t **msg, mm_ipc_callback_t callback);
91 int MMIpcRecvData(const char *ipcname, void *data, int *size);
92 int MMIpcSendDataAsync(const char *ipcname, void *data, int size, mm_ipc_callback_t callback);
93 int __mm_sound_lock(void);
94 int __mm_sound_unlock(void);
95
96 #endif  /* __MM_SOUND_IPC_H__ */
97