Tizen 2.0 Release
[profile/ivi/libmm-sound.git] / include / mm_sound_common.h
1 /*\r
2  * libmm-sound\r
3  *\r
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
5  *\r
6  * Contact: Seungbae Shin <seungbae.shin@samsung.com>\r
7  *\r
8  * Licensed under the Apache License, Version 2.0 (the "License");\r
9  * you may not use this file except in compliance with the License.\r
10  * You may obtain a copy of the License at\r
11  *\r
12  * http://www.apache.org/licenses/LICENSE-2.0\r
13  *\r
14  * Unless required by applicable law or agreed to in writing, software\r
15  * distributed under the License is distributed on an "AS IS" BASIS,\r
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
17  * See the License for the specific language governing permissions and\r
18  * limitations under the License.\r
19  *\r
20  */\r
21 \r
22 #ifndef __MM_SOUND_COMMON_H__\r
23 #define __MM_SOUND_COMMON_H__\r
24 \r
25 ///////////////////////////////////\r
26 ////     MMSOUND VOLUME APIs\r
27 ///////////////////////////////////\r
28 #define VCONF_KEY_VOLUME_PREFIX                         "file/private/sound/volume"\r
29 #define VCONF_KEY_VOLUME_TYPE_SYSTEM            VCONF_KEY_VOLUME_PREFIX"/system"\r
30 #define VCONF_KEY_VOLUME_TYPE_NOTIFICATION      VCONF_KEY_VOLUME_PREFIX"/notification"\r
31 #define VCONF_KEY_VOLUME_TYPE_ALARM                     VCONF_KEY_VOLUME_PREFIX"/alarm"\r
32 #define VCONF_KEY_VOLUME_TYPE_RINGTONE          VCONF_KEY_VOLUME_PREFIX"/ringtone"\r
33 #define VCONF_KEY_VOLUME_TYPE_MEDIA                     VCONF_KEY_VOLUME_PREFIX"/media"\r
34 #define VCONF_KEY_VOLUME_TYPE_CALL                      VCONF_KEY_VOLUME_PREFIX"/call"\r
35 #define VCONF_KEY_VOLUME_TYPE_VOIP                      VCONF_KEY_VOLUME_PREFIX"/voip"\r
36 #define VCONF_KEY_VOLUME_TYPE_ANDROID           VCONF_KEY_VOLUME_PREFIX"/fixed"\r
37 #define VCONF_KEY_VOLUME_TYPE_JAVA                      VCONF_KEY_VOLUME_PREFIX"/java"\r
38 \r
39 #define ASM_READY_KEY           "memory/Sound/ASMReady"\r
40 \r
41 #define MMSOUND_ENTER_CRITICAL_SECTION(x_mutex) \\r
42 switch ( pthread_mutex_lock( x_mutex ) ) \\r
43 { \\r
44 case EINVAL: \\r
45         debug_warning("try mutex init..\n"); \\r
46         if( 0 > pthread_mutex_init( x_mutex, NULL) ) { \\r
47                 return; \\r
48         } else { \\r
49                 break; \\r
50         } \\r
51         return; \\r
52 case 0: \\r
53         break; \\r
54 default: \\r
55         debug_error("mutex lock failed\n"); \\r
56         return; \\r
57 }\r
58 \r
59 #define MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(x_mutex,x_return) \\r
60 switch ( pthread_mutex_lock( x_mutex ) ) \\r
61 { \\r
62 case EINVAL: \\r
63         debug_warning("try mutex init..\n"); \\r
64         if( 0 > pthread_mutex_init( x_mutex, NULL) ) { \\r
65                 return x_return; \\r
66         } else { \\r
67                 break; \\r
68         } \\r
69         return x_return; \\r
70 case 0: \\r
71         break; \\r
72 default: \\r
73         debug_error("mutex lock failed\n"); \\r
74         return x_return; \\r
75 }\r
76 \r
77 #define MMSOUND_LEAVE_CRITICAL_SECTION(x_mutex) \\r
78 if( pthread_mutex_unlock( x_mutex ) ) { \\r
79         debug_error("mutex unlock failed\n"); \\r
80 }\r
81 \r
82 #endif /* __MM_SOUND_COMMON_H__ */\r
83 \r