Remove ASMReady / FMRadioRecording / Vconf initialization
[platform/core/multimedia/libmm-sound.git] / include / mm_sound_common.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_COMMON_H__
23 #define __MM_SOUND_COMMON_H__
24
25 #include <errno.h>
26
27 ///////////////////////////////////
28 ////     MMSOUND VOLUME APIs
29 ///////////////////////////////////
30 #define VCONF_KEY_VOLUME_PREFIX                         "file/private/sound/volume"
31 #define VCONF_KEY_VOLUME_TYPE_SYSTEM            VCONF_KEY_VOLUME_PREFIX"/system"
32 #define VCONF_KEY_VOLUME_TYPE_NOTIFICATION      VCONF_KEY_VOLUME_PREFIX"/notification"
33 #define VCONF_KEY_VOLUME_TYPE_ALARM                     VCONF_KEY_VOLUME_PREFIX"/alarm"
34 #define VCONF_KEY_VOLUME_TYPE_RINGTONE          VCONF_KEY_VOLUME_PREFIX"/ringtone"
35 #define VCONF_KEY_VOLUME_TYPE_MEDIA                     VCONF_KEY_VOLUME_PREFIX"/media"
36 #define VCONF_KEY_VOLUME_TYPE_CALL                      VCONF_KEY_VOLUME_PREFIX"/call"
37 #define VCONF_KEY_VOLUME_TYPE_VOIP                      VCONF_KEY_VOLUME_PREFIX"/voip"
38 #define VCONF_KEY_VOLUME_TYPE_VOICE             VCONF_KEY_VOLUME_PREFIX"/voice"
39 #define VCONF_KEY_VOLUME_TYPE_ANDROID           VCONF_KEY_VOLUME_PREFIX"/fixed"
40
41 #define VCONFKEY_SOUND_PRIMARY_VOLUME_TYPE      "memory/private/sound/PrimaryVolumeType"
42 #ifndef _TIZEN_PUBLIC_
43 #ifdef TIZEN_MICRO
44 #define VCONF_KEY_VR_LEFTHAND_ENABLED           VCONFKEY_SETAPPL_PERFERED_ARM_LEFT_BOOL
45 #endif
46 #endif
47
48 #define PA_READY "/tmp/.pa_ready"
49
50 #define MMSOUND_ENTER_CRITICAL_SECTION(x_mutex) \
51 switch ( pthread_mutex_lock( x_mutex ) ) \
52 { \
53 case EINVAL: \
54         debug_warning("try mutex init..\n"); \
55         if( 0 > pthread_mutex_init( x_mutex, NULL) ) { \
56                 return; \
57         } else { \
58                 break; \
59         } \
60         return; \
61 case 0: \
62         break; \
63 default: \
64         debug_error("mutex lock failed\n"); \
65         return; \
66 }
67
68 #define MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(x_mutex,x_return) \
69 switch ( pthread_mutex_lock( x_mutex ) ) \
70 { \
71 case EINVAL: \
72         debug_warning("try mutex init..\n"); \
73         if( 0 > pthread_mutex_init( x_mutex, NULL) ) { \
74                 return x_return; \
75         } else { \
76                 break; \
77         } \
78         return x_return; \
79 case 0: \
80         break; \
81 default: \
82         debug_error("mutex lock failed\n"); \
83         return x_return; \
84 }
85
86 #define MMSOUND_LEAVE_CRITICAL_SECTION(x_mutex) \
87 if( pthread_mutex_unlock( x_mutex ) ) { \
88         debug_error("mutex unlock failed\n"); \
89 }
90
91 #define MMSOUND_STRNCPY(dst,src,size)\
92 do { \
93         if(src != NULL && dst != NULL && size > 0) {\
94                 strncpy(dst,src,size); \
95                 dst[size-1] = '\0';\
96         } else if(dst == NULL) {       \
97                 debug_error("STRNCPY ERROR: Destination String is NULL\n"); \
98         }       \
99         else if(size <= 0) {      \
100                 debug_error("STRNCPY ERROR: Destination String is NULL\n"); \
101         }       \
102         else {    \
103                 debug_error("STRNCPY ERROR: Destination String is NULL\n"); \
104         }       \
105 } while(0)
106
107 #endif /* __MM_SOUND_COMMON_H__ */
108