Rebase code with tizen 2.3 with following additional changes
[platform/core/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 #include "mm_sound_device.h"
30
31
32 #define FILE_PATH 512
33
34 typedef enum {
35     MM_IPC_SUCCESS,
36     MM_IPC_WARNING,
37     MM_IPC_ERROR,
38     MM_IPC_PROCESS,
39 } mm_ipc_async_state;
40
41 typedef struct
42 {
43         /* Recieve data */
44         int msgid;
45         int msgtype;
46         int code;
47         
48         /* Send data */
49         int keytone;
50         int repeat;
51         int tone;
52         double volume;
53         int memptr;
54         int memsize;
55         int sharedkey;
56         char filename[FILE_PATH];
57
58         /* Device */
59         mm_sound_device_t device_handle;
60         int total_device_num;
61         int device_flags;
62         bool is_connected;
63         int changed_device_info_type;
64
65         int route;
66         int device_in;
67         int device_out;
68         int is_available;
69         int route_list[MM_SOUND_ROUTE_NUM];
70
71         /* Volume */
72         int type;
73         int val;
74
75         /* Common data */
76         int handle;
77         void *callback;
78         void *cbdata;
79         int samplerate;
80         int channels;
81         int volume_config;
82         int session_type;
83         int session_options;
84         int priority;
85         int handle_route;
86
87         bool enable_session;
88         bool need_broadcast;
89
90         char name[MM_SOUND_NAME_NUM];
91 } mmsound_ipc_t;
92
93 typedef struct
94 {
95         long msg_type;
96         mmsound_ipc_t sound_msg;
97 } mm_ipc_msg_t;
98
99 typedef void (*mm_ipc_callback_t)(int code, int size);
100
101 int MMSoundGetTime(char *position);
102 int MMIpcCreate(const int key);
103 int MMIpcDestroy(const int key);
104 int MMIpcSendMsg(const int key, mm_ipc_msg_t *msg);
105 int MMIpcRecvMsg(const int key, mm_ipc_msg_t *msg);
106
107 int MMIpcSendMsgAsync(const char *ipcname, mm_ipc_msg_t *msg, mm_ipc_callback_t callback);
108 int MMIpcRecvMsgAsync(const char *ipcname, mm_ipc_msg_t **msg, mm_ipc_callback_t callback);
109 int MMIpcRecvData(const char *ipcname, void *data, int *size);
110 int MMIpcSendDataAsync(const char *ipcname, void *data, int size, mm_ipc_callback_t callback);
111 int __mm_sound_lock(void);
112 int __mm_sound_unlock(void);
113
114 #endif  /* __MM_SOUND_IPC_H__ */
115