4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jeongmo Yang <jm80.yang@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #ifndef __MM_CAMCORDER_SOUND_H__
23 #define __MM_CAMCORDER_SOUND_H__
25 /*=======================================================================================
27 ========================================================================================*/
28 #include <pulse/pulseaudio.h>
34 /*=======================================================================================
35 | GLOBAL DEFINITIONS AND DECLARATIONS FOR CAMCORDER |
36 ========================================================================================*/
38 /*=======================================================================================
40 ========================================================================================*/
41 #define _MMCAMCORDER_FILEPATH_CAPTURE_SND "/usr/share/sounds/mm-camcorder/capture_shutter_01.wav"
42 #define _MMCAMCORDER_FILEPATH_CAPTURE2_SND "/usr/share/sounds/mm-camcorder/capture_shutter_02.wav"
43 #define _MMCAMCORDER_FILEPATH_REC_START_SND "/usr/share/sounds/mm-camcorder/recording_start_01.wav"
44 #define _MMCAMCORDER_FILEPATH_REC_STOP_SND "/usr/share/sounds/mm-camcorder/recording_stop_01.wav"
45 #define _MMCAMCORDER_FILEPATH_AF_SUCCEED_SND "/usr/share/sounds/mm-camcorder/af_succeed.wav"
46 #define _MMCAMCORDER_FILEPATH_AF_FAIL_SND "/usr/share/sounds/mm-camcorder/af_fail.wav"
47 #define _MMCAMCORDER_FILEPATH_NO_SND "/usr/share/sounds/mm-camcorder/no_sound.wav"
49 /*=======================================================================================
51 ========================================================================================*/
53 _MMCAMCORDER_SOUND_STATE_NONE,
54 _MMCAMCORDER_SOUND_STATE_INIT,
55 _MMCAMCORDER_SOUND_STATE_PLAYING,
56 } _MMCamcorderSoundState;
58 /*=======================================================================================
59 | STRUCTURE DEFINITIONS |
60 ========================================================================================*/
62 * Structure of sound info
64 typedef struct __SOUND_INFO {
66 MMSoundPcmHandle_t handle;
67 mm_sound_device_out active_out_backup;
70 pthread_mutex_t play_mutex;
71 pthread_cond_t play_cond;
72 pthread_mutex_t open_mutex;
73 pthread_cond_t open_cond;
76 pa_threaded_mainloop *pulse_mainloop;
77 pa_context *pulse_context;
79 #ifdef _MMCAMCORDER_UPLOAD_SAMPLE
84 pa_stream *sample_stream;
85 pa_sample_spec sample_spec;
87 pa_channel_map channel_map;
90 _MMCamcorderSoundState state;
93 /*=======================================================================================
94 | CONSTANT DEFINITIONS |
95 ========================================================================================*/
98 /*=======================================================================================
99 | GLOBAL FUNCTION PROTOTYPES |
100 ========================================================================================*/
101 #ifdef _MMCAMCORDER_UPLOAD_SAMPLE
102 gboolean _mmcamcorder_sound_init(MMHandleType handle, char *filename);
103 #else /* _MMCAMCORDER_UPLOAD_SAMPLE */
104 gboolean _mmcamcorder_sound_init(MMHandleType handle);
105 #endif /* _MMCAMCORDER_UPLOAD_SAMPLE */
106 gboolean _mmcamcorder_sound_play(MMHandleType handle);
107 gboolean _mmcamcorder_sound_finalize(MMHandleType handle);
109 gboolean _mmcamcorder_sound_capture_play_cb(gpointer data);
110 void _mmcamcorder_sound_solo_play(MMHandleType handle, const char *filepath, gboolean sync);
116 #endif /* __MM_CAMCORDER_SOUND_H__ */