tizen beta release
[platform/core/multimedia/libmm-camcorder.git] / src / include / mm_camcorder_sound.h
1 /*
2  * libmm-camcorder
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jeongmo Yang <jm80.yang@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_CAMCORDER_SOUND_H__
23 #define __MM_CAMCORDER_SOUND_H__
24
25 /*=======================================================================================
26 | INCLUDE FILES                                                                         |
27 ========================================================================================*/
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 /*=======================================================================================
34 | GLOBAL DEFINITIONS AND DECLARATIONS FOR CAMCORDER                                     |
35 ========================================================================================*/
36
37 /*=======================================================================================
38 | MACRO DEFINITIONS                                                                     |
39 ========================================================================================*/
40 #define _MMCAMCORDER_FILEPATH_CAPTURE_SND       "/usr/share/sounds/mm-camcorder/capture_shutter_01.wav"
41 #define _MMCAMCORDER_FILEPATH_CAPTURE2_SND      "/usr/share/sounds/mm-camcorder/capture_shutter_02.wav"
42 #define _MMCAMCORDER_FILEPATH_REC_START_SND     "/usr/share/sounds/mm-camcorder/recording_start_01.wav"
43 #define _MMCAMCORDER_FILEPATH_REC_STOP_SND      "/usr/share/sounds/mm-camcorder/recording_stop_01.wav"
44 #define _MMCAMCORDER_FILEPATH_AF_SUCCEED_SND    "/usr/share/sounds/mm-camcorder/af_succeed.wav"
45 #define _MMCAMCORDER_FILEPATH_AF_FAIL_SND       "/usr/share/sounds/mm-camcorder/af_fail.wav"
46 #define _MMCAMCORDER_FILEPATH_NO_SND            "/usr/share/sounds/mm-camcorder/no_sound.wav"
47
48 /*=======================================================================================
49 | ENUM DEFINITIONS                                                                      |
50 ========================================================================================*/
51 typedef enum {
52         _MMCAMCORDER_SOUND_STATE_NONE,
53         _MMCAMCORDER_SOUND_STATE_INIT,
54         _MMCAMCORDER_SOUND_STATE_PREPARE,
55         _MMCAMCORDER_SOUND_STATE_PLAYING,
56 } _MMCamcorderSoundState;
57
58 /*=======================================================================================
59 | STRUCTURE DEFINITIONS                                                                 |
60 ========================================================================================*/
61 /**
62  * Structure of sound info
63  */
64 typedef struct __SOUND_INFO {
65         SF_INFO sfinfo;
66         SNDFILE *infile;
67         short *pcm_buf;
68         int pcm_size;
69         char *filename;
70
71         MMSoundPcmHandle_t handle;
72
73         int thread_run;
74         pthread_t thread;
75         pthread_mutex_t play_mutex;
76         pthread_cond_t play_cond;
77         pthread_mutex_t open_mutex;
78         pthread_cond_t open_cond;
79         system_audio_route_t route_policy_backup;
80
81         _MMCamcorderSoundState state;
82 } SOUND_INFO;
83
84 /*=======================================================================================
85 | CONSTANT DEFINITIONS                                                                  |
86 ========================================================================================*/
87
88
89 /*=======================================================================================
90 | GLOBAL FUNCTION PROTOTYPES                                                            |
91 ========================================================================================*/
92 gboolean _mmcamcorder_sound_init(MMHandleType handle, char *filename);
93 gboolean _mmcamcorder_sound_prepare(MMHandleType handle);
94 gboolean _mmcamcorder_sound_play(MMHandleType handle);
95 gboolean _mmcamcorder_sound_finalize(MMHandleType handle);
96
97 void _mmcamcorder_sound_solo_play(MMHandleType handle, const char *filepath, gboolean sync);
98
99 #ifdef __cplusplus
100 }
101 #endif
102
103 #endif /* __MM_CAMCORDER_SOUND_H__ */