4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Seungbae Shin <seungbae.shin@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 #include "include/mm_sound_mgr_ipc.h"
23 #include "include/mm_sound_mgr_ipc_dbus.h"
25 #include "../include/mm_sound_common.h"
26 #include "include/mm_sound_mgr_codec.h"
30 /******************************************************************************************
31 Functions For handling request from client
32 ******************************************************************************************/
34 int _MMSoundMgrIpcStop(int handle)
36 int ret = MM_ERROR_NONE;
38 ret = MMSoundMgrCodecStop(handle);
40 if (ret != MM_ERROR_NONE) {
41 debug_error("Fail to stop sound");
48 int _MMSoundMgrIpcPlayFileWithStreamInfo(char *filename, int repeat, int volume,
49 int client_pid, int *codechandle, char *stream_type, int stream_index)
51 mmsound_mgr_codec_param_t param = { 0, };
52 int ret = MM_ERROR_NONE;
54 /* Set sound player parameter */
55 param.repeat_count = repeat;
56 param.volume = volume;
57 param.param = (void*)client_pid;
58 param.pfilename = filename;
59 param.stream_index = stream_index;
60 MMSOUND_STRNCPY(param.stream_type, stream_type, MAX_STREAM_TYPE_LEN);
62 ret = MMSoundMgrCodecPlayWithStreamInfo(codechandle, ¶m);
63 if (ret != MM_ERROR_NONE) {
64 debug_error("Will be closed a sources, codechandle : 0x%08X", *codechandle);
72 int _MMSoundMgrIpcPlayDTMFWithStreamInfo(int tone, int repeat, int volume, int client_pid, int *codechandle,
73 char *stream_type, int stream_index)
75 mmsound_mgr_codec_param_t param = { 0, };
76 int ret = MM_ERROR_NONE;
78 /* Set sound player parameter */
80 param.repeat_count = repeat;
81 param.volume = volume;
82 param.param = (void*)client_pid;
83 param.stream_index = stream_index;
84 MMSOUND_STRNCPY(param.stream_type, stream_type, MAX_STREAM_TYPE_LEN);
86 debug_msg("DTMF %d", param.tone);
87 debug_msg("Loop %d", param.repeat_count);
88 debug_msg("Volume %f", param.volume);
89 debug_msg("stream type %s", param.stream_type);
90 debug_msg("stream index %d", param.stream_index);
93 ret = MMSoundMgrCodecPlayDtmfWithStreamInfo(codechandle, ¶m);
94 if (ret != MM_ERROR_NONE) {
95 debug_error("Will be closed a sources, codec handle : [0x%d]", *codechandle);
102 /******************************************************************************************
103 Functions For Server-Side to notify Clients
104 ******************************************************************************************/
106 int __mm_sound_mgr_ipc_notify_play_file_end(int handle)
108 return __mm_sound_mgr_ipc_dbus_notify_play_file_end(handle);