Modification for Tizen Coding Rule 34/157934/1
authorSeungbae Shin <seungbae.shin@samsung.com>
Tue, 12 Sep 2017 06:02:59 +0000 (15:02 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Fri, 27 Oct 2017 02:08:25 +0000 (02:08 +0000)
Change-Id: I05fe4103c333f75b0ac85387c197ad2899026dfa
(cherry picked from commit 0f3a484264047bcccb8804e72db68420f3509a27)

32 files changed:
common/mm_sound_dbus.c
common/mm_sound_utils.c
focus_server/include/mm_sound_mgr_focus.h
focus_server/mm_sound_focus_server.c
focus_server/mm_sound_mgr_focus.c
focus_server/mm_sound_mgr_focus_dbus.c
focus_server/mm_sound_mgr_focus_socket.c
include/mm_sound.h
include/mm_sound_common.h
include/mm_sound_dbus.h
include/mm_sound_device.h
include/mm_sound_pa_client.h
include/mm_sound_private.h
mm_sound_bootsound.c
mm_sound_client.c
mm_sound_device.c
mm_sound_focus.c
mm_sound_focus_socket.c
mm_sound_keysound.c
mm_sound_pa_client.c
mm_sound_proxy.c
server/include/mm_sound_mgr_ipc.h
server/include/mm_sound_plugin.h
server/include/mm_sound_plugin_codec.h
server/mm_sound_mgr_codec.c
server/mm_sound_mgr_ipc.c
server/mm_sound_mgr_ipc_dbus.c
server/mm_sound_plugin.c
server/mm_sound_server.c
server/mm_sound_thread_pool.c
server/plugin/tone/mm_sound_plugin_codec_tone.c
server/plugin/wav/mm_sound_plugin_codec_wave.c

index 1b432d578823e0cf3583c50274d3bfb0df522bb3..f88e1973e42b29e12f7db81acb2ccafe28fdf3a4 100644 (file)
@@ -24,7 +24,7 @@ const struct dbus_path g_paths[AUDIO_PROVIDER_MAX] = {
        [AUDIO_PROVIDER_SOUND_SERVER] = {
                .bus_name = "org.tizen.SoundServer",
                .object = "/org/tizen/SoundServer1",
-               .interface ="org.tizen.SoundServer1"
+               .interface = "org.tizen.SoundServer1"
        },
        [AUDIO_PROVIDER_FOCUS_SERVER] = {
                .bus_name = "org.tizen.FocusServer",
@@ -163,8 +163,7 @@ const mm_sound_dbus_signal_info_t g_events[AUDIO_EVENT_MAX] = {
 };
 
 /* Only For error types which is currently being used in server-side */
-static const GDBusErrorEntry mm_sound_error_entries[] =
-{
+static const GDBusErrorEntry mm_sound_error_entries[] = {
        {MM_ERROR_OUT_OF_MEMORY, "org.tizen.multimedia.OutOfMemory"},
        {MM_ERROR_OUT_OF_STORAGE, "org.tizen.multimedia.OutOfStorage"},
        {MM_ERROR_INVALID_ARGUMENT, "org.tizen.multimedia.InvalidArgument"},
@@ -222,9 +221,8 @@ static int _convert_error_name(const char *err_name)
        debug_error("error name is [%s]", err_name);
 
        for (i = 0; i < G_N_ELEMENTS(mm_sound_error_entries); i++) {
-               if (!strcmp(mm_sound_error_entries[i].dbus_error_name, err_name)) {
+               if (!strcmp(mm_sound_error_entries[i].dbus_error_name, err_name))
                        return mm_sound_error_entries[i].error_code;
-               }
        }
 
        return MM_ERROR_COMMON_UNKNOWN;
@@ -327,7 +325,7 @@ static GDBusConnection * _dbus_get_connection(GBusType bustype)
                        debug_log("Get new connection on system bus");
                        conn_system = g_bus_get_sync(bustype, NULL, &err);
                        if (!conn_system || err) {
-                               debug_error ("g_dbus_get_sync() error (%s)", err ? err->message : NULL);
+                               debug_error("g_dbus_get_sync() error (%s)", err ? err->message : NULL);
                                g_error_free(err);
                                return NULL;
                        }
@@ -340,7 +338,7 @@ static GDBusConnection * _dbus_get_connection(GBusType bustype)
                        debug_log("Get new connection on session bus");
                        conn_session = g_bus_get_sync(bustype, NULL, &err);
                        if (!conn_session || err) {
-                               debug_error ("g_dbus_get_sync() error (%s)", err ? err->message : NULL);
+                               debug_error("g_dbus_get_sync() error (%s)", err ? err->message : NULL);
                                g_error_free(err);
                                return NULL;
                        }
@@ -401,23 +399,22 @@ static void _dbus_signal_callback(GDBusConnection *connection,
 
        debug_log("Signal(%s.%s) Received, Let's call Wrapper-Callback", interface_name, signal_name);
 
-       if (!strcmp(signal_name, g_events[AUDIO_EVENT_VOLUME_CHANGED].name)) {
+       if (!strcmp(signal_name, g_events[AUDIO_EVENT_VOLUME_CHANGED].name))
                (cb_data->user_cb)(AUDIO_EVENT_VOLUME_CHANGED, params, cb_data->user_data);
-       } else if (!strcmp(signal_name, g_events[AUDIO_EVENT_DEVICE_CONNECTED].name)) {
+       else if (!strcmp(signal_name, g_events[AUDIO_EVENT_DEVICE_CONNECTED].name))
                (cb_data->user_cb)(AUDIO_EVENT_DEVICE_CONNECTED, params, cb_data->user_data);
-       } else if (!strcmp(signal_name, g_events[AUDIO_EVENT_DEVICE_INFO_CHANGED].name)) {
+       else if (!strcmp(signal_name, g_events[AUDIO_EVENT_DEVICE_INFO_CHANGED].name))
                (cb_data->user_cb)(AUDIO_EVENT_DEVICE_INFO_CHANGED, params, cb_data->user_data);
-       } else if (!strcmp(signal_name, g_events[AUDIO_EVENT_DEVICE_STATE_CHANGED].name)) {
+       else if (!strcmp(signal_name, g_events[AUDIO_EVENT_DEVICE_STATE_CHANGED].name))
                (cb_data->user_cb)(AUDIO_EVENT_DEVICE_STATE_CHANGED, params, cb_data->user_data);
-       } else if (!strcmp(signal_name, g_events[AUDIO_EVENT_FOCUS_CHANGED].name)) {
+       else if (!strcmp(signal_name, g_events[AUDIO_EVENT_FOCUS_CHANGED].name))
                (cb_data->user_cb)(AUDIO_EVENT_FOCUS_CHANGED, params, cb_data->user_data);
-       } else if (!strcmp(signal_name, g_events[AUDIO_EVENT_FOCUS_WATCH].name)) {
+       else if (!strcmp(signal_name, g_events[AUDIO_EVENT_FOCUS_WATCH].name))
                (cb_data->user_cb)(AUDIO_EVENT_FOCUS_WATCH, params, cb_data->user_data);
-       } else if (!strcmp(signal_name, g_events[AUDIO_EVENT_PLAY_FILE_END].name)) {
+       else if (!strcmp(signal_name, g_events[AUDIO_EVENT_PLAY_FILE_END].name))
                (cb_data->user_cb)(AUDIO_EVENT_PLAY_FILE_END, params, cb_data->user_data);
-       } else if (!strcmp(signal_name, g_events[AUDIO_EVENT_EMERGENT_EXIT].name)) {
+       else if (!strcmp(signal_name, g_events[AUDIO_EVENT_EMERGENT_EXIT].name))
                (cb_data->user_cb)(AUDIO_EVENT_EMERGENT_EXIT, params, cb_data->user_data);
-       }
 }
 
 static void callback_data_free_func(gpointer data)
@@ -513,12 +510,12 @@ int mm_sound_dbus_emit_signal(audio_provider_t provider, audio_event_t event, GV
                return MM_ERROR_SOUND_INTERNAL;
        }
 
-       dbus_ret = g_dbus_connection_emit_signal (conn,
+       dbus_ret = g_dbus_connection_emit_signal(conn,
                                                  NULL, g_paths[provider].object,
                                                  g_paths[provider].interface, g_events[event].name,
                                                  param, &err);
        if (!dbus_ret || err) {
-               debug_error ("g_dbus_connection_emit_signal() error (%s)", err ? err->message : NULL);
+               debug_error("g_dbus_connection_emit_signal() error (%s)", err ? err->message : NULL);
                g_error_free(err);
                return MM_ERROR_SOUND_INTERNAL;
        }
index 01a63c14ff9a9306657f556440a92d0c5063b14d..aa189a444cf8c31d34e6cb98ec7813a2f4477cf6 100644 (file)
@@ -75,7 +75,7 @@ int mm_sound_util_volume_get_value_by_type(volume_type_t type, unsigned int *val
 
        /* Get volume value from VCONF */
        if (vconf_get_int(g_volume_vconf[type], &vconf_value)) {
-               debug_error ("vconf_get_int(%s) failed..\n", g_volume_vconf[type]);
+               debug_error("vconf_get_int(%s) failed..\n", g_volume_vconf[type]);
                return MM_ERROR_SOUND_INTERNAL;
        }
 
@@ -102,10 +102,10 @@ bool mm_sound_util_is_process_alive(pid_t pid)
 
        if (ret == -1) {
                if (errno == ENOENT) {
-                       debug_warning ("/proc/%d not exist", pid);
+                       debug_warning("/proc/%d not exist", pid);
                        return false;
                } else {
-                       debug_error ("/proc/%d access errno[%d]", pid, errno);
+                       debug_error("/proc/%d access errno[%d]", pid, errno);
 
                        /* FIXME: error occured but file exists */
                        return true;
index 5eab71b9681cc6e917be4dd72ed3fc62c65886c3..b588eb03b00827b149d2e38f2077fb47ffbab09f 100644 (file)
 #include "../include/mm_sound_stream.h"
 #include "mm_sound_mgr_focus_ipc.h"
 
-typedef enum
-{
+typedef enum {
        FOCUS_COMMAND_RELEASE,
        FOCUS_COMMAND_ACQUIRE,
 } focus_command_e;
 
-typedef enum
-{
+typedef enum {
        FOCUS_TYPE_PLAYBACK = 1,
        FOCUS_TYPE_CAPTURE,
        FOCUS_TYPE_BOTH,
 } focus_type_e;
 
-typedef enum
-{
+typedef enum {
        FOCUS_STATUS_DEACTIVATED,
        FOCUS_STATUS_ACTIVATED_PLAYBACK,
        FOCUS_STATUS_ACTIVATED_CAPTURE,
@@ -66,8 +63,7 @@ typedef struct {
        bool is_for_monitor;
 } _mm_sound_mgr_focus_param_t;
 
-typedef struct _taken_by_id
-{
+typedef struct _taken_by_id {
        int pid;
        int handle_id;
        bool by_session;
index f8c4fbdf7421d636673a980c2d5c2d34549eb517..b0bb94dd7d4fabddd602f825973cf23edde31544 100644 (file)
@@ -45,9 +45,9 @@
 #define USE_SYSTEM_SERVER_PROCESS_MONITORING
 
 typedef struct {
-    int startserver;
-    int printlist;
-    int testmode;
+       int startserver;
+       int printlist;
+       int testmode;
 } server_arg;
 
 static int _get_option(int argc, char **argv, server_arg *arg);
@@ -58,9 +58,8 @@ GMainLoop *g_mainloop;
 static void _mainloop_run()
 {
        g_mainloop = g_main_loop_new(NULL, TRUE);
-       if (g_mainloop == NULL) {
+       if (g_mainloop == NULL)
                debug_error("g_main_loop_new() failed");
-       }
 
        g_main_loop_run(g_mainloop);
 }
@@ -97,8 +96,7 @@ static int _get_option(int argc, char **argv, server_arg *arg)
                c = getopt_long (argc, argv, "SFLHRUP:Tiurd", long_options, &opt_idx);
                if (c == -1)
                        break;
-               switch (c)
-               {
+               switch (c) {
                case 'S': /* Start daemon */
                        arg->startserver = 1;
                        break;
@@ -238,13 +236,13 @@ int main(int argc, char **argv)
 
        _signal_initialize();
 
-       if (serveropt.startserver) {
+       if (serveropt.startserver)
                sem = _sem_create_n_wait();
-       }
+
        /* Daemon process create */
        if (!serveropt.testmode && serveropt.startserver) {
 #if !defined(USE_SYSTEM_SERVER_PROCESS_MONITORING)
-               daemon(0,0); //chdir to ("/"), and close stdio
+               daemon(0, 0); //chdir to ("/"), and close stdio
 #endif
        }
 
@@ -290,11 +288,10 @@ int main(int argc, char **argv)
                unlink(PA_READY); // remove pa_ready file after focus-server init.
 
                if (sem) {
-                       if (sem_post(sem) == -1) {
+                       if (sem_post(sem) == -1)
                                debug_error("error sem post : %d", errno);
-                       } else {
+                       else
                                debug_msg("Ready to play booting sound!!!!");
-                       }
                }
 
                /* FIXME : This code is moved from sound_server temporally for TV migration
@@ -302,11 +299,10 @@ int main(int argc, char **argv)
                                        this code will be removed */
                /* broadcast if we're ready */
 #ifdef USE_LWIPC
-               if (LwipcEventDone(SOUND_SERVER_READY) < 0) {
+               if (LwipcEventDone(SOUND_SERVER_READY) < 0)
                        debug_error("cannot create SOUND_SERVER_READY(sound_server_ready)");
-               } else {
+               else
                        debug_warning("SOUND_SERVER_READY(%s) event was created", SOUND_SERVER_READY);
-               }
 #else
                _generate_ready_file(SOUND_SERVER_READY);
 #endif
index 8d4863e3d9c395aa56335b83ad7089d46cf97493..bd1b280a0c0c5514da9c70993a466aa6debf4926 100644 (file)
@@ -82,16 +82,15 @@ typedef struct {
            ((x_node)->is_for_session != (x_param)->is_for_session)) \
                continue; \
 
-static char* __get_focus_pipe_path(int instance_id, int handle, const charpostfix, bool is_watch)
+static char* __get_focus_pipe_path(int instance_id, int handle, const char *postfix, bool is_watch)
 {
        gchar* path = NULL;
        gchar* path2 = NULL;
 
-       if (is_watch) {
+       if (is_watch)
                path = g_strdup_printf("/tmp/FOCUS.%d.%d.wch", instance_id, handle);
-       } else {
+       else
                path = g_strdup_printf("/tmp/FOCUS.%d.%d", instance_id, handle);
-       }
 
        if (postfix) {
                path2 = g_strconcat(path, postfix, NULL);
@@ -268,7 +267,7 @@ static void _invoke_watch_callback(focus_node_t *node, const char *stream_type,
                debug_error("[RETCB] failed to get watch return pipe");
                goto RELEASE;
        }
-       if ((fd_FOCUS_R = open(filename2, O_RDONLY|O_NONBLOCK)) == -1) {
+       if ((fd_FOCUS_R = open(filename2, O_RDONLY | O_NONBLOCK)) == -1) {
                char str_error[256];
                strerror_r(errno, str_error, sizeof(str_error));
                debug_error("[RETCB] failed to open watch return pipe (%s, err:%s)", filename2, str_error);
@@ -481,8 +480,9 @@ int _mm_sound_mgr_focus_do_callback(focus_command_e command, focus_node_t *victi
        } else {
                /* client will gain the lost focus */
                for (i = 0; i < NUM_OF_STREAM_IO_TYPE; i++) {
-                       if ((victim_node->taken_by_id[i].pid == assaulter_param->pid) && ((victim_node->taken_by_id[i].handle_id == assaulter_param->handle_id) || victim_node->taken_by_id[i].by_session)) {
-                               flag_for_focus_type |= i+1; /* playback:1, capture:2 */
+                       if ((victim_node->taken_by_id[i].pid == assaulter_param->pid) &&
+                               ((victim_node->taken_by_id[i].handle_id == assaulter_param->handle_id) || victim_node->taken_by_id[i].by_session)) {
+                               flag_for_focus_type |= i + 1; /* playback:1, capture:2 */
                        }
                }
                cb_data.type = flag_for_focus_type & assaulter_param->request_type;
@@ -534,7 +534,7 @@ int _mm_sound_mgr_focus_do_callback(focus_command_e command, focus_node_t *victi
                res = -1;
                goto RELEASE;
        }
-       if ((fd_FOCUS_R = open(filename2, O_RDONLY|O_NONBLOCK)) == -1) {
+       if ((fd_FOCUS_R = open(filename2, O_RDONLY | O_NONBLOCK)) == -1) {
                char str_error[256];
                strerror_r(errno, str_error, sizeof(str_error));
                debug_error("[RETCB] failed to open return pipe (%s, err:%s)", filename2, str_error);
@@ -561,7 +561,8 @@ int _mm_sound_mgr_focus_do_callback(focus_command_e command, focus_node_t *victi
        pfd.fd = fd_FOCUS_R;
        pfd.events = POLLIN;
        pfd.revents = 0;
-       debug_msg("[RETCB] wait CALLBACK (client pid=%d, handle=%d, cmd=%d, timeout=%d(ms))", cb_data.pid, cb_data.handle, command, CALLBACK_TIMEOUT);
+       debug_msg("[RETCB] wait CALLBACK (client pid=%d, handle=%d, cmd=%d, timeout=%d(ms))",
+                       cb_data.pid, cb_data.handle, command, CALLBACK_TIMEOUT);
        pret = poll(&pfd, 1, CALLBACK_TIMEOUT);
        if (pret < 0) {
                debug_error("[RETCB] poll failed (%d)", pret);
@@ -677,9 +678,12 @@ static int _mm_sound_mgr_focus_list_dump()
        for (list = g_focus_node_list; list != NULL; list = list->next) {
                if ((node = (focus_node_t *)list->data) && !node->is_for_watch) {
                        debug_msg("*** pid[%5d]/handle_id[%2d]/[%14s]:priority[%2d],status[%s],taken_by[P(%5d/%2d/%2d)C(%5d/%2d/%2d)],session[%d],option[0x%x/0x%x],ext_info[%s/%s]",
-                               node->pid, node->handle_id, node->stream_type, node->priority, focus_status_str[node->status],
-                               node->taken_by_id[0].pid, node->taken_by_id[0].handle_id, node->taken_by_id[0].by_session, node->taken_by_id[1].pid,
-                               node->taken_by_id[1].handle_id, node->taken_by_id[1].by_session, node->is_for_session, node->option[0], node->option[1], node->ext_info[0], node->ext_info[1]);
+                                       node->pid, node->handle_id, node->stream_type, node->priority, focus_status_str[node->status],
+                                       node->taken_by_id[0].pid, node->taken_by_id[0].handle_id, node->taken_by_id[0].by_session,
+                                       node->taken_by_id[1].pid, node->taken_by_id[1].handle_id, node->taken_by_id[1].by_session,
+                                       node->is_for_session,
+                                       node->option[0], node->option[1],
+                                       node->ext_info[0], node->ext_info[1]);
                }
        }
        debug_msg("================================================ focus node list : end =====================================================");
@@ -697,7 +701,7 @@ static int _mm_sound_mgr_focus_watch_list_dump()
        for (list = g_focus_node_list; list != NULL; list = list->next) {
                if ((node = (focus_node_t *)list->data) && node->is_for_watch)
                        debug_msg("*** pid[%5d]/handle_id[%d]/watch on focus status[%s]/for_session[%d]/for_monitor[%d]",
-                               node->pid, node->handle_id, focus_status_str[node->status], node->is_for_session, node->is_for_monitor);
+                                       node->pid, node->handle_id, focus_status_str[node->status], node->is_for_session, node->is_for_monitor);
        }
        debug_msg("============================================= focus watch node list : end ===================================================");
 
@@ -742,9 +746,9 @@ int mm_sound_mgr_focus_create_node(const _mm_sound_mgr_focus_param_t *param)
 
        /* get priority from stream type */
        ret = _mm_sound_mgr_focus_get_priority_from_stream_type(&priority, param->stream_type);
-       if (ret) {
+       if (ret)
                goto FINISH;
-       }
+
        node = g_malloc0(sizeof(focus_node_t));
 
        /* fill up information to the node */
@@ -841,11 +845,10 @@ int mm_sound_mgr_focus_destroy_node(const _mm_sound_mgr_focus_param_t *param)
 
                                if (my_node->taken_by_id[i].pid) {
                                /* If exists update the taken focus info to my victim node */
-                                       if (node->taken_by_id[i].by_session && !node->status) {
+                                       if (node->taken_by_id[i].by_session && !node->status)
                                                UPDATE_FOCUS_TAKEN_INFO(by_id, node, my_node->taken_by_id[i].pid, my_node->taken_by_id[i].handle_id, my_node->taken_by_id[i].by_session);
-                                       } else if (node->taken_by_id[i].handle_id == param->handle_id) {
+                                       else if (node->taken_by_id[i].handle_id == param->handle_id)
                                                UPDATE_FOCUS_TAKEN_INFO(by_id, node, my_node->taken_by_id[i].pid, my_node->taken_by_id[i].handle_id, false);
-                                       }
                                } else if (my_node->status & (i+1)) {
                                        if (node->is_for_session)
                                                continue;
@@ -983,7 +986,7 @@ int mm_sound_mgr_focus_get_stream_type_of_acquired_focus(focus_type_e focus_type
                        int index = (focus_type == FOCUS_TYPE_BOTH) ? FOCUS_TYPE_PLAYBACK - 1 : focus_type - 1;
 
                        debug_msg("found a node : request_focus_type(%d), stream_type(%s)/ext info(%s) of acquired focus",
-                               focus_type, node->stream_type, node->ext_info[index]);
+                                       focus_type, node->stream_type, node->ext_info[index]);
 
                        *stream_type = node->stream_type;
                        *option = node->option[index];
@@ -1224,9 +1227,9 @@ int mm_sound_mgr_focus_request_release(const _mm_sound_mgr_focus_param_t *param)
                                                /* do callback for resumption */
                                                if ((ret = _mm_sound_mgr_focus_do_callback(FOCUS_COMMAND_ACQUIRE, node, param_s)))
                                                        debug_error("Fail to _focus_do_callback for COMMAND ACQUIRE to node[%x], ret[0x%x]", node, ret);
-                                               if (!strncmp(my_node->stream_type, node->stream_type, MAX_STREAM_TYPE_LEN)) {
+                                               if (!strncmp(my_node->stream_type, node->stream_type, MAX_STREAM_TYPE_LEN))
                                                        need_to_trigger_watch_cb = false;
-                                               }
+
                                                need_to_trigger_monitor_cb = false;
                                        }
                                }
@@ -1362,20 +1365,20 @@ int mm_sound_mgr_focus_deliver(const _mm_sound_mgr_focus_param_t *param)
                CONTINUE_IF_LIST_DATA_IS_NULL(src_node, list);
                if ((src_node->pid == param->pid) && (src_node->handle_id == param->handle_id)) {
                        debug_log("SRC: found the node of pid[%d]/handle_id[%d] for watch focus",
-                               param->pid, param->handle_id);
+                                       param->pid, param->handle_id);
                        break;
                }
        }
        if (src_node == NULL) {
                debug_error("could not find the source node of param, pid[%d]/handle_id[%d]",
-                       param->pid, param->handle_id);
+                                       param->pid, param->handle_id);
                ret = MM_ERROR_INVALID_ARGUMENT;
                goto FINISH;
        }
 
        if (!(src_node->status & param->request_type)) {
                debug_error("invalid request type(0x%x), src_node->status(0x%x)",
-                       param->request_type, src_node->status);
+                                       param->request_type, src_node->status);
                ret = MM_ERROR_SOUND_INVALID_STATE;
                goto FINISH;
        }
@@ -1384,13 +1387,13 @@ int mm_sound_mgr_focus_deliver(const _mm_sound_mgr_focus_param_t *param)
                CONTINUE_IF_LIST_DATA_IS_NULL(dst_node, list);
                if ((dst_node->pid == param->pid) && (dst_node->handle_id == param->handle_id_dst)) {
                        debug_log("DST: found the destination node of param, pid[%d]/handle_id[%d]",
-                               param->pid, param->handle_id_dst);
+                                       param->pid, param->handle_id_dst);
                        break;
                }
        }
        if (dst_node == NULL) {
                debug_error("could not find the destination node of param, pid[%d]/handle_id[%d]",
-                       param->pid, param->handle_id_dst);
+                                       param->pid, param->handle_id_dst);
                ret = MM_ERROR_INVALID_ARGUMENT;
                goto FINISH;
        }
@@ -1405,15 +1408,15 @@ int mm_sound_mgr_focus_deliver(const _mm_sound_mgr_focus_param_t *param)
                        if ((node->taken_by_id[i].pid == src_node->pid) &&
                                (node->taken_by_id[i].handle_id == src_node->handle_id) &&
                                (node->taken_by_id[i].by_session == false)) {
-                               debug_log("found the node that focus was taken by this src node, update it",
-                                       node->pid, node->handle_id);
+                               debug_log("found the node pid[%d]/handle_id[%d] that focus was taken by this src node, update it",
+                                               node->pid, node->handle_id);
                                UPDATE_FOCUS_TAKEN_INFO(by_id, node, dst_node->pid, dst_node->handle_id, false);
                        }
                        if ((node->taken_backup[i].pid == src_node->pid) &&
                                (node->taken_backup[i].handle_id == src_node->handle_id) &&
                                (node->taken_backup[i].by_session == false)) {
-                               debug_log("found the node that focus was taken by this src node and set reacquisition to false, update it",
-                                       node->pid, node->handle_id);
+                               debug_log("found the node pid[%d]/handle_id[%d] that focus was taken by this src node and set reacquisition to false, update it",
+                                               node->pid, node->handle_id);
                                UPDATE_FOCUS_TAKEN_INFO(backup, node, dst_node->pid, dst_node->handle_id, false);
                        }
                }
@@ -1478,11 +1481,10 @@ int mm_sound_mgr_focus_emergent_exit(const _mm_sound_mgr_focus_param_t *param)
                                CONTINUE_IF_LIST_DATA_IS_NULL(node, list_s);
                                for (i = 0; i < NUM_OF_STREAM_IO_TYPE; i++) {
                                        if (node->taken_by_id[i].pid == param->pid) {
-                                               if (my_node->taken_by_id[i].pid) {
+                                               if (my_node->taken_by_id[i].pid)
                                                        UPDATE_FOCUS_TAKEN_INFO(by_id, node, my_node->taken_by_id[i].pid, my_node->taken_by_id[i].handle_id, my_node->taken_by_id[i].by_session);
-                                               } else {
+                                               else
                                                        UPDATE_FOCUS_TAKEN_INFO(by_id, node, 0, 0, false);
-                                               }
                                        }
                                }
                        }
@@ -1557,9 +1559,8 @@ int MMSoundMgrFocusFini(void)
        debug_fenter();
 
        for (i = 0; i < AVAIL_STREAMS_MAX; i++) {
-               if (g_stream_list.stream_types[i]) {
+               if (g_stream_list.stream_types[i])
                        free(g_stream_list.stream_types[i]);
-               }
        }
 
        debug_fleave();
index 3a08799e0e348fbeeaf775dc673a44e08f37f459..36c2a5dc284456a7ac951832c1999cf14af87eed 100644 (file)
 
 /* Introspection data for the service we are exporting */
 static const gchar introspection_xml[] =
-  "<node>"
-  "  <interface name='org.tizen.FocusServer1'>"
-  "    <method name='GetUniqueId'>"
-  "      <arg name='id' type='i' direction='out'/>"
-  "    </method>"
-  "    <method name='RegisterFocus'>"
-  "      <arg name='pid' type='i' direction='in'/>"
-  "      <arg name='handle_id' type='i' direction='in'/>"
-  "      <arg name='stream_type' type='s' direction='in'/>"
-  "      <arg name='is_for_session' type='b' direction='in'/>"
-  "    </method>"
-  "    <method name='UnregisterFocus'>"
-  "      <arg name='pid' type='i' direction='in'/>"
-  "      <arg name='handle_id' type='i' direction='in'/>"
-  "      <arg name='is_for_session' type='b' direction='in'/>"
-  "    </method>"
-  "    <method name='SetFocusReacquisition'>"
-  "      <arg name='pid' type='i' direction='in'/>"
-  "      <arg name='handle_id' type='i' direction='in'/>"
-  "      <arg name='reacquisition' type='b' direction='in'/>"
-  "      <arg name='is_for_session' type='b' direction='in'/>"
-  "    </method>"
-  "    <method name='GetAcquiredFocusStreamType'>"
-  "      <arg name='focus_type' type='i' direction='in'/>"
-  "      <arg name='stream_type' type='s' direction='out'/>"
-  "      <arg name='option' type='i' direction='out'/>"
-  "      <arg name='ext_info' type='s' direction='out'/>"
-  "    </method>"
-  "    <method name='AcquireFocus'>"
-  "      <arg name='pid' type='i' direction='in'/>"
-  "      <arg name='handle_id' type='i' direction='in'/>"
-  "      <arg name='focus_type' type='i' direction='in'/>"
-  "      <arg name='option' type='i' direction='in'/>"
-  "      <arg name='ext_info' type='s' direction='in'/>"
-  "      <arg name='is_for_session' type='b' direction='in'/>"
-  "    </method>"
-  "    <method name='ReleaseFocus'>"
-  "      <arg name='pid' type='i' direction='in'/>"
-  "      <arg name='handle_id' type='i' direction='in'/>"
-  "      <arg name='focus_type' type='i' direction='in'/>"
-  "      <arg name='option' type='i' direction='in'/>"
-  "      <arg name='ext_info' type='s' direction='in'/>"
-  "      <arg name='is_for_session' type='b' direction='in'/>"
-  "    </method>"
-  "    <method name='WatchFocus'>"
-  "      <arg name='pid' type='i' direction='in'/>"
-  "      <arg name='handle_id' type='i' direction='in'/>"
-  "      <arg name='focus_type' type='i' direction='in'/>"
-  "      <arg name='is_for_session' type='b' direction='in'/>"
-  "      <arg name='is_for_monitor' type='b' direction='in'/>"
-  "    </method>"
-  "    <method name='UnwatchFocus'>"
-  "      <arg name='pid' type='i' direction='in'/>"
-  "      <arg name='handle_id' type='i' direction='in'/>"
-  "      <arg name='is_for_session' type='b' direction='in'/>"
-  "    </method>"
-  "    <method name='DeliverFocus'>"
-  "      <arg name='pid' type='i' direction='in'/>"
-  "      <arg name='src_handle_id' type='i' direction='in'/>"
-  "      <arg name='dst_handle_id' type='i' direction='in'/>"
-  "      <arg name='focus_type' type='i' direction='in'/>"
-  "    </method>"
-  "    <method name='EmergentExitFocus'>"
-  "      <arg name='pid' type='i' direction='in'/>"
-  "    </method>"
-  "  </interface>"
-  "</node>";
+       "<node>"
+       "  <interface name='org.tizen.FocusServer1'>"
+       "    <method name='GetUniqueId'>"
+       "      <arg name='id' type='i' direction='out'/>"
+       "    </method>"
+       "    <method name='RegisterFocus'>"
+       "      <arg name='pid' type='i' direction='in'/>"
+       "      <arg name='handle_id' type='i' direction='in'/>"
+       "      <arg name='stream_type' type='s' direction='in'/>"
+       "      <arg name='is_for_session' type='b' direction='in'/>"
+       "    </method>"
+       "    <method name='UnregisterFocus'>"
+       "      <arg name='pid' type='i' direction='in'/>"
+       "      <arg name='handle_id' type='i' direction='in'/>"
+       "      <arg name='is_for_session' type='b' direction='in'/>"
+       "    </method>"
+       "    <method name='SetFocusReacquisition'>"
+       "      <arg name='pid' type='i' direction='in'/>"
+       "      <arg name='handle_id' type='i' direction='in'/>"
+       "      <arg name='reacquisition' type='b' direction='in'/>"
+       "      <arg name='is_for_session' type='b' direction='in'/>"
+       "    </method>"
+       "    <method name='GetAcquiredFocusStreamType'>"
+       "      <arg name='focus_type' type='i' direction='in'/>"
+       "      <arg name='stream_type' type='s' direction='out'/>"
+       "      <arg name='option' type='i' direction='out'/>"
+       "      <arg name='ext_info' type='s' direction='out'/>"
+       "    </method>"
+       "    <method name='AcquireFocus'>"
+       "      <arg name='pid' type='i' direction='in'/>"
+       "      <arg name='handle_id' type='i' direction='in'/>"
+       "      <arg name='focus_type' type='i' direction='in'/>"
+       "      <arg name='option' type='i' direction='in'/>"
+       "      <arg name='ext_info' type='s' direction='in'/>"
+       "      <arg name='is_for_session' type='b' direction='in'/>"
+       "    </method>"
+       "    <method name='ReleaseFocus'>"
+       "      <arg name='pid' type='i' direction='in'/>"
+       "      <arg name='handle_id' type='i' direction='in'/>"
+       "      <arg name='focus_type' type='i' direction='in'/>"
+       "      <arg name='option' type='i' direction='in'/>"
+       "      <arg name='ext_info' type='s' direction='in'/>"
+       "      <arg name='is_for_session' type='b' direction='in'/>"
+       "    </method>"
+       "    <method name='WatchFocus'>"
+       "      <arg name='pid' type='i' direction='in'/>"
+       "      <arg name='handle_id' type='i' direction='in'/>"
+       "      <arg name='focus_type' type='i' direction='in'/>"
+       "      <arg name='is_for_session' type='b' direction='in'/>"
+       "      <arg name='is_for_monitor' type='b' direction='in'/>"
+       "    </method>"
+       "    <method name='UnwatchFocus'>"
+       "      <arg name='pid' type='i' direction='in'/>"
+       "      <arg name='handle_id' type='i' direction='in'/>"
+       "      <arg name='is_for_session' type='b' direction='in'/>"
+       "    </method>"
+       "    <method name='DeliverFocus'>"
+       "      <arg name='pid' type='i' direction='in'/>"
+       "      <arg name='src_handle_id' type='i' direction='in'/>"
+       "      <arg name='dst_handle_id' type='i' direction='in'/>"
+       "      <arg name='focus_type' type='i' direction='in'/>"
+       "    </method>"
+       "    <method name='EmergentExitFocus'>"
+       "      <arg name='pid' type='i' direction='in'/>"
+       "    </method>"
+       "  </interface>"
+       "</node>";
 static GDBusConnection* conn_g;
 
 typedef void (*dbus_method_handler)(GDBusMethodInvocation *invocation);
 typedef int (*dbus_signal_sender)(GDBusConnection *conn, GVariant *parameter);
 
-struct mm_sound_mgr_focus_dbus_method{
+struct mm_sound_mgr_focus_dbus_method {
        struct mm_sound_dbus_method_info info;
-        dbus_method_handler handler;
+       dbus_method_handler handler;
 };
 
-struct mm_sound_mgr_focus_dbus_signal{
+struct mm_sound_mgr_focus_dbus_signal {
        struct mm_sound_dbus_signal_info info;
        dbus_signal_sender sender;
 };
@@ -183,12 +183,11 @@ guint focus_server_owner_id ;
 unsigned emergent_exit_subs_id;
 
 /*
-        For pass error code with 'g_dbus_method_invocation_return_error'
-        We have to use some glib features like GError, GQuark
+       For pass error code with 'g_dbus_method_invocation_return_error'
+       We have to use some glib features like GError, GQuark
 */
 /* Only For error types which is currently being used in server-side */
-static const GDBusErrorEntry mm_sound_error_entries[] =
-{
+static const GDBusErrorEntry mm_sound_error_entries[] = {
        {MM_ERROR_OUT_OF_MEMORY, "org.tizen.multimedia.OutOfMemory"},
        {MM_ERROR_OUT_OF_STORAGE, "org.tizen.multimedia.OutOfStorage"},
        {MM_ERROR_INVALID_ARGUMENT, "org.tizen.multimedia.InvalidArgument"},
@@ -215,9 +214,8 @@ static const char* _convert_error_code(int err_code)
        int i = 0;
 
        for (i = 0; i < G_N_ELEMENTS(mm_sound_error_entries); i++) {
-               if (err_code == mm_sound_error_entries[i].error_code) {
+               if (err_code == mm_sound_error_entries[i].error_code)
                        return mm_sound_error_entries[i].dbus_error_name;
-               }
        }
 
        return "org.tizen.multimedia.common.Unknown";
@@ -297,11 +295,10 @@ static void handle_method_register_focus(GDBusMethodInvocation* invocation)
        ret = __mm_sound_mgr_focus_ipc_register_focus((is_for_session) ? pid : _get_sender_pid(invocation), handle_id, stream_type, is_for_session);
 
 send_reply:
-       if (ret == MM_ERROR_NONE) {
+       if (ret == MM_ERROR_NONE)
                _method_call_return_value(invocation, g_variant_new("()"));
-       } else {
+       else
                _method_call_return_error(invocation, ret);
-       }
 
        debug_fleave();
 }
@@ -325,11 +322,10 @@ static void handle_method_unregister_focus(GDBusMethodInvocation* invocation)
        ret = __mm_sound_mgr_focus_ipc_unregister_focus((is_for_session) ? pid : _get_sender_pid(invocation), handle_id, is_for_session);
 
 send_reply:
-       if (ret == MM_ERROR_NONE) {
+       if (ret == MM_ERROR_NONE)
                _method_call_return_value(invocation, g_variant_new("()"));
-       } else {
+       else
                _method_call_return_error(invocation, ret);
-       }
 
        debug_fleave();
 }
@@ -354,11 +350,10 @@ static void handle_method_set_focus_reacquisition(GDBusMethodInvocation* invocat
        ret = __mm_sound_mgr_focus_ipc_set_focus_reacquisition(_get_sender_pid(invocation), handle_id, reacquisition, is_for_session);
 
 send_reply:
-       if (ret == MM_ERROR_NONE) {
+       if (ret == MM_ERROR_NONE)
                _method_call_return_value(invocation, g_variant_new("()"));
-       } else {
+       else
                _method_call_return_error(invocation, ret);
-       }
 
        debug_fleave();
 }
@@ -410,14 +405,13 @@ static void handle_method_acquire_focus(GDBusMethodInvocation* invocation)
 
        g_variant_get(params, "(iiiisb)", &pid, &handle_id, &focus_type, &option, &ext_info, &is_for_session);
        ret = __mm_sound_mgr_focus_ipc_acquire_focus((is_for_session) ? pid : _get_sender_pid(invocation),
-                                                    handle_id, focus_type, option, ext_info, false, is_for_session);
+                                                                                               handle_id, focus_type, option, ext_info, false, is_for_session);
 
 send_reply:
-       if (ret == MM_ERROR_NONE) {
+       if (ret == MM_ERROR_NONE)
                _method_call_return_value(invocation, g_variant_new("()"));
-       } else {
+       else
                _method_call_return_error(invocation, ret);
-       }
 
        debug_fleave();
 }
@@ -440,14 +434,13 @@ static void handle_method_release_focus(GDBusMethodInvocation* invocation)
 
        g_variant_get(params, "(iiiisb)", &pid, &handle_id, &focus_type, &option, &ext_info, &is_for_session);
        ret = __mm_sound_mgr_focus_ipc_release_focus((is_for_session) ? pid : _get_sender_pid(invocation),
-                                                    handle_id, focus_type, option, ext_info, false, is_for_session);
+                                                                                               handle_id, focus_type, option, ext_info, false, is_for_session);
 
 send_reply:
-       if (ret == MM_ERROR_NONE) {
+       if (ret == MM_ERROR_NONE)
                _method_call_return_value(invocation, g_variant_new("()"));
-       } else {
+       else
                _method_call_return_error(invocation, ret);
-       }
 
        debug_fleave();
 }
@@ -473,11 +466,10 @@ static void handle_method_watch_focus(GDBusMethodInvocation* invocation)
        ret = __mm_sound_mgr_focus_ipc_watch_focus((is_for_session) ? pid : _get_sender_pid(invocation), handle_id, focus_type, is_for_session, is_for_monitor);
 
 send_reply:
-       if (ret == MM_ERROR_NONE) {
+       if (ret == MM_ERROR_NONE)
                _method_call_return_value(invocation, g_variant_new("()"));
-       } else {
+       else
                _method_call_return_error(invocation, ret);
-       }
 
        debug_fleave();
 }
@@ -502,11 +494,10 @@ static void handle_method_unwatch_focus(GDBusMethodInvocation* invocation)
        ret = __mm_sound_mgr_focus_ipc_unwatch_focus((is_for_session) ? pid : _get_sender_pid(invocation), handle_id);
 
 send_reply:
-       if (ret == MM_ERROR_NONE) {
+       if (ret == MM_ERROR_NONE)
                _method_call_return_value(invocation, g_variant_new("()"));
-       } else {
+       else
                _method_call_return_error(invocation, ret);
-       }
 
        debug_fleave();
 }
@@ -532,11 +523,10 @@ static void handle_method_deliver_focus(GDBusMethodInvocation* invocation)
        ret = __mm_sound_mgr_focus_ipc_deliver_focus(pid, src_handle_id, dst_handle_id, focus_type);
 
 send_reply:
-       if (ret == MM_ERROR_NONE) {
+       if (ret == MM_ERROR_NONE)
                _method_call_return_value(invocation, g_variant_new("()"));
-       } else {
+       else
                _method_call_return_error(invocation, ret);
-       }
 
        debug_fleave();
 }
@@ -560,9 +550,8 @@ static void handle_method_call(GDBusConnection *connection,
        debug_msg("Method Call, obj : %s, intf : %s, method : %s", object_path, interface_name, method_name);
 
        for (method_idx = AUDIO_METHOD_GET_UNIQUE_ID; method_idx < AUDIO_METHOD_MAX; method_idx++) {
-               if (!g_strcmp0(method_name, methods[method_idx].info.name)) {
+               if (!g_strcmp0(method_name, methods[method_idx].info.name))
                        methods[method_idx].handler(invocation);
-               }
        }
 }
 
@@ -610,8 +599,7 @@ void emergent_exit_signal_handler(audio_event_t event, GVariant *param, void *us
        debug_fleave();
 }
 
-static const GDBusInterfaceVTable interface_vtable =
-{
+static const GDBusInterfaceVTable interface_vtable = {
        handle_method_call,
        handle_get_property,
        handle_set_property
@@ -669,9 +657,8 @@ static int _mm_sound_mgr_focus_dbus_own_name(GBusType bus_type, const char* well
 static void _mm_sound_mgr_focus_dbus_unown_name(guint oid)
 {
        debug_msg("Unown name for focus-server [%d]", oid);
-       if (oid > 0) {
+       if (oid > 0)
                g_bus_unown_name(oid);
-       }
 }
 
 #define PA_BUS_NAME                                    "org.pulseaudio.Server"
index 484410667ab3e06e139feb7ad5e1f4e8546a6f03..6962ffe36966f2e116f02d131de0eac1f18347e9 100644 (file)
@@ -95,7 +95,7 @@ static int handle_acquire_focus(_mm_sound_mgr_focus_socket_param_t *param)
        debug_fenter();
 
        ret = __mm_sound_mgr_focus_ipc_acquire_focus(param->pid, param->handle_id, param->focus_type,
-                                                    param->option, param->ext_info, true, param->is_for_session);
+                                                                                               param->option, param->ext_info, true, param->is_for_session);
 
        debug_fleave();
 
@@ -109,7 +109,7 @@ static int handle_release_focus(_mm_sound_mgr_focus_socket_param_t *param)
        debug_fenter();
 
        ret = __mm_sound_mgr_focus_ipc_release_focus(param->pid, param->handle_id, param->focus_type,
-                                                    param->option, param->ext_info, true, param->is_for_session);
+                                                                                               param->option, param->ext_info, true, param->is_for_session);
 
        debug_fleave();
 
@@ -186,7 +186,8 @@ static void *thread_func(void *data)
                                debug_error("failed to write(), err: %s", str_error);
                        }
                } else {
-                       debug_error("failed to read(), read size mismatched, rval(%d), expect size(%d)", rval,sizeof(_mm_sound_mgr_focus_socket_param_t));
+                       debug_error("failed to read(), read size mismatched, rval(%d), expect size(%d)",
+                                               rval, sizeof(_mm_sound_mgr_focus_socket_param_t));
                }
 
                close(accepted_fd);
@@ -258,7 +259,7 @@ void MMSoundMgrFocusSocketFini(int fd)
 
        if (g_focus_work_thread_id) {
                unlink(FOCUS_SERVER_SOCK);
-               shutdown(fd,SHUT_RDWR);
+               shutdown(fd, SHUT_RDWR);
                close(fd);
                pthread_join(g_focus_work_thread_id, NULL);
                debug_msg("pthread join well");
index dfd80b0b2349d1aac05718e1f1690ab7620a6714..1d703671c44cddc9dcf7413551970c3cb2758cb7 100644 (file)
@@ -314,16 +314,16 @@ typedef enum {
  * @brief Enumerations of supporting source_type
  */
 typedef enum {
-    SUPPORT_SOURCE_TYPE_DEFAULT,
-    SUPPORT_SOURCE_TYPE_MIRRORING,
-    SUPPORT_SOURCE_TYPE_VOICECONTROL,
-    SUPPORT_SOURCE_TYPE_SVR,
-    SUPPORT_SOURCE_TYPE_VIDEOCALL,
-    SUPPORT_SOURCE_TYPE_VOICERECORDING,
-    SUPPORT_SOURCE_TYPE_VOIP, /* Supporting VoIP source*/
-    SUPPORT_SOURCE_TYPE_CALL_FORWARDING,
-    SUPPORT_SOURCE_TYPE_FMRADIO,
-    SUPPORT_SOURCE_TYPE_LOOPBACK,
+       SUPPORT_SOURCE_TYPE_DEFAULT,
+       SUPPORT_SOURCE_TYPE_MIRRORING,
+       SUPPORT_SOURCE_TYPE_VOICECONTROL,
+       SUPPORT_SOURCE_TYPE_SVR,
+       SUPPORT_SOURCE_TYPE_VIDEOCALL,
+       SUPPORT_SOURCE_TYPE_VOICERECORDING,
+       SUPPORT_SOURCE_TYPE_VOIP, /* Supporting VoIP source*/
+       SUPPORT_SOURCE_TYPE_CALL_FORWARDING,
+       SUPPORT_SOURCE_TYPE_FMRADIO,
+       SUPPORT_SOURCE_TYPE_LOOPBACK,
 } mm_sound_source_type_e;
 
 /**
@@ -350,7 +350,7 @@ int mm_sound_add_volume_changed_callback(mm_sound_volume_changed_cb func, void*
  *
  * @param      type                    [in]    volume type to set change callback function
  *
- * @return     This function returns MM_ERROR_NONE on success, or negative value
+ * @return     This function returns MM_ERROR_NONE on success, or negative value
  *                     with error code.
  * @remark     None.
  * @pre                Callback function should be registered previously for given volume type.
@@ -390,8 +390,8 @@ int mm_sound_volume_remove_callback(volume_type_t type);
 /**
  * This function is to remove volume change callback.
  *
- * @return     This function returns MM_ERROR_NONE on success, or negative value
- *                     with error code.
+ * @return     This function returns MM_ERROR_NONE on success, or negative value
+ *                     with error code.
  **/
 int mm_sound_remove_volume_changed_callback(unsigned int id);
 
@@ -401,7 +401,7 @@ int mm_sound_remove_volume_changed_callback(unsigned int id);
  * @param      type                    [in]    volume type to set value.
  * @param      value                   [in]    volume value.
  *
- * @return     This function returns MM_ERROR_NONE on success, or negative value
+ * @return     This function returns MM_ERROR_NONE on success, or negative value
  *                     with error code.
  * @remark     value should be 0 ~ MAX
  * @see                mm_sound_volume_get_value volume_type_t
@@ -418,7 +418,7 @@ int mm_sound_volume_set_value(volume_type_t type, const unsigned int volume_leve
  * @param      type                    [in]    volume type to get value.
  * @param      value                   [out]   volume value.
  *
- * @return     This function returns MM_ERROR_NONE on success, or negative value
+ * @return     This function returns MM_ERROR_NONE on success, or negative value
  *                     with error code.
  * @remark     None.
  * @pre                None.
@@ -450,7 +450,7 @@ int mm_sound_volume_get_value(volume_type_t type, unsigned int *value);
  *
  * @param      type                    [in]    volume type to set as primary volume type.
  *
- * @return     This function returns MM_ERROR_NONE on success, or negative value
+ * @return     This function returns MM_ERROR_NONE on success, or negative value
  *                     with error code.
  * @remark     Application should use this function during foreground.
  * @pre                None.
@@ -508,7 +508,7 @@ int mm_sound_volume_primary_type_get(volume_type_t *type);
  * @param      filter_parameters       [in]    extra filter parameters(optional)
  * @param      filter_group            [in]    extra filter group(optional)
  *
- * @return     This function returns MM_ERROR_NONE on success, or negative value
+ * @return     This function returns MM_ERROR_NONE on success, or negative value
  *                     with error code.
  * @remark     None
  * @pre                None
@@ -522,7 +522,7 @@ int mm_sound_set_filter(const char *stream_type, const char *filter_name, const
  *
  * @param      stream_type                     [in]    stream type to remove
  *
- * @return     This function returns MM_ERROR_NONE on success, or negative value
+ * @return     This function returns MM_ERROR_NONE on success, or negative value
  *                     with error code.
  * @remark     None
  * @pre                None
@@ -538,7 +538,7 @@ int mm_sound_unset_filter(const char *stream_type);
  * @param      filter_name                     [in]    specify filter module to apply
  * @param      filter_controls         [in]    filter control parameters(e.g, "0.0, 0.1, 3.0")
  *
- * @return     This function returns MM_ERROR_NONE on success, or negative value
+ * @return     This function returns MM_ERROR_NONE on success, or negative value
  *                     with error code.
  * @remark     None
  * @pre                None
@@ -551,7 +551,7 @@ int mm_sound_control_filter(const char *stream_type, const char *filter_name, co
  * Terminate callback function type.
  *
  * @param      data            [in]    Argument passed when callback was set
- * @param      id              [in]    handle which has completed playing
+ * @param      id                      [in]    handle which has completed playing
  *
  * @return     No return value
  * @remark     It is not allowed to call MMSound API recursively or do time-consuming
@@ -629,7 +629,7 @@ int mm_sound_play_sound(const char *filename, int volume_config, mm_sound_stop_c
  * @return     This function returns MM_ERROR_NONE on success, or negative value
  *                     with error code.
  * @remark     This function is almost same with mm_sound_play_sound,
- *                     but this make other audio playback stream to mute during playing time.
+ *                     but this make other audio playback stream to mute during playing time.
  * @see                mm_sound_stop_sound mm_sound_stop_callback_func volume_type_t volume_gain_t
  * @pre                None.
  * @post       Sound will be generated with given filename.
@@ -732,7 +732,7 @@ int mm_sound_stop_sound(int handle);
 
 typedef enum  {
        MM_SOUND_TONE_DTMF_0 = 0,                       /**< Predefined DTMF 0 */
-       MM_SOUND_TONE_DTMF_1,                           /**< Predefined DTMF 1 */
+       MM_SOUND_TONE_DTMF_1,                           /**< Predefined DTMF 1 */
        MM_SOUND_TONE_DTMF_2,                           /**< Predefined DTMF 2 */
        MM_SOUND_TONE_DTMF_3,                           /**< Predefined DTMF 3 */
        MM_SOUND_TONE_DTMF_4,                           /**< Predefined DTMF 4 */
@@ -741,7 +741,7 @@ typedef enum  {
        MM_SOUND_TONE_DTMF_7,                           /**< Predefined DTMF 7 */
        MM_SOUND_TONE_DTMF_8,                           /**< Predefined DTMF 8 */
        MM_SOUND_TONE_DTMF_9,                           /**< Predefined DTMF 9 */
-       MM_SOUND_TONE_DTMF_S,                           /**< Predefined DTMF Star - Asterisk (*) */
+       MM_SOUND_TONE_DTMF_S,                           /**< Predefined DTMF Star - Asterisk (*) */
        MM_SOUND_TONE_DTMF_P,                           /**< Predefined DTMF sharP (#) */
        MM_SOUND_TONE_DTMF_A,                           /**< Predefined DTMF A (A) */
        MM_SOUND_TONE_DTMF_B,                           /**< Predefined DTMF B (B) */
@@ -749,13 +749,13 @@ typedef enum  {
        MM_SOUND_TONE_DTMF_D,                           /**< Predefined DTMF D (D) */
 
        /**< Pre-defined TONE */
-       MM_SOUND_TONE_SUP_DIAL,                                 /**Call supervisory tone, Dial tone: CEPT: 425Hz, continuous */
+       MM_SOUND_TONE_SUP_DIAL,                         /**Call supervisory tone, Dial tone: CEPT: 425Hz, continuous */
        MM_SOUND_TONE_ANSI_DIAL,                                /**Call supervisory tone, Dial tone: ANSI (IS-95): 350Hz+440Hz, continuous */
        MM_SOUND_TONE_JAPAN_DIAL,                               /**Call supervisory tone, Dial tone: JAPAN: 400Hz, continuous*/
        MM_SOUND_TONE_SUP_BUSY,                         /**Call supervisory tone, Busy: CEPT: 425Hz, 500ms ON, 500ms OFF... */
-       MM_SOUND_TONE_ANSI_BUSY,                                /**Call supervisory tone, Busy: ANSI (IS-95): 480Hz+620Hz, 500ms ON, 500ms OFF... */
-       MM_SOUND_TONE_JAPAN_BUSY,                               /**Call supervisory tone, Busy: JAPAN: 400Hz, 500ms ON, 500ms OFF...*/
-       MM_SOUND_TONE_SUP_CONGESTION,           /**Call supervisory tone, Congestion: CEPT, JAPAN: 425Hz, 200ms ON, 200ms OFF */
+       MM_SOUND_TONE_ANSI_BUSY,                                /**Call supervisory tone, Busy: ANSI (IS-95): 480Hz+620Hz, 500ms ON, 500ms OFF... */
+       MM_SOUND_TONE_JAPAN_BUSY,                               /**Call supervisory tone, Busy: JAPAN: 400Hz, 500ms ON, 500ms OFF...*/
+       MM_SOUND_TONE_SUP_CONGESTION,           /**Call supervisory tone, Congestion: CEPT, JAPAN: 425Hz, 200ms ON, 200ms OFF */
        MM_SOUND_TONE_ANSI_CONGESTION,          /**Call supervisory tone, Congestion: ANSI (IS-95): 480Hz+620Hz, 250ms ON, 250ms OFF... */
        MM_SOUND_TONE_SUP_RADIO_ACK,                    /**Call supervisory tone, Radio path acknowlegment : CEPT, ANSI: 425Hz, 200ms ON  */
        MM_SOUND_TONE_JAPAN_RADIO_ACK,          /**Call supervisory tone, Radio path acknowlegment : JAPAN: 400Hz, 1s ON, 2s OFF...*/
@@ -766,85 +766,85 @@ typedef enum  {
        MM_SOUND_TONE_SUP_RINGTONE,                     /**Call supervisory tone, Ring Tone: CEPT, JAPAN: 425Hz, 1s ON, 4s OFF... */
        MM_SOUND_TONE_ANSI_RINGTONE,                    /**Call supervisory tone, Ring Tone: ANSI (IS-95): 440Hz + 480Hz, 2s ON, 4s OFF... */
        MM_SOUND_TONE_PROP_BEEP,                                /**General beep: 400Hz+1200Hz, 35ms ON */
-       MM_SOUND_TONE_PROP_ACK,                                 /**Proprietary tone, positive acknowlegement: 1200Hz, 100ms ON, 100ms OFF 2 bursts */
-       MM_SOUND_TONE_PROP_NACK,                                /**Proprietary tone, negative acknowlegement: 300Hz+400Hz+500Hz, 400ms ON */
-       MM_SOUND_TONE_PROP_PROMPT,                      /**Proprietary tone, prompt tone: 400Hz+1200Hz, 200ms ON         */
-       MM_SOUND_TONE_PROP_BEEP2,                               /**Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON */
-       MM_SOUND_TONE_SUP_INTERCEPT,                                            /**Call supervisory tone (IS-95), intercept tone: alternating 440 Hz and 620 Hz tones, each on for 250 ms */
+       MM_SOUND_TONE_PROP_ACK,                         /**Proprietary tone, positive acknowlegement: 1200Hz, 100ms ON, 100ms OFF 2 bursts */
+       MM_SOUND_TONE_PROP_NACK,                                /**Proprietary tone, negative acknowlegement: 300Hz+400Hz+500Hz, 400ms ON */
+       MM_SOUND_TONE_PROP_PROMPT,                      /**Proprietary tone, prompt tone: 400Hz+1200Hz, 200ms ON         */
+       MM_SOUND_TONE_PROP_BEEP2,                               /**Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON */
+       MM_SOUND_TONE_SUP_INTERCEPT,                                            /**Call supervisory tone (IS-95), intercept tone: alternating 440 Hz and 620 Hz tones, each on for 250 ms */
        MM_SOUND_TONE_SUP_INTERCEPT_ABBREV,                             /**Call supervisory tone (IS-95), abbreviated intercept: intercept tone limited to 4 seconds */
-       MM_SOUND_TONE_SUP_CONGESTION_ABBREV,                            /**Call supervisory tone (IS-95), abbreviated congestion: congestion tone limited to 4 seconds */
-       MM_SOUND_TONE_SUP_CONFIRM,                                              /**Call supervisory tone (IS-95), confirm tone: a 350 Hz tone added to a 440 Hz tone repeated 3 times in a 100 ms on, 100 ms off cycle */
-       MM_SOUND_TONE_SUP_PIP,                                                  /**Call supervisory tone (IS-95), pip tone: four bursts of 480 Hz tone (0.1 s on, 0.1 s off). */
-       MM_SOUND_TONE_CDMA_DIAL_TONE_LITE,                              /**425Hz continuous */
-       MM_SOUND_TONE_CDMA_NETWORK_USA_RINGBACK,                /**CDMA USA Ringback: 440Hz+480Hz 2s ON, 4000 OFF ...*/
-       MM_SOUND_TONE_CDMA_INTERCEPT,                                   /**CDMA Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON ...*/
-       MM_SOUND_TONE_CDMA_ABBR_INTERCEPT,                              /**CDMA Abbr Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON */
-       MM_SOUND_TONE_CDMA_REORDER,                                             /**CDMA Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF... */
-       MM_SOUND_TONE_CDMA_ABBR_REORDER,                                /**CDMA Abbr Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF repeated for 8 times */
-       MM_SOUND_TONE_CDMA_NETWORK_BUSY,                                /**CDMA Network Busy tone: 480Hz+620Hz 500ms ON, 500ms OFF continuous */
-       MM_SOUND_TONE_CDMA_CONFIRM,                                             /**CDMA Confirm tone: 350Hz+440Hz 100ms ON, 100ms OFF repeated for 3 times */
-       MM_SOUND_TONE_CDMA_ANSWER,                                              /**CDMA answer tone: silent tone - defintion Frequency 0, 0ms ON, 0ms OFF */
-       MM_SOUND_TONE_CDMA_NETWORK_CALLWAITING,                         /**CDMA Network Callwaiting tone: 440Hz 300ms ON */
-       MM_SOUND_TONE_CDMA_PIP,                                                         /**CDMA PIP tone: 480Hz 100ms ON, 100ms OFF repeated for 4 times */
-       MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_NORMAL,             /**ISDN Call Signal Normal tone: {2091Hz 32ms ON, 2556 64ms ON} 20 times, 2091 32ms ON, 2556 48ms ON, 4s OFF */
-       MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_INTERGROUP,         /**ISDN Call Signal Intergroup tone: {2091Hz 32ms ON, 2556 64ms ON} 8 times, 2091Hz 32ms ON, 400ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 8times, 2091Hz 32ms ON, 4s OFF.*/
-       MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_SP_PRI,             /**ISDN Call Signal SP PRI tone:{2091Hz 32ms ON, 2556 64ms ON} 4 times 2091Hz 16ms ON, 200ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 4 times, 2091Hz 16ms ON, 200ms OFF */
-       MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT3,               /**SDN Call sign PAT3 tone: silent tone */
-       MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PING_RING,  /**ISDN Ping Ring tone: {2091Hz 32ms ON, 2556Hz 64ms ON} 5 times 2091Hz 20ms ON */
-       MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT5,               /**ISDN Pat5 tone: silent tone */
-       MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT6,               /**ISDN Pat6 tone: silent tone */
-       MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT7,               /**ISDN Pat7 tone: silent tone */
-       MM_SOUND_TONE_CDMA_HIGH_L,                                              /**TONE_CDMA_HIGH_L tone: {3700Hz 25ms, 4000Hz 25ms} 40 times 4000ms OFF, Repeat .... */
-       MM_SOUND_TONE_CDMA_MED_L,                                               /**TONE_CDMA_MED_L tone: {2600Hz 25ms, 2900Hz 25ms} 40 times 4000ms OFF, Repeat .... */
-       MM_SOUND_TONE_CDMA_LOW_L,                                               /**TONE_CDMA_LOW_L tone: {1300Hz 25ms, 1450Hz 25ms} 40 times, 4000ms OFF, Repeat .... */
-       MM_SOUND_TONE_CDMA_HIGH_SS,                                             /**CDMA HIGH SS tone: {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */
-       MM_SOUND_TONE_CDMA_MED_SS,                                              /**CDMA MED SS tone: {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */
-       MM_SOUND_TONE_CDMA_LOW_SS,                                              /**CDMA LOW SS tone: {1300z 25ms, 1450Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */
-       MM_SOUND_TONE_CDMA_HIGH_SSL,                                            /**CDMA HIGH SSL tone: {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 4000ms OFF, repeat ... */
-       MM_SOUND_TONE_CDMA_MED_SSL,                                             /**CDMA MED SSL tone: {2600Hz 25ms, 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 4000ms OFF, repeat ... */
-       MM_SOUND_TONE_CDMA_LOW_SSL,                                             /**CDMA LOW SSL tone: {1300Hz 25ms, 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 16 times, 4000ms OFF, repeat ... */
-       MM_SOUND_TONE_CDMA_HIGH_SS_2,                                   /**CDMA HIGH SS2 tone: {3700Hz 25ms, 4000Hz 25ms} 20 times, 1000ms OFF, {3700Hz 25ms, 4000Hz 25ms} 20 times, 3000ms OFF, repeat .... */
-       MM_SOUND_TONE_CDMA_MED_SS_2,                                            /**CDMA MED SS2 tone: {2600Hz 25ms, 2900Hz 25ms} 20 times, 1000ms OFF, {2600Hz 25ms, 2900Hz 25ms} 20 times, 3000ms OFF, repeat .... */
-       MM_SOUND_TONE_CDMA_LOW_SS_2,                                            /**CDMA LOW SS2 tone: {1300Hz 25ms, 1450Hz 25ms} 20 times, 1000ms OFF, {1300Hz 25ms, 1450Hz 25ms} 20 times, 3000ms OFF, repeat .... */
-       MM_SOUND_TONE_CDMA_HIGH_SLS,                                            /**CDMA HIGH SLS tone: {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 20 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 3000ms OFF, REPEAT */
-       MM_SOUND_TONE_CDMA_MED_SLS,                                             /**CDMA MED SLS tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 20 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 3000ms OFF, REPEAT */
-       MM_SOUND_TONE_CDMA_LOW_SLS,                                             /**CDMA LOW SLS tone: {1300Hz 25ms, 1450Hz 25ms} 10 times, 500ms OFF, {1300Hz 25ms, 1450Hz 25ms} 20 times, 500ms OFF, {1300Hz 25ms, 1450Hz 25ms} 10 times, 3000ms OFF, REPEAT */
-       MM_SOUND_TONE_CDMA_HIGH_S_X4,                                   /**CDMA HIGH S X4 tone: {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 2500ms OFF, REPEAT.... */
-       MM_SOUND_TONE_CDMA_MED_S_X4,                                            /**CDMA MED S X4 tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 2500ms OFF, REPEAT.... */
-       MM_SOUND_TONE_CDMA_LOW_S_X4,                                            /**CDMA LOW S X4 tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 2500ms OFF, REPEAT....*/
-       MM_SOUND_TONE_CDMA_HIGH_PBX_L,                                  /**CDMA HIGH PBX L: {3700Hz 25ms, 4000Hz 25ms}20 times, 2000ms OFF, REPEAT.... */
-       MM_SOUND_TONE_CDMA_MED_PBX_L,                                   /**CDMA MED PBX L: {2600Hz 25ms, 2900Hz 25ms}20 times, 2000ms OFF, REPEAT.... */
-       MM_SOUND_TONE_CDMA_LOW_PBX_L,                                   /**CDMA LOW PBX L: {1300Hz 25ms,1450Hz 25ms}20 times, 2000ms OFF, REPEAT.... */
-       MM_SOUND_TONE_CDMA_HIGH_PBX_SS,                                         /**CDMA HIGH PBX SS tone: {3700Hz 25ms, 4000Hz 25ms} 8 times 200 ms OFF, {3700Hz 25ms 4000Hz 25ms}8 times, 2000ms OFF, REPEAT.... */
-       MM_SOUND_TONE_CDMA_MED_PBX_SS,                                  /**CDMA MED PBX SS tone: {2600Hz 25ms, 2900Hz 25ms} 8 times 200 ms OFF, {2600Hz 25ms 2900Hz 25ms}8 times, 2000ms OFF, REPEAT.... */
-       MM_SOUND_TONE_CDMA_LOW_PBX_SS,                                  /**CDMA LOW PBX SS tone: {1300Hz 25ms, 1450Hz 25ms} 8 times 200 ms OFF, {1300Hz 25ms 1450Hz 25ms}8 times, 2000ms OFF, REPEAT.... */
-       MM_SOUND_TONE_CDMA_HIGH_PBX_SSL,                                        /**CDMA HIGH PBX SSL tone:{3700Hz 25ms, 4000Hz 25ms} 8 times 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 16 times, 1000ms OFF, REPEAT.... */
-       MM_SOUND_TONE_CDMA_MED_PBX_SSL,                                         /**CDMA MED PBX SSL tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 1000ms OFF, REPEAT.... */
-       MM_SOUND_TONE_CDMA_LOW_PBX_SSL,                                         /**CDMA LOW PBX SSL tone:{1300Hz 25ms, 1450Hz 25ms} 8 times 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 16 times, 1000ms OFF, REPEAT.... */
-       MM_SOUND_TONE_CDMA_HIGH_PBX_SLS,                                        /**CDMA HIGH PBX SLS tone:{3700Hz 25ms, 4000Hz 25ms} 8 times 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 16 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 8 times, 1000ms OFF, REPEAT....  */
-       MM_SOUND_TONE_CDMA_MED_PBX_SLS,                                         /**CDMA MED PBX SLS tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 1000ms OFF, REPEAT.... */
-       MM_SOUND_TONE_CDMA_LOW_PBX_SLS,                                         /**CDMA LOW PBX SLS tone:{1300Hz 25ms, 1450Hz 25ms} 8 times 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 16 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 8 times, 1000ms OFF, REPEAT.... */
-       MM_SOUND_TONE_CDMA_HIGH_PBX_S_X4,                               /**CDMA HIGH PBX X S4 tone: {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 800ms OFF, REPEAT... */
-       MM_SOUND_TONE_CDMA_MED_PBX_S_X4,                                        /**CDMA MED PBX X S4 tone: {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 800ms OFF, REPEAT... */
-       MM_SOUND_TONE_CDMA_LOW_PBX_S_X4,                                        /**CDMA LOW PBX X S4 tone: {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 800ms OFF, REPEAT... */
-       MM_SOUND_TONE_CDMA_ALERT_NETWORK_LITE,                  /**CDMA Alert Network Lite tone: 1109Hz 62ms ON, 784Hz 62ms ON, 740Hz 62ms ON 622Hz 62ms ON, 1109Hz 62ms ON */
-       MM_SOUND_TONE_CDMA_ALERT_AUTOREDIAL_LITE,               /**CDMA Alert Auto Redial tone: {1245Hz 62ms ON, 659Hz 62ms ON} 3 times, 1245 62ms ON */
-       MM_SOUND_TONE_CDMA_ONE_MIN_BEEP,                                        /**CDMA One Min Beep tone: 1150Hz+770Hz 400ms ON */
-       MM_SOUND_TONE_CDMA_KEYPAD_VOLUME_KEY_LITE,              /**CDMA KEYPAD Volume key lite tone: 941Hz+1477Hz 120ms ON */
-       MM_SOUND_TONE_CDMA_PRESSHOLDKEY_LITE,                   /**CDMA PRESSHOLDKEY LITE tone: 587Hz 375ms ON, 1175Hz 125ms ON */
-       MM_SOUND_TONE_CDMA_ALERT_INCALL_LITE,                           /**CDMA ALERT INCALL LITE tone: 587Hz 62ms, 784 62ms, 831Hz 62ms, 784Hz 62ms, 1109 62ms, 784Hz 62ms, 831Hz 62ms, 784Hz 62ms*/
-       MM_SOUND_TONE_CDMA_EMERGENCY_RINGBACK,                  /**CDMA EMERGENCY RINGBACK tone: {941Hz 125ms ON, 10ms OFF} 3times 4990ms OFF, REPEAT... */
-       MM_SOUND_TONE_CDMA_ALERT_CALL_GUARD,                    /**CDMA ALERT CALL GUARD tone: {1319Hz 125ms ON, 125ms OFF} 3 times */
-       MM_SOUND_TONE_CDMA_SOFT_ERROR_LITE,                             /**CDMA SOFT ERROR LITE tone: 1047Hz 125ms ON, 370Hz 125ms */
-       MM_SOUND_TONE_CDMA_CALLDROP_LITE,                               /**CDMA CALLDROP LITE tone: 1480Hz 125ms, 1397Hz 125ms, 784Hz 125ms */
-       MM_SOUND_TONE_CDMA_NETWORK_BUSY_ONE_SHOT,               /**CDMA_NETWORK_BUSY_ONE_SHOT tone: 425Hz 500ms ON, 500ms OFF. */
-       MM_SOUND_TONE_CDMA_ABBR_ALERT,                                  /**CDMA_ABBR_ALERT tone: 1150Hz+770Hz 400ms ON */
+       MM_SOUND_TONE_SUP_CONGESTION_ABBREV,                            /**Call supervisory tone (IS-95), abbreviated congestion: congestion tone limited to 4 seconds */
+       MM_SOUND_TONE_SUP_CONFIRM,                                              /**Call supervisory tone (IS-95), confirm tone: a 350 Hz tone added to a 440 Hz tone repeated 3 times in a 100 ms on, 100 ms off cycle */
+       MM_SOUND_TONE_SUP_PIP,                                                  /**Call supervisory tone (IS-95), pip tone: four bursts of 480 Hz tone (0.1 s on, 0.1 s off). */
+       MM_SOUND_TONE_CDMA_DIAL_TONE_LITE,                              /**425Hz continuous */
+       MM_SOUND_TONE_CDMA_NETWORK_USA_RINGBACK,                /**CDMA USA Ringback: 440Hz+480Hz 2s ON, 4000 OFF ...*/
+       MM_SOUND_TONE_CDMA_INTERCEPT,                                   /**CDMA Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON ...*/
+       MM_SOUND_TONE_CDMA_ABBR_INTERCEPT,                              /**CDMA Abbr Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON */
+       MM_SOUND_TONE_CDMA_REORDER,                                             /**CDMA Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF... */
+       MM_SOUND_TONE_CDMA_ABBR_REORDER,                                /**CDMA Abbr Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF repeated for 8 times */
+       MM_SOUND_TONE_CDMA_NETWORK_BUSY,                                /**CDMA Network Busy tone: 480Hz+620Hz 500ms ON, 500ms OFF continuous */
+       MM_SOUND_TONE_CDMA_CONFIRM,                                             /**CDMA Confirm tone: 350Hz+440Hz 100ms ON, 100ms OFF repeated for 3 times */
+       MM_SOUND_TONE_CDMA_ANSWER,                                              /**CDMA answer tone: silent tone - defintion Frequency 0, 0ms ON, 0ms OFF */
+       MM_SOUND_TONE_CDMA_NETWORK_CALLWAITING,                 /**CDMA Network Callwaiting tone: 440Hz 300ms ON */
+       MM_SOUND_TONE_CDMA_PIP,                                                 /**CDMA PIP tone: 480Hz 100ms ON, 100ms OFF repeated for 4 times */
+       MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_NORMAL,             /**ISDN Call Signal Normal tone: {2091Hz 32ms ON, 2556 64ms ON} 20 times, 2091 32ms ON, 2556 48ms ON, 4s OFF */
+       MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_INTERGROUP, /**ISDN Call Signal Intergroup tone: {2091Hz 32ms ON, 2556 64ms ON} 8 times, 2091Hz 32ms ON, 400ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 8times, 2091Hz 32ms ON, 4s OFF.*/
+       MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_SP_PRI,             /**ISDN Call Signal SP PRI tone:{2091Hz 32ms ON, 2556 64ms ON} 4 times 2091Hz 16ms ON, 200ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 4 times, 2091Hz 16ms ON, 200ms OFF */
+       MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT3,               /**SDN Call sign PAT3 tone: silent tone */
+       MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PING_RING,  /**ISDN Ping Ring tone: {2091Hz 32ms ON, 2556Hz 64ms ON} 5 times 2091Hz 20ms ON */
+       MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT5,               /**ISDN Pat5 tone: silent tone */
+       MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT6,               /**ISDN Pat6 tone: silent tone */
+       MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT7,               /**ISDN Pat7 tone: silent tone */
+       MM_SOUND_TONE_CDMA_HIGH_L,                                              /**TONE_CDMA_HIGH_L tone: {3700Hz 25ms, 4000Hz 25ms} 40 times 4000ms OFF, Repeat .... */
+       MM_SOUND_TONE_CDMA_MED_L,                                               /**TONE_CDMA_MED_L tone: {2600Hz 25ms, 2900Hz 25ms} 40 times 4000ms OFF, Repeat .... */
+       MM_SOUND_TONE_CDMA_LOW_L,                                               /**TONE_CDMA_LOW_L tone: {1300Hz 25ms, 1450Hz 25ms} 40 times, 4000ms OFF, Repeat .... */
+       MM_SOUND_TONE_CDMA_HIGH_SS,                                             /**CDMA HIGH SS tone: {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */
+       MM_SOUND_TONE_CDMA_MED_SS,                                              /**CDMA MED SS tone: {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */
+       MM_SOUND_TONE_CDMA_LOW_SS,                                              /**CDMA LOW SS tone: {1300z 25ms, 1450Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */
+       MM_SOUND_TONE_CDMA_HIGH_SSL,                                            /**CDMA HIGH SSL tone: {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 4000ms OFF, repeat ... */
+       MM_SOUND_TONE_CDMA_MED_SSL,                                             /**CDMA MED SSL tone: {2600Hz 25ms, 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 4000ms OFF, repeat ... */
+       MM_SOUND_TONE_CDMA_LOW_SSL,                                             /**CDMA LOW SSL tone: {1300Hz 25ms, 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 16 times, 4000ms OFF, repeat ... */
+       MM_SOUND_TONE_CDMA_HIGH_SS_2,                                   /**CDMA HIGH SS2 tone: {3700Hz 25ms, 4000Hz 25ms} 20 times, 1000ms OFF, {3700Hz 25ms, 4000Hz 25ms} 20 times, 3000ms OFF, repeat .... */
+       MM_SOUND_TONE_CDMA_MED_SS_2,                                            /**CDMA MED SS2 tone: {2600Hz 25ms, 2900Hz 25ms} 20 times, 1000ms OFF, {2600Hz 25ms, 2900Hz 25ms} 20 times, 3000ms OFF, repeat .... */
+       MM_SOUND_TONE_CDMA_LOW_SS_2,                                            /**CDMA LOW SS2 tone: {1300Hz 25ms, 1450Hz 25ms} 20 times, 1000ms OFF, {1300Hz 25ms, 1450Hz 25ms} 20 times, 3000ms OFF, repeat .... */
+       MM_SOUND_TONE_CDMA_HIGH_SLS,                                            /**CDMA HIGH SLS tone: {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 20 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 3000ms OFF, REPEAT */
+       MM_SOUND_TONE_CDMA_MED_SLS,                                             /**CDMA MED SLS tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 20 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 3000ms OFF, REPEAT */
+       MM_SOUND_TONE_CDMA_LOW_SLS,                                             /**CDMA LOW SLS tone: {1300Hz 25ms, 1450Hz 25ms} 10 times, 500ms OFF, {1300Hz 25ms, 1450Hz 25ms} 20 times, 500ms OFF, {1300Hz 25ms, 1450Hz 25ms} 10 times, 3000ms OFF, REPEAT */
+       MM_SOUND_TONE_CDMA_HIGH_S_X4,                                   /**CDMA HIGH S X4 tone: {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 2500ms OFF, REPEAT.... */
+       MM_SOUND_TONE_CDMA_MED_S_X4,                                            /**CDMA MED S X4 tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 2500ms OFF, REPEAT.... */
+       MM_SOUND_TONE_CDMA_LOW_S_X4,                                            /**CDMA LOW S X4 tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 2500ms OFF, REPEAT....*/
+       MM_SOUND_TONE_CDMA_HIGH_PBX_L,                                  /**CDMA HIGH PBX L: {3700Hz 25ms, 4000Hz 25ms}20 times, 2000ms OFF, REPEAT.... */
+       MM_SOUND_TONE_CDMA_MED_PBX_L,                                   /**CDMA MED PBX L: {2600Hz 25ms, 2900Hz 25ms}20 times, 2000ms OFF, REPEAT.... */
+       MM_SOUND_TONE_CDMA_LOW_PBX_L,                                   /**CDMA LOW PBX L: {1300Hz 25ms,1450Hz 25ms}20 times, 2000ms OFF, REPEAT.... */
+       MM_SOUND_TONE_CDMA_HIGH_PBX_SS,                                 /**CDMA HIGH PBX SS tone: {3700Hz 25ms, 4000Hz 25ms} 8 times 200 ms OFF, {3700Hz 25ms 4000Hz 25ms}8 times, 2000ms OFF, REPEAT.... */
+       MM_SOUND_TONE_CDMA_MED_PBX_SS,                                  /**CDMA MED PBX SS tone: {2600Hz 25ms, 2900Hz 25ms} 8 times 200 ms OFF, {2600Hz 25ms 2900Hz 25ms}8 times, 2000ms OFF, REPEAT.... */
+       MM_SOUND_TONE_CDMA_LOW_PBX_SS,                                  /**CDMA LOW PBX SS tone: {1300Hz 25ms, 1450Hz 25ms} 8 times 200 ms OFF, {1300Hz 25ms 1450Hz 25ms}8 times, 2000ms OFF, REPEAT.... */
+       MM_SOUND_TONE_CDMA_HIGH_PBX_SSL,                                        /**CDMA HIGH PBX SSL tone:{3700Hz 25ms, 4000Hz 25ms} 8 times 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 16 times, 1000ms OFF, REPEAT.... */
+       MM_SOUND_TONE_CDMA_MED_PBX_SSL,                                 /**CDMA MED PBX SSL tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 1000ms OFF, REPEAT.... */
+       MM_SOUND_TONE_CDMA_LOW_PBX_SSL,                                 /**CDMA LOW PBX SSL tone:{1300Hz 25ms, 1450Hz 25ms} 8 times 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 16 times, 1000ms OFF, REPEAT.... */
+       MM_SOUND_TONE_CDMA_HIGH_PBX_SLS,                                        /**CDMA HIGH PBX SLS tone:{3700Hz 25ms, 4000Hz 25ms} 8 times 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 16 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 8 times, 1000ms OFF, REPEAT....  */
+       MM_SOUND_TONE_CDMA_MED_PBX_SLS,                                 /**CDMA MED PBX SLS tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 1000ms OFF, REPEAT.... */
+       MM_SOUND_TONE_CDMA_LOW_PBX_SLS,                                 /**CDMA LOW PBX SLS tone:{1300Hz 25ms, 1450Hz 25ms} 8 times 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 16 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 8 times, 1000ms OFF, REPEAT.... */
+       MM_SOUND_TONE_CDMA_HIGH_PBX_S_X4,                               /**CDMA HIGH PBX X S4 tone: {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 800ms OFF, REPEAT... */
+       MM_SOUND_TONE_CDMA_MED_PBX_S_X4,                                        /**CDMA MED PBX X S4 tone: {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 800ms OFF, REPEAT... */
+       MM_SOUND_TONE_CDMA_LOW_PBX_S_X4,                                        /**CDMA LOW PBX X S4 tone: {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 800ms OFF, REPEAT... */
+       MM_SOUND_TONE_CDMA_ALERT_NETWORK_LITE,                  /**CDMA Alert Network Lite tone: 1109Hz 62ms ON, 784Hz 62ms ON, 740Hz 62ms ON 622Hz 62ms ON, 1109Hz 62ms ON */
+       MM_SOUND_TONE_CDMA_ALERT_AUTOREDIAL_LITE,               /**CDMA Alert Auto Redial tone: {1245Hz 62ms ON, 659Hz 62ms ON} 3 times, 1245 62ms ON */
+       MM_SOUND_TONE_CDMA_ONE_MIN_BEEP,                                        /**CDMA One Min Beep tone: 1150Hz+770Hz 400ms ON */
+       MM_SOUND_TONE_CDMA_KEYPAD_VOLUME_KEY_LITE,              /**CDMA KEYPAD Volume key lite tone: 941Hz+1477Hz 120ms ON */
+       MM_SOUND_TONE_CDMA_PRESSHOLDKEY_LITE,                   /**CDMA PRESSHOLDKEY LITE tone: 587Hz 375ms ON, 1175Hz 125ms ON */
+       MM_SOUND_TONE_CDMA_ALERT_INCALL_LITE,                           /**CDMA ALERT INCALL LITE tone: 587Hz 62ms, 784 62ms, 831Hz 62ms, 784Hz 62ms, 1109 62ms, 784Hz 62ms, 831Hz 62ms, 784Hz 62ms*/
+       MM_SOUND_TONE_CDMA_EMERGENCY_RINGBACK,                  /**CDMA EMERGENCY RINGBACK tone: {941Hz 125ms ON, 10ms OFF} 3times 4990ms OFF, REPEAT... */
+       MM_SOUND_TONE_CDMA_ALERT_CALL_GUARD,                    /**CDMA ALERT CALL GUARD tone: {1319Hz 125ms ON, 125ms OFF} 3 times */
+       MM_SOUND_TONE_CDMA_SOFT_ERROR_LITE,                             /**CDMA SOFT ERROR LITE tone: 1047Hz 125ms ON, 370Hz 125ms */
+       MM_SOUND_TONE_CDMA_CALLDROP_LITE,                               /**CDMA CALLDROP LITE tone: 1480Hz 125ms, 1397Hz 125ms, 784Hz 125ms */
+       MM_SOUND_TONE_CDMA_NETWORK_BUSY_ONE_SHOT,               /**CDMA_NETWORK_BUSY_ONE_SHOT tone: 425Hz 500ms ON, 500ms OFF. */
+       MM_SOUND_TONE_CDMA_ABBR_ALERT,                                  /**CDMA_ABBR_ALERT tone: 1150Hz+770Hz 400ms ON */
        MM_SOUND_TONE_CDMA_SIGNAL_OFF,                                  /**CDMA_SIGNAL_OFF - silent tone */
        MM_SOUND_TONE_LOW_FRE,                                  /**100Hz continuous */
        MM_SOUND_TONE_MED_FRE,                                  /**200Hz continuous */
        MM_SOUND_TONE_HIGH_FRE,                                 /**300Hz continuous */
        MM_SOUND_TONE_NUM,
-}MMSoundTone_t;
+} MMSoundTone_t;
 
 typedef unsigned long sound_time_msec_t;               /**< millisecond unit */
 
@@ -852,9 +852,9 @@ typedef unsigned long sound_time_msec_t;            /**< millisecond unit */
  * This function is to play tone sound.
  *
  * @param      num                             [in] predefined tone type (MMSoundTone_t)
- *                     volume config   [in] volume type & volume gain
+ *                     volume config   [in] volume type & volume gain
  *                     volume                  [in] volume ratio (0.0 ~1.0)
- *                     duration                [in] millisecond (-1 for infinite)
+ *                     duration                [in] millisecond (-1 for infinite)
  *                     handle                  [in] Handle of mm_sound_play_tone
  *                     enable_session  [in] set enable/unable session
  *
@@ -880,15 +880,15 @@ else
 }
  * @endcode
  */
-int mm_sound_play_tone_ex (MMSoundTone_t num, int volume_config, const double volume, const int duration, int *handle, bool enable_session);
+int mm_sound_play_tone_ex(MMSoundTone_t num, int volume_config, const double volume, const int duration, int *handle, bool enable_session);
 
 /**
  * This function is to play tone sound.
  *
  * @param      num                             [in] predefined tone type (MMSoundTone_t)
- *                     volume config   [in] volume type & volume gain
+ *                     volume config   [in] volume type & volume gain
  *                     volume                  [in] volume ratio (0.0 ~1.0)
- *                     duration                [in] millisecond (-1 for infinite)
+ *                     duration                [in] millisecond (-1 for infinite)
  *                     handle                  [in] Handle of mm_sound_play_tone
  *
  * @return     This function returns MM_ERROR_NONE on success, or negative value
@@ -913,7 +913,7 @@ else
 }
  * @endcode
  */
-int mm_sound_play_tone (MMSoundTone_t num, int volume_config, const double volume, const int duration, int *handle);
+int mm_sound_play_tone(MMSoundTone_t num, int volume_config, const double volume, const int duration, int *handle);
 
 int mm_sound_play_tone_with_stream_info(MMSoundTone_t tone, char *stream_type, int stream_id, const double volume, const int duration, int *handle);
 
@@ -921,20 +921,20 @@ int mm_sound_play_tone_with_stream_info(MMSoundTone_t tone, char *stream_type, i
  * Enumerations of device & route
  */
 
-typedef enum{
+typedef enum {
        MM_SOUND_DIRECTION_NONE,
        MM_SOUND_DIRECTION_IN,                                                  /**< Capture */
        MM_SOUND_DIRECTION_OUT,                                                 /**< Playback */
 } mm_sound_direction;
 
-typedef enum{
+typedef enum {
        MM_SOUND_DEVICE_IN_NONE                         = 0x00,
        MM_SOUND_DEVICE_IN_MIC                          = 0x01,         /**< Device builtin mic. */
        MM_SOUND_DEVICE_IN_WIRED_ACCESSORY      = 0x02,         /**< Wired input devices */
        MM_SOUND_DEVICE_IN_BT_SCO       = 0x08,         /**< Bluetooth SCO device */
 } mm_sound_device_in;
 
-typedef enum{
+typedef enum {
        MM_SOUND_DEVICE_OUT_NONE                        = 0x000,
        MM_SOUND_DEVICE_OUT_SPEAKER             = 0x001<<8,     /**< Device builtin speaker */
        MM_SOUND_DEVICE_OUT_RECEIVER            = 0x002<<8,     /**< Device builtin receiver */
@@ -943,7 +943,7 @@ typedef enum{
        MM_SOUND_DEVICE_OUT_BT_A2DP             = 0x010<<8,     /**< Bluetooth A2DP device */
        MM_SOUND_DEVICE_OUT_DOCK                        = 0x020<<8,     /**< DOCK device */
        MM_SOUND_DEVICE_OUT_HDMI                        = 0x040<<8,     /**< HDMI device */
-       MM_SOUND_DEVICE_OUT_MIRRORING           = 0x080<<8, /**< MIRRORING device */
+       MM_SOUND_DEVICE_OUT_MIRRORING           = 0x080<<8,     /**< MIRRORING device */
        MM_SOUND_DEVICE_OUT_USB_AUDIO           = 0x100<<8,     /**< USB Audio device */
        MM_SOUND_DEVICE_OUT_MULTIMEDIA_DOCK     = 0x200<<8,     /**< Multimedia DOCK device */
 } mm_sound_device_out;
@@ -990,8 +990,7 @@ typedef enum {
        MM_SOUND_DEVICE_STATE_ACTIVATED,
 } mm_sound_device_state_e;
 
-typedef enum
-{
+typedef enum {
        MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER,   /**< Built-in speaker. */
        MM_SOUND_DEVICE_TYPE_BUILTIN_RECEIVER,  /**< Built-in receiver. */
        MM_SOUND_DEVICE_TYPE_BUILTIN_MIC,       /**< Built-in mic. */
@@ -1024,8 +1023,8 @@ int mm_sound_get_device_by_id(int device_id, MMSoundDevice_t *device);
 int mm_sound_free_device_list(MMSoundDeviceList_t device_list);
 /* Use this only for the device handle which got from mm_sound_get_device_by_id */
 int mm_sound_free_device(MMSoundDevice_t device_h);
-int mm_sound_get_next_device (MMSoundDeviceList_t device_list, MMSoundDevice_t *device);
-int mm_sound_get_prev_device (MMSoundDeviceList_t device_list, MMSoundDevice_t *device);
+int mm_sound_get_next_device(MMSoundDeviceList_t device_list, MMSoundDevice_t *device);
+int mm_sound_get_prev_device(MMSoundDeviceList_t device_list, MMSoundDevice_t *device);
 int mm_sound_get_device_type(MMSoundDevice_t device_h, mm_sound_device_type_e *type);
 int mm_sound_get_device_io_direction(MMSoundDevice_t device_h, mm_sound_device_io_direction_e *io_direction);
 int mm_sound_get_device_id(MMSoundDevice_t device_h, int *id);
index 36628146e05ba6cd87fc8084146b08ac6f151a31..ef977aa7e8321c4e13a56851d704c7079b68ac95 100644 (file)
 #define FOCUS_SERVER_READY "/tmp/.focus_server_ready"
 
 #define MMSOUND_ENTER_CRITICAL_SECTION(x_mutex) \
-switch ( pthread_mutex_lock( x_mutex ) ) \
-{ \
+switch (pthread_mutex_lock(x_mutex)) { \
 case EINVAL: \
        debug_warning("try mutex init.."); \
-       if( 0 > pthread_mutex_init( x_mutex, NULL) ) { \
+       if (0 > pthread_mutex_init(x_mutex, NULL)) { \
                return; \
        } else { \
                break; \
@@ -46,12 +45,11 @@ default: \
        return; \
 }
 
-#define MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(x_mutex,x_return) \
-switch ( pthread_mutex_lock( x_mutex ) ) \
-{ \
+#define MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(x_mutex, x_return) \
+switch (pthread_mutex_lock(x_mutex)) { \
 case EINVAL: \
        debug_warning("try mutex init.."); \
-       if( 0 > pthread_mutex_init( x_mutex, NULL) ) { \
+       if (0 > pthread_mutex_init(x_mutex, NULL)) { \
                return x_return; \
        } else { \
                break; \
@@ -65,7 +63,7 @@ default: \
 }
 
 #define MMSOUND_LEAVE_CRITICAL_SECTION(x_mutex) \
-if( pthread_mutex_unlock( x_mutex ) ) { \
+if (pthread_mutex_unlock(x_mutex)) { \
        debug_error("mutex unlock failed"); \
 }
 
@@ -81,7 +79,7 @@ do { \
                strncpy(dst, src, size - 1); \
                dst[size - 1] = '\0';\
        } \
-} while(0)
+} while (0)
 
 #endif /* __MM_SOUND_COMMON_H__ */
 
index e9ddea2136cd439cb85b624d6edf6124fc8f9713..620c8cff92fe5f627ea1e8963082b013aec3ddf7 100644 (file)
@@ -49,7 +49,7 @@ int mm_sound_dbus_get_method_name(audio_method_t method, const char **method_nam
 typedef void (*dbus_method_handler)(GDBusMethodInvocation *invocation);
 typedef int (*dbus_signal_sender)(GDBusConnection *conn, GVariant *parameter);
 
-typedef struct mm_sound_dbus_method_info{
+typedef struct mm_sound_dbus_method_info {
        const char* name;
        /*
        const char* argument;
@@ -57,7 +57,7 @@ typedef struct mm_sound_dbus_method_info{
        */
 } mm_sound_dbus_method_info_t;
 
-typedef struct mm_sound_dbus_signal_info{
+typedef struct mm_sound_dbus_signal_info {
        const char* name;
        const char* argument;
 } mm_sound_dbus_signal_info_t;
index fb52de57352dcc20cb58a076d18e0816840fbc39..cfb48c410ca6eef6f47af7b91250e052b4dd853c 100644 (file)
@@ -78,16 +78,14 @@ typedef enum {
        DEVICE_CHANGED_INFO_IO_DIRECTION,
 } device_changed_info_e;
 
-typedef enum
-{
+typedef enum {
        DEVICE_UPDATE_STATUS_DISCONNECTED = 0,
        DEVICE_UPDATE_STATUS_CONNECTED,
        DEVICE_UPDATE_STATUS_CHANGED_INFO_STATE,
        DEVICE_UPDATE_STATUS_CHANGED_INFO_IO_DIRECTION,
 } device_update_status_e;
 
-typedef enum
-{
+typedef enum {
        DEVICE_TYPE_BUILTIN_SPEAKER,   /**< Built-in speaker. */
        DEVICE_TYPE_BUILTIN_RECEIVER,  /**< Built-in receiver. */
        DEVICE_TYPE_BUILTIN_MIC,       /**< Built-in mic. */
index 1154b0b96d16bfec5677d973f3ea585517c02369..abe2f0f822c235647ccea2edfa8bd04687aebd4e 100644 (file)
@@ -41,7 +41,7 @@ typedef enum {
        HANDLE_MODE_OUTPUT_AP_CALL,             /**< for VT call on thin modem */
        HANDLE_MODE_INPUT_AP_CALL,                      /**< for VT call on thin modem */
        HANDLE_MODE_NUM,                                        /**< Number of mode */
-}MMSoundHandleMode;
+} MMSoundHandleMode;
 
 int mm_sound_pa_open(MMSoundHandleMode mode, int volume_config, pa_sample_spec* ss, pa_channel_map* channel_map, int* size, char *stream_type, int stream_index);
 int mm_sound_pa_write(const int handle, void* buf, const int size);
index 18022830765f85e71600b987cd3cc415f23c2f9a..beedb62f2eaf4fbc05e5b02e92115dc627d34e36 100644 (file)
 #endif
 
 /**
-       @internal
+       @internal
        @addtogroup SOUND_PRIVATE
        @{
 
- */
+*/
 
 #define MM_SOUND_VOLUME_CONFIG_TYPE(vol) (vol & 0x00FF)
 
@@ -90,7 +90,7 @@ int mm_sound_play_sound_with_stream_info(const char *filename, char *stream_type
  *                     with error code.
  *
  * @remark     This function provide low latency sound play (such as dialer keytone)
- *                     using fixed spec of wave file (44100Hz, mono channel)
+ *                     using fixed spec of wave file (44100Hz, mono channel)
  * @see                volume_type_t volume_gain_t mm_sound_volume_set_value
  */
 int mm_sound_play_keysound(const char *filename, int volume_config);
index 7d6ecc3b55e44362f775b4fbaded46765c8205d5..0924a250f4b11079d671846c24ea3d9e1c43fac8 100644 (file)
@@ -45,21 +45,21 @@ typedef struct {
        char volume_gain_type[VOLUME_GAIN_TYPE_LEN];
 } ipc_t;
 
-#define MMSOUND_STRNCPY(dst,src,size)\
+#define MMSOUND_STRNCPY(dst, src, size) \
 do { \
-       if(src != NULL && dst != NULL && size > 0) {\
-               strncpy(dst,src,size-1); \
-               dst[size-1] = '\0';\
-       } else if(dst == NULL) {       \
+       if (src != NULL && dst != NULL && size > 0) { \
+               strncpy(dst, src, size - 1); \
+               dst[size - 1] = '\0'; \
+       } else if (dst == NULL) { \
                debug_error("STRNCPY ERROR: Destination String is NULL"); \
-       }       \
-       else if(size <= 0) {      \
+       } \
+       else if (size <= 0) { \
                debug_error("STRNCPY ERROR: Destination String is NULL"); \
-       }       \
-       else {    \
+       } \
+       else { \
                debug_error("STRNCPY ERROR: Destination String is NULL"); \
-       }       \
-} while(0)
+       } \
+} while (0)
 
 EXPORT_API
 int mm_sound_boot_ready(int timeout_sec)
@@ -68,8 +68,8 @@ int mm_sound_boot_ready(int timeout_sec)
        sem_t* sem = NULL;
 
        debug_msg("[BOOT] check for sync....");
-       if ((sem = sem_open ("booting-sound", O_CREAT, 0660, 0))== SEM_FAILED) {
-               debug_error ("error creating sem : %d", errno);
+       if ((sem = sem_open("booting-sound", O_CREAT, 0660, 0)) == SEM_FAILED) {
+               debug_error("error creating sem : %d", errno);
                return -1;
        }
 
@@ -94,7 +94,7 @@ int mm_sound_boot_play_sound(char* path)
        int err = 0;
        int fd = -1;
        int size = 0;
-       ipc_t data = {{0,},{0,},{0,}};
+       ipc_t data = { { 0, }, { 0, }, { 0, } };
 
        debug_msg("[BOOT] play boot sound [%s]!!!!", path);
        if (path == NULL)
index 635c96dc7e9fbfa62ba438e60ce54ad2751169aa..458d2b690f483a87bf998878004ec35411eff69c 100644 (file)
@@ -122,7 +122,7 @@ typedef struct {
        void* user_data;
 } focus_session_interrupt_info_t;
 
-typedef gboolean (*focus_callback_handler_t)(gpointer user_data);
+typedef gboolean(*focus_callback_handler_t)(gpointer user_data);
 
 focus_sound_info_t g_focus_sound_handle[FOCUS_HANDLE_MAX];
 focus_session_interrupt_info_t g_focus_session_interrupt_info = {-1, NULL, NULL};
@@ -522,9 +522,8 @@ int mm_sound_client_play_sound(MMSoundPlayParam *param, int tone, int *handle)
 
                ret = mm_sound_proxy_add_play_sound_end_callback(_mm_sound_stop_callback_wrapper_func, cb_data,
                                                                                                                play_end_callback_data_free_func, &end_cb_data->subs_id);
-               if (ret != MM_ERROR_NONE) {
+               if (ret != MM_ERROR_NONE)
                        debug_error("Add callback for play sound(%d) Failed", *handle);
-               }
        }
 #ifdef USE_FOCUS
        if (!param->skip_session && !g_focus_signal_handle) {
@@ -562,9 +561,8 @@ int mm_sound_client_play_sound_with_stream_info(MMSoundPlayParam *param, int *ha
 
                ret = mm_sound_proxy_add_play_sound_end_callback(_mm_sound_stop_callback_wrapper_func, cb_data,
                                                                                                                play_end_callback_data_free_func, &end_cb_data->subs_id);
-               if (ret != MM_ERROR_NONE) {
+               if (ret != MM_ERROR_NONE)
                        debug_error("Add callback for play sound(%d) Failed", *handle);
-               }
        }
 
 failed:
@@ -957,9 +955,8 @@ int __convert_volume_type_to_str(int volume_type, char **volume_type_str)
 {
        int ret = MM_ERROR_NONE;
 
-       if (!volume_type_str) {
+       if (!volume_type_str)
                return MM_ERROR_COMMON_INVALID_ARGUMENT;
-       }
 
        switch (volume_type) {
        case VOLUME_TYPE_SYSTEM:
@@ -1003,9 +1000,8 @@ static int __convert_volume_type_to_int(const char *volume_type_str, volume_type
 {
        int ret = MM_ERROR_NONE;
 
-       if (!volume_type || !volume_type_str) {
+       if (!volume_type || !volume_type_str)
                return MM_ERROR_COMMON_INVALID_ARGUMENT;
-       }
 
        if (!strncmp(volume_type_str, "system", VOLUME_TYPE_LEN)) {
                *volume_type = VOLUME_TYPE_SYSTEM;
@@ -1494,9 +1490,8 @@ static void _focus_open_callback(int index, bool is_for_watching)
                                                                g_focus_sound_handle[index].handle);
        }
        pre_mask = umask(0);
-       if (mknod(filename, S_IFIFO|0666, 0)) {
+       if (mknod(filename, S_IFIFO|0666, 0))
                debug_error("mknod() failure, errno(%d)", errno);
-       }
        umask(pre_mask);
        g_focus_sound_handle[index].focus_fd = open(filename, O_RDWR|O_NONBLOCK);
        if (g_focus_sound_handle[index].focus_fd == -1) {
@@ -1521,9 +1516,8 @@ static void _focus_open_callback(int index, bool is_for_watching)
                                                                        g_focus_sound_handle[index].handle);
        }
        pre_mask = umask(0);
-       if (mknod(filename2, S_IFIFO | 0666, 0)) {
+       if (mknod(filename2, S_IFIFO | 0666, 0))
                debug_error("mknod() failure, errno(%d)", errno);
-       }
        umask(pre_mask);
        g_free(filename2);
        filename2 = NULL;
@@ -1891,9 +1885,8 @@ int mm_sound_client_register_focus(int id, int pid, const char *stream_type, boo
        _focus_init_callback(index, false);
 
 cleanup:
-       if (ret) {
+       if (ret)
                g_focus_sound_handle[index].is_used = false;
-       }
 
        MMSOUND_LEAVE_CRITICAL_SECTION(&g_index_mutex);
        debug_fleave();
@@ -1921,9 +1914,8 @@ int mm_sound_client_unregister_focus(int id)
        if (!g_mutex_trylock(&g_focus_sound_handle[index].focus_lock)) {
                debug_warning("maybe focus_callback is being called, try one more time..");
                usleep(2500000); // 2.5 sec
-               if (g_mutex_trylock(&g_focus_sound_handle[index].focus_lock)) {
+               if (g_mutex_trylock(&g_focus_sound_handle[index].focus_lock))
                        debug_msg("finally got focus_lock");
-               }
        }
 
        ret = mm_sound_proxy_unregister_focus(instance, id, g_focus_sound_handle[index].is_for_session);
@@ -2187,9 +2179,8 @@ int mm_sound_client_set_focus_watch_callback(int pid, mm_sound_focus_type_e focu
        _focus_init_callback(index, true);
 
 cleanup:
-       if (ret) {
+       if (ret)
                g_focus_sound_handle[index].is_used = false;
-       }
 
        MMSOUND_LEAVE_CRITICAL_SECTION(&g_index_mutex);
        debug_fleave();
index 9dcde4ecae49eb54297684a9b6ee29b79335b240..74db9671c1113bfb924ef7294036dfce529cfac7 100644 (file)
@@ -33,7 +33,7 @@
 mm_sound_device_list_t g_device_list;
 pthread_mutex_t g_thread_mutex = PTHREAD_MUTEX_INITIALIZER;
 
-static int _check_for_valid_mask (int flags)
+static int _check_for_valid_mask(int flags)
 {
        int ret = MM_ERROR_NONE;
        bool at_least_cond = false;
@@ -56,22 +56,22 @@ static int _check_for_valid_mask (int flags)
        } else {
                ret = MM_ERROR_INVALID_ARGUMENT;
        }
-       if (!at_least_cond) {
+
+       if (!at_least_cond)
                ret = MM_ERROR_INVALID_ARGUMENT;
-       }
-       if (ret) {
+
+       if (ret)
                debug_error("flags[0x%x] is not valid", flags);
-       }
+
        return ret;
 }
 
-static int __convert_device_type_to_enum (char *device_type, mm_sound_device_type_e *device_type_enum)
+static int __convert_device_type_to_enum(char *device_type, mm_sound_device_type_e *device_type_enum)
 {
        int ret = MM_ERROR_NONE;
 
-       if (!device_type || !device_type_enum) {
+       if (!device_type || !device_type_enum)
                return MM_ERROR_INVALID_ARGUMENT;
-       }
 
        if (!strncmp(device_type, "builtin-speaker", VOLUME_TYPE_LEN)) {
                *device_type_enum = MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER;
@@ -123,9 +123,8 @@ int mm_sound_add_device_connected_callback(int flags, mm_sound_device_connected_
        ret = _check_for_valid_mask(flags);
        if (ret == MM_ERROR_NONE) {
                ret = mm_sound_client_add_device_connected_callback(flags, func, user_data, id);
-               if (ret < 0) {
+               if (ret < 0)
                        debug_error("Could not add device connected callback, ret = %x", ret);
-               }
        }
 
        return ret;
@@ -137,9 +136,8 @@ int mm_sound_remove_device_connected_callback(unsigned int id)
        int ret = MM_ERROR_NONE;
 
        ret = mm_sound_client_remove_device_connected_callback(id);
-       if (ret < 0) {
+       if (ret < 0)
                debug_error("Could not remove device connected callback, ret = %x", ret);
-       }
 
        return ret;
 }
@@ -156,9 +154,8 @@ int mm_sound_add_device_information_changed_callback(int flags, mm_sound_device_
        ret = _check_for_valid_mask(flags);
        if (ret == MM_ERROR_NONE) {
                ret = mm_sound_client_add_device_info_changed_callback(flags, func, user_data, id);
-               if (ret < 0) {
+               if (ret < 0)
                        debug_error("Could not add device information changed callback, ret = %x", ret);
-               }
        }
 
        return ret;
@@ -170,9 +167,8 @@ int mm_sound_remove_device_information_changed_callback(unsigned int id)
        int ret = MM_ERROR_NONE;
 
        ret = mm_sound_client_remove_device_info_changed_callback(id);
-       if (ret < 0) {
+       if (ret < 0)
                debug_error("Could not remove device information changed callback, ret = %x", ret);
-       }
 
        return ret;
 }
@@ -189,9 +185,8 @@ int mm_sound_add_device_state_changed_callback(int flags, mm_sound_device_state_
        ret = _check_for_valid_mask(flags);
        if (ret == MM_ERROR_NONE) {
                ret = mm_sound_client_add_device_state_changed_callback(flags, func, user_data, id);
-               if (ret < 0) {
+               if (ret < 0)
                        debug_error("Could not add device state changed callback, ret = %x", ret);
-               }
        }
 
        return ret;
@@ -203,9 +198,8 @@ int mm_sound_remove_device_state_changed_callback(unsigned int id)
        int ret = MM_ERROR_NONE;
 
        ret = mm_sound_client_remove_device_state_changed_callback(id);
-       if (ret < 0) {
+       if (ret < 0)
                debug_error("Could not remove device state changed callback, ret = %x", ret);
-       }
 
        return ret;
 }
@@ -216,9 +210,9 @@ int mm_sound_get_current_device_list(mm_sound_device_flags_e flags, MMSoundDevic
 {
        int ret = MM_ERROR_NONE;
 
-       if (!device_list) {
+       if (!device_list)
                return MM_ERROR_INVALID_ARGUMENT;
-       }
+
        ret = _check_for_valid_mask(flags);
        if (ret != MM_ERROR_NONE) {
                debug_error("mask[0x%x] is invalid, ret=0x%x", flags, ret);
@@ -253,9 +247,9 @@ int mm_sound_get_device_list(int flags, MMSoundDeviceList_t *device_list)
        int ret = MM_ERROR_NONE;
        mm_sound_device_list_t *_device_list;
 
-       if (!device_list) {
+       if (!device_list)
                return MM_ERROR_INVALID_ARGUMENT;
-       }
+
        ret = _check_for_valid_mask(flags);
        if (ret != MM_ERROR_NONE) {
                debug_error("mask[0x%x] is invalid, ret=0x%x", flags, ret);
@@ -316,28 +310,29 @@ int mm_sound_get_device_by_id(int device_id, MMSoundDevice_t *device_h)
 }
 
 EXPORT_API
-int mm_sound_get_next_device (MMSoundDeviceList_t device_list, MMSoundDevice_t *device)
+int mm_sound_get_next_device(MMSoundDeviceList_t device_list, MMSoundDevice_t *device)
 {
        int ret = MM_ERROR_NONE;
        mm_sound_device_list_t *device_list_t = NULL;
        GList *node = NULL;
-       if (!device_list || !device) {
+
+       if (!device_list || !device)
                return MM_ERROR_INVALID_ARGUMENT;
-       }
+
        device_list_t = (mm_sound_device_list_t*) device_list;
-       if (device_list_t->is_new_device_list) {
+       if (device_list_t->is_new_device_list)
                node = g_list_first(device_list_t->list);
-       } else {
+       else
                node = g_list_next(device_list_t->list);
-       }
+
        if (!node) {
                ret = MM_ERROR_SOUND_NO_DATA;
        } else {
-               if (device_list_t->is_new_device_list) {
+               if (device_list_t->is_new_device_list)
                        device_list_t->is_new_device_list = false;
-               } else {
+               else
                        device_list_t->list = node;
-               }
+
                *device = (mm_sound_device_t*)node->data;
                debug_log("next device[0x%x]", *device);
        }
@@ -345,14 +340,15 @@ int mm_sound_get_next_device (MMSoundDeviceList_t device_list, MMSoundDevice_t *
 }
 
 EXPORT_API
-int mm_sound_get_prev_device (MMSoundDeviceList_t device_list, MMSoundDevice_t *device)
+int mm_sound_get_prev_device(MMSoundDeviceList_t device_list, MMSoundDevice_t *device)
 {
        int ret = MM_ERROR_NONE;
        mm_sound_device_list_t *device_list_t = NULL;
        GList *node = NULL;
-       if (!device_list || !device) {
+
+       if (!device_list || !device)
                return MM_ERROR_INVALID_ARGUMENT;
-       }
+
        device_list_t = (mm_sound_device_list_t*) device_list;
        node = g_list_previous(device_list_t->list);
        if (!node) {
@@ -370,7 +366,7 @@ EXPORT_API
 int mm_sound_get_device_type(MMSoundDevice_t device_h, mm_sound_device_type_e *type)
 {
        mm_sound_device_t *device = (mm_sound_device_t*)device_h;
-       if(!device || !type) {
+       if (!device || !type) {
                debug_error("invalid argument");
                return MM_ERROR_INVALID_ARGUMENT;
        }
@@ -384,7 +380,7 @@ EXPORT_API
 int mm_sound_get_device_io_direction(MMSoundDevice_t device_h, mm_sound_device_io_direction_e *io_direction)
 {
        mm_sound_device_t *device = (mm_sound_device_t*)device_h;
-       if(!device) {
+       if (!device) {
                debug_error("invalid handle");
                return MM_ERROR_INVALID_ARGUMENT;
        }
@@ -398,7 +394,7 @@ EXPORT_API
 int mm_sound_get_device_id(MMSoundDevice_t device_h, int *id)
 {
        mm_sound_device_t *device = (mm_sound_device_t*)device_h;
-       if(!device) {
+       if (!device) {
                debug_error("invalid handle");
                return MM_ERROR_INVALID_ARGUMENT;
        }
@@ -412,7 +408,7 @@ EXPORT_API
 int mm_sound_get_device_state(MMSoundDevice_t device_h, mm_sound_device_state_e *state)
 {
        mm_sound_device_t *device = (mm_sound_device_t*)device_h;
-       if(!device) {
+       if (!device) {
                debug_error("invalid handle");
                return MM_ERROR_INVALID_ARGUMENT;
        }
@@ -426,7 +422,7 @@ EXPORT_API
 int mm_sound_get_device_name(MMSoundDevice_t device_h, char **name)
 {
        mm_sound_device_t *device = (mm_sound_device_t*)device_h;
-       if(!device) {
+       if (!device) {
                debug_error("invalid handle");
                return MM_ERROR_INVALID_ARGUMENT;
        }
@@ -440,7 +436,7 @@ EXPORT_API
 int mm_sound_get_device_vendor_id(MMSoundDevice_t device_h, int *vendor_id)
 {
        mm_sound_device_t *device = (mm_sound_device_t*)device_h;
-       if(!device) {
+       if (!device) {
                debug_error("invalid handle");
                return MM_ERROR_INVALID_ARGUMENT;
        }
@@ -454,7 +450,7 @@ EXPORT_API
 int mm_sound_get_device_product_id(MMSoundDevice_t device_h, int *product_id)
 {
        mm_sound_device_t *device = (mm_sound_device_t*)device_h;
-       if(!device) {
+       if (!device) {
                debug_error("invalid handle");
                return MM_ERROR_INVALID_ARGUMENT;
        }
@@ -472,7 +468,7 @@ int mm_sound_is_stream_on_device(int stream_id, MMSoundDevice_t device_h, bool *
        mm_sound_device_t *device = (mm_sound_device_t*)device_h;
        bool _is_on = false;
 
-       if(!device || !is_on) {
+       if (!device || !is_on) {
                debug_error("invalid argument");
                return MM_ERROR_INVALID_ARGUMENT;
        }
index 3ad33b623461d900e577f70586a750263fcb069e..977fc282b7325069c0d534ac19e380271eaae45f 100644 (file)
@@ -67,9 +67,8 @@ int mm_sound_focus_unset_session_interrupt_callback(void)
        RETURN_ERROR_IF_FOCUS_CB_THREAD(g_thread_self());
 
        ret = mm_sound_client_unset_session_interrupt_callback();
-       if (ret) {
+       if (ret)
                debug_error("Failed to mm_sound_client_unset_session_interrupt_callback(), ret[0x%x]", ret);
-       }
 
        debug_fleave();
 
@@ -86,9 +85,8 @@ int mm_sound_focus_get_id(int *id)
        RETURN_ERROR_IF_FOCUS_CB_THREAD(g_thread_self());
 
        ret = mm_sound_client_get_unique_id(id);
-       if (ret) {
+       if (ret)
                debug_error("Failed to mm_sound_client_get_unique_id(), ret[0x%x]", ret);
-       }
 
        debug_fleave();
 
@@ -128,9 +126,8 @@ int mm_sound_register_focus(int id, const char *stream_type, mm_sound_focus_chan
        }
 
        ret = mm_sound_client_register_focus(id, getpid(), stream_type, false, callback, user_data);
-       if (ret) {
+       if (ret)
                debug_error("Could not register focus, ret[0x%x]", ret);
-       }
 
        debug_fleave();
 
@@ -152,9 +149,8 @@ int mm_sound_register_focus_for_session(int id, int pid, const char *stream_type
        }
 
        ret = mm_sound_client_register_focus(id, pid, stream_type, true, callback, user_data);
-       if (ret) {
+       if (ret)
                debug_error("Could not register focus for session, ret[0x%x]", ret);
-       }
 
        debug_fleave();
 
@@ -240,9 +236,8 @@ int mm_sound_get_focus_reacquisition(int id, bool *reacquisition)
        }
 
        ret = mm_sound_client_get_focus_reacquisition(id, reacquisition);
-       if (ret) {
+       if (ret)
                debug_error("Could not get focus reacquisition, ret[0x%x]", ret);
-       }
 
        debug_fleave();
 
@@ -262,9 +257,8 @@ int mm_sound_get_stream_type_of_acquired_focus(int focus_type, char **stream_typ
        }
 
        ret = mm_sound_client_get_acquired_focus_stream_type(focus_type, stream_type, option, ext_info);
-       if (ret) {
+       if (ret)
                debug_error("Could not get acquired focus stream type, ret[0x%x]", ret);
-       }
 
        debug_fleave();
 
@@ -290,9 +284,8 @@ int mm_sound_acquire_focus(int id, mm_sound_focus_type_e focus_type, const char
        }
 
        ret = mm_sound_client_acquire_focus(id, focus_type, 0, ext_info);
-       if (ret) {
+       if (ret)
                debug_error("Could not acquire focus, ret[0x%x]", ret);
-       }
 
        debug_fleave();
 
@@ -318,9 +311,8 @@ int mm_sound_release_focus(int id, mm_sound_focus_type_e focus_type, const char
        }
 
        ret = mm_sound_client_release_focus(id, focus_type, 0, ext_info);
-       if (ret) {
+       if (ret)
                debug_error("Could not release focus, ret[0x%x]", ret);
-       }
 
        debug_fleave();
 
@@ -350,9 +342,8 @@ int mm_sound_acquire_focus_with_option(int id, mm_sound_focus_type_e focus_type,
        }
 
        ret = mm_sound_client_acquire_focus(id, focus_type, option, ext_info);
-       if (ret) {
+       if (ret)
                debug_error("Could not acquire focus, ret[0x%x]", ret);
-       }
 
        debug_fleave();
 
@@ -382,9 +373,8 @@ int mm_sound_release_focus_with_option(int id, mm_sound_focus_type_e focus_type,
        }
 
        ret = mm_sound_client_release_focus(id, focus_type, option, ext_info);
-       if (ret) {
+       if (ret)
                debug_error("Could not release focus, ret[0x%x]", ret);
-       }
 
        debug_fleave();
 
@@ -428,9 +418,8 @@ int mm_sound_set_focus_watch_callback(mm_sound_focus_type_e focus_type, mm_sound
                return MM_ERROR_INVALID_ARGUMENT;
        }
        ret = mm_sound_client_set_focus_watch_callback(getpid(), focus_type, false, false, callback, user_data, id);
-       if (ret) {
+       if (ret)
                debug_error("Could not set focus watch callback, ret[0x%x]", ret);
-       }
 
        debug_fleave();
 
@@ -451,9 +440,8 @@ int mm_sound_set_focus_watch_callback_for_session(int pid, mm_sound_focus_type_e
                return MM_ERROR_INVALID_ARGUMENT;
        }
        ret = mm_sound_client_set_focus_watch_callback(pid, focus_type, true, false, callback, user_data, id);
-       if (ret) {
+       if (ret)
                debug_error("Could not set focus watch callback, ret[0x%x]", ret);
-       }
 
        debug_fleave();
 
@@ -474,9 +462,8 @@ int mm_sound_set_focus_watch_callback_for_session_monitor(int pid, mm_sound_focu
                return MM_ERROR_INVALID_ARGUMENT;
        }
        ret = mm_sound_client_set_focus_watch_callback(pid, focus_type, true, true, callback, user_data, id);
-       if (ret) {
+       if (ret)
                debug_error("Could not set focus watch callback, ret[0x%x]", ret);
-       }
 
        debug_fleave();
 
index 92240c784f3b008c7f5224b4a3ee182659db96fb..6901eb0b002a7334bf350f3fe1ed4c12dca216c2 100644 (file)
@@ -38,7 +38,7 @@ do { \
        MMSOUND_STRNCPY(x_param.ext_info, x_ext_info, MM_SOUND_NAME_NUM); \
        x_param.is_in_thread = x_is_in_thread; \
        x_param.is_for_session = x_is_for_session; \
-} while(0) \
+} while (0) \
 
 static int _convert_error_from_string(const char *error_string)
 {
@@ -175,7 +175,7 @@ int mm_sound_focus_socket_acquire(int instance, int id, mm_sound_focus_type_e fo
 
        memset(&data, 0x00, sizeof(_mm_sound_mgr_focus_socket_param_t));
        FILL_SOCKET_PARAM(data, FOCUS_FUNC_NAME_ACQUIRE, instance, id, focus_type,
-                         option, ext_info, is_in_thread, is_for_session);
+                                       option, ext_info, is_in_thread, is_for_session);
 
        if ((ret = _send_data_to_server(fd, &data))) {
                debug_error("failed to _send_data_to_server(), ret[0x%x]", ret);
@@ -220,7 +220,7 @@ int mm_sound_focus_socket_release(int instance, int id, mm_sound_focus_type_e fo
 
        memset(&data, 0x00, sizeof(_mm_sound_mgr_focus_socket_param_t));
        FILL_SOCKET_PARAM(data, FOCUS_FUNC_NAME_RELEASE, instance, id, focus_type,
-                         option, ext_info, is_in_thread, is_for_session);
+                                       option, ext_info, is_in_thread, is_for_session);
 
        if ((ret = _send_data_to_server(fd, &data))) {
                debug_error("failed to _send_data_to_server()");
index 99a56275480d920c506251491df7d8f445119285..def3eeaf377dac0aa748aacac21d7b8273a47f8b 100644 (file)
 #define AUDIO_VOLUME_CONFIG_GAIN(vol) (vol & 0xFF00)
 
 typedef struct ipc_data {
-    char filename[FILE_FULL_PATH];
-    char role[ROLE_NAME_LEN];
-    char volume_gain_type[VOLUME_GAIN_TYPE_LEN];
-}ipc_t;
+       char filename[FILE_FULL_PATH];
+       char role[ROLE_NAME_LEN];
+       char volume_gain_type[VOLUME_GAIN_TYPE_LEN];
+} ipc_t;
 
 typedef enum {
        IPC_TYPE_PIPE,
        IPC_TYPE_DBUS,
-}ipc_type_t;
+} ipc_type_t;
 
 static int _mm_sound_play_keysound(const char *filename, int volume_config, ipc_type_t ipc_type);
 
 static const char* convert_volume_type_to_role(int volume_type)
 {
        debug_log("volume_type(%d)", volume_type);
-       switch(volume_type) {
+       switch (volume_type) {
        case VOLUME_TYPE_MEDIA:
                return "media";
        case VOLUME_TYPE_SYSTEM:
@@ -76,7 +76,7 @@ static const char* convert_volume_type_to_role(int volume_type)
        case VOLUME_TYPE_RINGTONE:
                return "ringtone-call";
        default:
-               debug_warning ("not supported type(%d), we change it SYSTEM type forcibly" );
+               debug_warning("not supported type(%d), we change it SYSTEM type forcibly", volume_type);
                return "system";
        }
 }
@@ -84,7 +84,7 @@ static const char* convert_volume_type_to_role(int volume_type)
 static const char* convert_volume_gain_type_to_string(int volume_gain_type)
 {
        debug_log("volume_gain_type(0x%x)", volume_gain_type);
-       switch(volume_gain_type) {
+       switch (volume_gain_type) {
        case VOLUME_GAIN_DEFAULT:
                return "";
        case VOLUME_GAIN_DIALER:
@@ -129,15 +129,14 @@ static int _mm_sound_play_keysound(const char *filename, int volume_config, ipc_
 
        /* convert volume type to role/volume gain */
        role = convert_volume_type_to_role(AUDIO_VOLUME_CONFIG_TYPE(volume_config));
-       if (role) {
+       if (role)
                vol_gain_type = convert_volume_gain_type_to_string(AUDIO_VOLUME_CONFIG_GAIN(volume_config));
-       }
 
        if (ipc_type == IPC_TYPE_PIPE) {
                int res = 0;
                int fd = -1;
                int size = 0;
-               ipc_t data = {{0,},{0,},{0,}};
+               ipc_t data = { { 0, }, { 0, }, { 0, } };
 
                /* Check whether file exists */
                fd = open(filename, O_RDONLY);
@@ -163,12 +162,11 @@ static int _mm_sound_play_keysound(const char *filename, int volume_config, ipc_
                }
 
                /* convert volume type to role/volume gain */
-               if (role) {
+               if (role)
                        MMSOUND_STRNCPY(data.role, role, ROLE_NAME_LEN);
-               }
-               if (vol_gain_type) {
+
+               if (vol_gain_type)
                        MMSOUND_STRNCPY(data.volume_gain_type, vol_gain_type, VOLUME_GAIN_TYPE_LEN);
-               }
 
                MMSOUND_STRNCPY(data.filename, filename, FILE_FULL_PATH);
 
@@ -197,12 +195,12 @@ static int _mm_sound_play_keysound(const char *filename, int volume_config, ipc_
                        debug_error("g_bus_get_sync() error (%s)", err ? err->message : NULL);
                        ret = MM_ERROR_SOUND_INTERNAL;
                } else {
-                       result = g_dbus_connection_call_sync (conn,
+                       result = g_dbus_connection_call_sync(conn,
                                                                        PA_BUS_NAME,
                                                                        PA_SOUND_PLAYER_OBJECT_PATH,
                                                                        PA_SOUND_PLAYER_INTERFACE,
                                                                        PA_SOUND_PLAYER_METHOD_NAME_SIMPLE_PLAY,
-                                                                       g_variant_new ("(sss)", filename, role, vol_gain_type),
+                                                                       g_variant_new("(sss)", filename, role, vol_gain_type),
                                                                        NULL,
                                                                        G_DBUS_CALL_FLAGS_NONE,
                                                                        2000,
index 32bbbe8d89b4a4d2d370faa70bab8c3ea7d5cd37..f331330cbbe2584d85b8a38a1a43acd4b496d631 100644 (file)
 #define MM_SOUND_CHANNEL_MAX                6
 
 typedef struct _mm_sound_handle_t {
-    uint32_t handle;
+       uint32_t handle;
 
-    int mode;
-    int volume_type;
-    int gain_type;
-    int rate;
-    int channels;
-    pa_simple* s;
+       int mode;
+       int volume_type;
+       int gain_type;
+       int rate;
+       int channels;
+       pa_simple *s;
 
-    int period; /* open api retrun value.*/
+       int period;     /* open api retrun value. */
 
-    unsigned int stream_idx;
-    int source_type;
+       unsigned int stream_idx;
+       int source_type;
 } mm_sound_handle_t;
 
 static struct {
-    uint32_t handle_count; /* use amotic operations */
-    GList* handles;
-    pthread_mutex_t lock;
+       uint32_t handle_count;  /* use amotic operations */
+       GList *handles;
+       pthread_mutex_t lock;
 
-    int state;
-    pa_threaded_mainloop *mainloop;
-    pa_context *context;
+       int state;
+       pa_threaded_mainloop *mainloop;
+       pa_context *context;
 } mm_sound_handle_mgr;
 
 #define CHECK_HANDLE_RANGE(x) \
-    do { \
-        if(x == 0) { \
-            debug_msg("invalid handle(%d)", x); \
-            return MM_ERROR_INVALID_ARGUMENT; \
-        } \
-    } while(0);
+       do { \
+               if (x == 0) { \
+                       debug_msg("invalid handle(%d)", x); \
+                       return MM_ERROR_INVALID_ARGUMENT; \
+               } \
+       } while (0);
 
 #define ATOMIC_INC(l, x) \
-    do { \
-        pthread_mutex_lock(l); \
-        x = x + 1; \
-        if(x == 0) \
-            x = x + 1; \
-        pthread_mutex_unlock(l); \
-    } while(0);
+       do { \
+               pthread_mutex_lock(l); \
+               x = x + 1; \
+               if (x == 0) \
+               x = x + 1; \
+               pthread_mutex_unlock(l); \
+       } while (0);
 
 // phandle(ret), GList, userdata, coimpare func
 #define GET_HANDLE_DATA(p, l, u, func) \
-    do { \
-        GList* list = 0; \
-        list = g_list_find_custom(l, u, func); \
-        if(list != 0) \
-            p = (mm_sound_handle_t*)list->data; \
-        else \
-            p = NULL; \
-    } while(0);
-
+       do { \
+               GList* list = 0; \
+               list = g_list_find_custom(l, u, func); \
+               if (list != 0) \
+                       p = (mm_sound_handle_t*)list->data; \
+               else \
+                       p = NULL; \
+       } while (0);
 
 #define PA_SIMPLE_SAMPLES_PER_PERIOD_DEFAULT                           1536    /* frames */
 #define PA_SIMPLE_PERIODS_PER_BUFFER_FASTMODE                          4
@@ -102,354 +101,367 @@ static struct {
 #define PA_SIMPLE_PERIOD_TIME_FOR_HIGH_LATENCY_MSEC                    75
 #define PA_SIMPLE_PERIOD_TIME_FOR_VOIP_LATENCY_MSEC                    20
 
-__attribute__ ((constructor)) void __mm_sound_pa_init(void)
+__attribute__ ((constructor))
+void __mm_sound_pa_init(void)
 {
-    memset(&mm_sound_handle_mgr, 0, sizeof(mm_sound_handle_mgr));
-    mm_sound_handle_mgr.state = FALSE;
+       memset(&mm_sound_handle_mgr, 0, sizeof(mm_sound_handle_mgr));
+       mm_sound_handle_mgr.state = FALSE;
 
-    mm_sound_handle_mgr.handles = g_list_alloc();
-    mm_sound_handle_mgr.handle_count = 1;
-    pthread_mutex_init(&mm_sound_handle_mgr.lock, NULL);
+       mm_sound_handle_mgr.handles = g_list_alloc();
+       mm_sound_handle_mgr.handle_count = 1;
+       pthread_mutex_init(&mm_sound_handle_mgr.lock, NULL);
 }
 
-__attribute__ ((destructor)) void __mm_sound_pa_deinit(void)
+__attribute__ ((destructor))
+void __mm_sound_pa_deinit(void)
 {
-     g_list_free(mm_sound_handle_mgr.handles);
-     pthread_mutex_destroy(&mm_sound_handle_mgr.lock);
-     mm_sound_handle_mgr.handle_count = 0;
-
-    if(mm_sound_handle_mgr.state) {
-        debug_msg("mainloop(%x),  context(%x)", mm_sound_handle_mgr.mainloop, mm_sound_handle_mgr.context);
-        pa_threaded_mainloop_stop(mm_sound_handle_mgr.mainloop);
-        pa_context_disconnect(mm_sound_handle_mgr.context);
-        pa_context_unref(mm_sound_handle_mgr.context);
-        pa_threaded_mainloop_free(mm_sound_handle_mgr.mainloop);
-    }
+       g_list_free(mm_sound_handle_mgr.handles);
+       pthread_mutex_destroy(&mm_sound_handle_mgr.lock);
+       mm_sound_handle_mgr.handle_count = 0;
+
+       if (mm_sound_handle_mgr.state) {
+               debug_msg("mainloop(%x),  context(%x)", mm_sound_handle_mgr.mainloop, mm_sound_handle_mgr.context);
+               pa_threaded_mainloop_stop(mm_sound_handle_mgr.mainloop);
+               pa_context_disconnect(mm_sound_handle_mgr.context);
+               pa_context_unref(mm_sound_handle_mgr.context);
+               pa_threaded_mainloop_free(mm_sound_handle_mgr.mainloop);
+       }
 }
 
 gint __mm_sound_handle_comparefunc(gconstpointer a, gconstpointer b)
 {
-    mm_sound_handle_t* phandle = (mm_sound_handle_t*)a;
-    int* handle = (int*)b;
+       mm_sound_handle_t *phandle = (mm_sound_handle_t *) a;
+       int *handle = (int *)b;
 
-    if(phandle == NULL)
-        return -1;
+       if (phandle == NULL)
+               return -1;
 
-    if(phandle->handle == *handle)
-        return 0;
-    else
-        return -1;
+       if (phandle->handle == *handle)
+               return 0;
+       else
+               return -1;
 }
 
 EXPORT_API
-int mm_sound_pa_open(MMSoundHandleMode mode, int volume_config, pa_sample_spec* ss, pa_channel_map* channel_map, int* size, char *stream_type, int stream_index)
+int mm_sound_pa_open(MMSoundHandleMode mode, int volume_config, pa_sample_spec * ss, pa_channel_map * channel_map,
+                                       int *size, char *stream_type, int stream_index)
 {
-    pa_simple *s = NULL;
-    pa_channel_map maps;
-    pa_buffer_attr attr;
-
-    int prop_vol_type = 0;
-    int prop_gain_type = VOLUME_GAIN_DEFAULT;
-
-    int err = MM_ERROR_SOUND_INTERNAL;
-    int period_time = PA_SIMPLE_PERIOD_TIME_FOR_MID_LATENCY_MSEC;
-    int samples_per_period = PA_SIMPLE_SAMPLES_PER_PERIOD_DEFAULT;
-    int periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_DEFAULT;
-
-    int handle_mode = mode;
-    int sample_size = 0;
-    pa_proplist *proplist = NULL;
-
-    mm_sound_handle_t* handle = NULL;
-
-    if (ss->channels < MM_SOUND_CHANNEL_MIN || ss->channels > MM_SOUND_CHANNEL_MAX)
-        return MM_ERROR_INVALID_ARGUMENT;
-
-    proplist = pa_proplist_new();
-
-    if(channel_map == NULL) {
-        pa_channel_map_init_auto(&maps, ss->channels, PA_CHANNEL_MAP_ALSA);
-        channel_map = &maps;
-    }
-
-    switch(ss->format) {
-        case PA_SAMPLE_U8:
-            sample_size = 1 * ss->channels;
-            break;
-        case PA_SAMPLE_S16LE:
-            sample_size = 2 * ss->channels;
-            break;
-        default :
-            sample_size = 0;
-            debug_error("Invalid sample size (%d)", sample_size);
-            break;
-    }
-
-    /* Set volume type of stream */
-    if(volume_config > 0) {
-        debug_log("setting gain type");
-        prop_vol_type = 0; /* not used, set it system(0) temporarily */
-
-        /* Set gain type of stream */
-        prop_gain_type = (volume_config >> 8) & 0x000000FF;
-
-        pa_proplist_setf(proplist, PA_PROP_MEDIA_TIZEN_GAIN_TYPE, "%d", prop_gain_type);
-    }
-
-    if (stream_index != -1) {
-        char stream_index_s[11];
-        debug_msg("Set stream index [%d]", stream_index);
-
-        snprintf(stream_index_s, sizeof(stream_index_s)-1, "%d", stream_index);
-        debug_msg("stream_index[%d] converted to string[%s]", stream_index, stream_index_s);
-        pa_proplist_sets(proplist, PA_PROP_MEDIA_PARENT_ID, stream_index_s);
-    }
-    /* Set stream type */
-    pa_proplist_sets(proplist, PA_PROP_MEDIA_ROLE, stream_type);
-
-    memset(&attr, '\0', sizeof(attr));
-
-    switch (handle_mode) {
-    case HANDLE_MODE_INPUT:
-        period_time = PA_SIMPLE_PERIOD_TIME_FOR_MID_LATENCY_MSEC;
-        samples_per_period = (ss->rate * period_time) / 1000;
-        periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_DEFAULT;
-        attr.prebuf = 0;
-        attr.minreq = -1;
-        attr.tlength = -1;
-        attr.maxlength = -1;
-        attr.fragsize = samples_per_period * pa_sample_size(ss);
-
-        s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_RECORD, NULL, "CAPTURE", ss, channel_map, &attr, proplist, &err);
-        break;
-
-    case HANDLE_MODE_INPUT_LOW_LATENCY:
-        period_time = PA_SIMPLE_PERIOD_TIME_FOR_ULOW_LATENCY_MSEC;
-        samples_per_period = (ss->rate * period_time) / 1000;
-        periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_FASTMODE;
-        attr.prebuf = 0;
-        attr.minreq = -1;
-        attr.tlength = -1;
-        attr.maxlength = -1;
-        attr.fragsize = samples_per_period * pa_sample_size(ss);
-
-        s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_RECORD, NULL, "LOW LATENCY CAPTURE", ss, channel_map, &attr, proplist, &err);
-        break;
-
-    case HANDLE_MODE_INPUT_HIGH_LATENCY:
-        period_time = PA_SIMPLE_PERIOD_TIME_FOR_HIGH_LATENCY_MSEC;
-        samples_per_period = (ss->rate * period_time) / 1000;
-        periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_CAPTURE;
-        attr.prebuf = 0;
-        attr.minreq = -1;
-        attr.tlength = -1;
-        attr.maxlength = -1;
-        attr.fragsize = samples_per_period * pa_sample_size(ss);
-
-        s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_RECORD, NULL, "HIGH LATENCY CAPTURE", ss, channel_map, &attr, proplist, &err);
-        break;
-
-    case HANDLE_MODE_OUTPUT:
-        period_time = PA_SIMPLE_PERIOD_TIME_FOR_MID_LATENCY_MSEC;
-        samples_per_period = (ss->rate * period_time) / 1000;
-        periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_DEFAULT;
-        attr.prebuf = -1;
-        attr.minreq = -1;
-        attr.tlength = (ss->rate / 10) * pa_sample_size(ss) * ss->channels;
-        attr.maxlength = -1;
-        attr.fragsize = 0;
-
-        s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "PLAYBACK", ss, channel_map, &attr, proplist, &err);
-        break;
-
-    case HANDLE_MODE_OUTPUT_LOW_LATENCY:
-        period_time = PA_SIMPLE_PERIOD_TIME_FOR_LOW_LATENCY_MSEC;
-        samples_per_period = (ss->rate * period_time) / 1000;
-        periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_FASTMODE;
-        attr.prebuf = (ss->rate / 100) * pa_sample_size(ss) * ss->channels;
-        attr.minreq = -1;
-        attr.tlength = (ss->rate / 10) * pa_sample_size(ss) * ss->channels;
-        attr.maxlength = -1;
-        attr.fragsize = 0;
-        debug_msg("rate(%d), samplesize(%d), ch(%d) format(%d)", ss->rate, pa_sample_size(ss), ss->channels, ss->format);
-
-        debug_msg("prebuf(%d), minreq(%d), tlength(%d), maxlength(%d), fragsize(%d)", attr.prebuf, attr.minreq, attr.tlength, attr.maxlength, attr.fragsize);
-
-        s = pa_simple_new_proplist(NULL,"MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "LOW LATENCY PLAYBACK", ss, channel_map, &attr, proplist, &err);
-        break;
-
-    case HANDLE_MODE_OUTPUT_CLOCK:
-        period_time = PA_SIMPLE_PERIOD_TIME_FOR_HIGH_LATENCY_MSEC;
-        samples_per_period = (ss->rate * period_time) / 1000;
-        periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_PLAYBACK;
-        attr.prebuf = -1;
-        attr.minreq = -1;
-        attr.tlength = (uint32_t)-1;
-        attr.maxlength = -1;
-        attr.fragsize = 0;
-
-        s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "HIGH LATENCY PLAYBACK", ss, channel_map, &attr, proplist, &err);
-        break;
-
-    case HANDLE_MODE_OUTPUT_VIDEO: /* low latency playback */
-        period_time = PA_SIMPLE_PERIOD_TIME_FOR_LOW_LATENCY_MSEC;
-        samples_per_period = (ss->rate * period_time) / 1000;
-        periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_VIDEO;
-        attr.prebuf = 4*(samples_per_period * pa_sample_size(ss));
-        attr.minreq = samples_per_period * pa_sample_size(ss);
-        attr.tlength = periods_per_buffer * samples_per_period * pa_sample_size(ss);
-        attr.maxlength = -1;
-        attr.fragsize = 0;
-
-        s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "LOW LATENCY PLAYBACK", ss, channel_map, &attr, proplist, &err);
-        break;
-
-    case HANDLE_MODE_OUTPUT_AP_CALL:
+       pa_simple *s = NULL;
+       pa_channel_map maps;
+       pa_buffer_attr attr;
+
+       int prop_vol_type = 0;
+       int prop_gain_type = VOLUME_GAIN_DEFAULT;
+
+       int err = MM_ERROR_SOUND_INTERNAL;
+       int period_time = PA_SIMPLE_PERIOD_TIME_FOR_MID_LATENCY_MSEC;
+       int samples_per_period = PA_SIMPLE_SAMPLES_PER_PERIOD_DEFAULT;
+       int periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_DEFAULT;
+
+       int handle_mode = mode;
+       int sample_size = 0;
+       pa_proplist *proplist = NULL;
+
+       mm_sound_handle_t *handle = NULL;
+
+       if (ss->channels < MM_SOUND_CHANNEL_MIN || ss->channels > MM_SOUND_CHANNEL_MAX)
+               return MM_ERROR_INVALID_ARGUMENT;
+
+       proplist = pa_proplist_new();
+
+       if (channel_map == NULL) {
+               pa_channel_map_init_auto(&maps, ss->channels, PA_CHANNEL_MAP_ALSA);
+               channel_map = &maps;
+       }
+
+       switch (ss->format) {
+       case PA_SAMPLE_U8:
+               sample_size = 1 * ss->channels;
+               break;
+       case PA_SAMPLE_S16LE:
+               sample_size = 2 * ss->channels;
+               break;
+       default:
+               sample_size = 0;
+               debug_error("Invalid sample size (%d)", sample_size);
+               break;
+       }
+
+       /* Set volume type of stream */
+       if (volume_config > 0) {
+               debug_log("setting gain type");
+               prop_vol_type = 0;      /* not used, set it system(0) temporarily */
+
+               /* Set gain type of stream */
+               prop_gain_type = (volume_config >> 8) & 0x000000FF;
+
+               pa_proplist_setf(proplist, PA_PROP_MEDIA_TIZEN_GAIN_TYPE, "%d", prop_gain_type);
+       }
+
+       if (stream_index != -1) {
+               char stream_index_s[11];
+               debug_msg("Set stream index [%d]", stream_index);
+
+               snprintf(stream_index_s, sizeof(stream_index_s) - 1, "%d", stream_index);
+               debug_msg("stream_index[%d] converted to string[%s]", stream_index, stream_index_s);
+               pa_proplist_sets(proplist, PA_PROP_MEDIA_PARENT_ID, stream_index_s);
+       }
+       /* Set stream type */
+       pa_proplist_sets(proplist, PA_PROP_MEDIA_ROLE, stream_type);
+
+       memset(&attr, '\0', sizeof(attr));
+
+       switch (handle_mode) {
+       case HANDLE_MODE_INPUT:
+               period_time = PA_SIMPLE_PERIOD_TIME_FOR_MID_LATENCY_MSEC;
+               samples_per_period = (ss->rate * period_time) / 1000;
+               periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_DEFAULT;
+               attr.prebuf = 0;
+               attr.minreq = -1;
+               attr.tlength = -1;
+               attr.maxlength = -1;
+               attr.fragsize = samples_per_period * pa_sample_size(ss);
+
+               s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_RECORD, NULL, "CAPTURE", ss, channel_map, &attr,
+                                                                  proplist, &err);
+               break;
+
+       case HANDLE_MODE_INPUT_LOW_LATENCY:
+               period_time = PA_SIMPLE_PERIOD_TIME_FOR_ULOW_LATENCY_MSEC;
+               samples_per_period = (ss->rate * period_time) / 1000;
+               periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_FASTMODE;
+               attr.prebuf = 0;
+               attr.minreq = -1;
+               attr.tlength = -1;
+               attr.maxlength = -1;
+               attr.fragsize = samples_per_period * pa_sample_size(ss);
+
+               s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_RECORD, NULL, "LOW LATENCY CAPTURE", ss, channel_map,
+                                                                  &attr, proplist, &err);
+               break;
+
+       case HANDLE_MODE_INPUT_HIGH_LATENCY:
+               period_time = PA_SIMPLE_PERIOD_TIME_FOR_HIGH_LATENCY_MSEC;
+               samples_per_period = (ss->rate * period_time) / 1000;
+               periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_CAPTURE;
+               attr.prebuf = 0;
+               attr.minreq = -1;
+               attr.tlength = -1;
+               attr.maxlength = -1;
+               attr.fragsize = samples_per_period * pa_sample_size(ss);
+
+               s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_RECORD, NULL, "HIGH LATENCY CAPTURE", ss, channel_map,
+                                                                  &attr, proplist, &err);
+               break;
+
+       case HANDLE_MODE_OUTPUT:
+               period_time = PA_SIMPLE_PERIOD_TIME_FOR_MID_LATENCY_MSEC;
+               samples_per_period = (ss->rate * period_time) / 1000;
+               periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_DEFAULT;
+               attr.prebuf = -1;
+               attr.minreq = -1;
+               attr.tlength = (ss->rate / 10) * pa_sample_size(ss) * ss->channels;
+               attr.maxlength = -1;
+               attr.fragsize = 0;
+
+               s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "PLAYBACK", ss, channel_map, &attr,
+                                                                  proplist, &err);
+               break;
+
+       case HANDLE_MODE_OUTPUT_LOW_LATENCY:
+               period_time = PA_SIMPLE_PERIOD_TIME_FOR_LOW_LATENCY_MSEC;
+               samples_per_period = (ss->rate * period_time) / 1000;
+               periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_FASTMODE;
+               attr.prebuf = (ss->rate / 100) * pa_sample_size(ss) * ss->channels;
+               attr.minreq = -1;
+               attr.tlength = (ss->rate / 10) * pa_sample_size(ss) * ss->channels;
+               attr.maxlength = -1;
+               attr.fragsize = 0;
+               debug_msg("rate(%d), samplesize(%d), ch(%d) format(%d)", ss->rate, pa_sample_size(ss), ss->channels, ss->format);
+
+               debug_msg("prebuf(%d), minreq(%d), tlength(%d), maxlength(%d), fragsize(%d)", attr.prebuf, attr.minreq, attr.tlength,
+                                 attr.maxlength, attr.fragsize);
+
+               s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "LOW LATENCY PLAYBACK", ss,
+                                                                  channel_map, &attr, proplist, &err);
+               break;
+
+       case HANDLE_MODE_OUTPUT_CLOCK:
+               period_time = PA_SIMPLE_PERIOD_TIME_FOR_HIGH_LATENCY_MSEC;
+               samples_per_period = (ss->rate * period_time) / 1000;
+               periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_PLAYBACK;
+               attr.prebuf = -1;
+               attr.minreq = -1;
+               attr.tlength = (uint32_t) - 1;
+               attr.maxlength = -1;
+               attr.fragsize = 0;
+
+               s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "HIGH LATENCY PLAYBACK", ss,
+                                                                  channel_map, &attr, proplist, &err);
+               break;
+
+       case HANDLE_MODE_OUTPUT_VIDEO:  /* low latency playback */
+               period_time = PA_SIMPLE_PERIOD_TIME_FOR_LOW_LATENCY_MSEC;
+               samples_per_period = (ss->rate * period_time) / 1000;
+               periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_VIDEO;
+               attr.prebuf = 4 * (samples_per_period * pa_sample_size(ss));
+               attr.minreq = samples_per_period * pa_sample_size(ss);
+               attr.tlength = periods_per_buffer * samples_per_period * pa_sample_size(ss);
+               attr.maxlength = -1;
+               attr.fragsize = 0;
+
+               s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "LOW LATENCY PLAYBACK", ss,
+                                                                  channel_map, &attr, proplist, &err);
+               break;
+
+       case HANDLE_MODE_OUTPUT_AP_CALL:
 #if defined(_MMFW_I386_ALL_SIMULATOR)
-        debug_msg("Does not support AP call mode at i386 simulator");
-        s = NULL;
+               debug_msg("Does not support AP call mode at i386 simulator");
+               s = NULL;
 #else
-        period_time = PA_SIMPLE_PERIOD_TIME_FOR_VOIP_LATENCY_MSEC;
-        samples_per_period = (ss->rate * period_time) / 1000;
-        periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_VOIP;
-        attr.prebuf = -1;
-        attr.minreq = pa_usec_to_bytes(20*PA_USEC_PER_MSEC, ss);
-        attr.tlength = pa_usec_to_bytes(100*PA_USEC_PER_MSEC, ss);
-        attr.maxlength = -1;
-        attr.fragsize = 0;
-
-        s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "VoIP PLAYBACK", ss, channel_map, &attr, proplist, &err);
+               period_time = PA_SIMPLE_PERIOD_TIME_FOR_VOIP_LATENCY_MSEC;
+               samples_per_period = (ss->rate * period_time) / 1000;
+               periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_VOIP;
+               attr.prebuf = -1;
+               attr.minreq = pa_usec_to_bytes(20 * PA_USEC_PER_MSEC, ss);
+               attr.tlength = pa_usec_to_bytes(100 * PA_USEC_PER_MSEC, ss);
+               attr.maxlength = -1;
+               attr.fragsize = 0;
+
+               s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "VoIP PLAYBACK", ss, channel_map,
+                                                                  &attr, proplist, &err);
 #endif
-        break;
-    case HANDLE_MODE_INPUT_AP_CALL:
+               break;
+       case HANDLE_MODE_INPUT_AP_CALL:
 #if defined(_MMFW_I386_ALL_SIMULATOR)
-        debug_msg("Does not support AP call mode at i386 simulator");
-        s = NULL;
+               debug_msg("Does not support AP call mode at i386 simulator");
+               s = NULL;
 #else
-        period_time = PA_SIMPLE_PERIOD_TIME_FOR_VOIP_LATENCY_MSEC;
-        samples_per_period = (ss->rate * period_time) / 1000;
-        periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_VOIP;
-        attr.prebuf = 0;
-        attr.minreq = -1;
-        attr.tlength = -1;
-        attr.maxlength = -1;
-        attr.fragsize = samples_per_period * pa_sample_size(ss);
-
-        s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_RECORD, NULL, "VoIP CAPTURE", ss, channel_map, &attr, proplist, &err);
+               period_time = PA_SIMPLE_PERIOD_TIME_FOR_VOIP_LATENCY_MSEC;
+               samples_per_period = (ss->rate * period_time) / 1000;
+               periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_VOIP;
+               attr.prebuf = 0;
+               attr.minreq = -1;
+               attr.tlength = -1;
+               attr.maxlength = -1;
+               attr.fragsize = samples_per_period * pa_sample_size(ss);
+
+               s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_RECORD, NULL, "VoIP CAPTURE", ss, channel_map, &attr,
+                                                                  proplist, &err);
 #endif
-        break;
-    default:
-        err = MM_ERROR_SOUND_INTERNAL;
-        goto fail;
-        break;
-    }
-
-    if (!s) {
-        debug_error("Open pulseaudio handle has failed - %s", pa_strerror(err));
-        if (!strncmp(pa_strerror(err), "Access denied by security check",strlen(pa_strerror(err)))) {
-            err = MM_ERROR_SOUND_PERMISSION_DENIED;
-        } else {
-            err = MM_ERROR_SOUND_INTERNAL;
-        }
-        goto fail;
-    }
-
-    handle = (mm_sound_handle_t*)malloc(sizeof(mm_sound_handle_t));
-    memset(handle, 0, sizeof(mm_sound_handle_t));
-    handle->mode = mode;
-    handle->volume_type = prop_vol_type;
-    handle->gain_type = prop_gain_type;
-    handle->rate = ss->rate;
-    handle->channels = ss->channels;
-    handle->s = s;
-    handle->period = samples_per_period * sample_size;
-    *size = handle->period;
-    handle->handle = mm_sound_handle_mgr.handle_count;
-    ATOMIC_INC(&mm_sound_handle_mgr.lock, mm_sound_handle_mgr.handle_count); // 0 is not used
-
-    if (0 > pa_simple_get_stream_index(s, &handle->stream_idx, &err)) {
-        debug_msg("Can not get stream index %s", pa_strerror(err));
-        err = MM_ERROR_SOUND_INTERNAL;
-        goto fail;
-    }
-    mm_sound_handle_mgr.handles = g_list_append(mm_sound_handle_mgr.handles, handle);
-
-    if(handle->handle == 0) {
-        debug_msg("out of range. handle(%d)", handle->handle);
-        goto fail;
-    }
-
-    debug_msg("created handle[%d]. mode(%d), volumetype(%d), gain(%d), rate(%d), channels(%d), format(%d), stream_idx(%d), s(%x), source_type(%d)",
-        handle->handle, handle->mode, handle->volume_type, handle->gain_type,
-        handle->rate, handle->channels, ss->format, handle->stream_idx, handle->s, handle->source_type);
-
-    if (proplist)
-        pa_proplist_free(proplist);
-
-    return handle->handle;
-
-fail:
-    if (proplist)
-        pa_proplist_free(proplist);
-
-    if(handle)
-        free(handle);
-
-    return err;
+               break;
+       default:
+               err = MM_ERROR_SOUND_INTERNAL;
+               goto fail;
+               break;
+       }
+
+       if (!s) {
+               debug_error("Open pulseaudio handle has failed - %s", pa_strerror(err));
+               if (!strncmp(pa_strerror(err), "Access denied by security check", strlen(pa_strerror(err))))
+                       err = MM_ERROR_SOUND_PERMISSION_DENIED;
+               else
+                       err = MM_ERROR_SOUND_INTERNAL;
+               goto fail;
+       }
+
+       handle = (mm_sound_handle_t *) malloc(sizeof(mm_sound_handle_t));
+       memset(handle, 0, sizeof(mm_sound_handle_t));
+       handle->mode = mode;
+       handle->volume_type = prop_vol_type;
+       handle->gain_type = prop_gain_type;
+       handle->rate = ss->rate;
+       handle->channels = ss->channels;
+       handle->s = s;
+       handle->period = samples_per_period * sample_size;
+       *size = handle->period;
+       handle->handle = mm_sound_handle_mgr.handle_count;
+       ATOMIC_INC(&mm_sound_handle_mgr.lock, mm_sound_handle_mgr.handle_count);        // 0 is not used
+
+       if (0 > pa_simple_get_stream_index(s, &handle->stream_idx, &err)) {
+               debug_msg("Can not get stream index %s", pa_strerror(err));
+               err = MM_ERROR_SOUND_INTERNAL;
+               goto fail;
+       }
+       mm_sound_handle_mgr.handles = g_list_append(mm_sound_handle_mgr.handles, handle);
+
+       if (handle->handle == 0) {
+               debug_msg("out of range. handle(%d)", handle->handle);
+               goto fail;
+       }
+
+       debug_msg
+               ("created handle[%d]. mode(%d), volumetype(%d), gain(%d), rate(%d), channels(%d), format(%d), stream_idx(%d), s(%x), source_type(%d)",
+                handle->handle, handle->mode, handle->volume_type, handle->gain_type, handle->rate, handle->channels, ss->format,
+                handle->stream_idx, handle->s, handle->source_type);
+
+       if (proplist)
+               pa_proplist_free(proplist);
+
+       return handle->handle;
+
+ fail:
+       if (proplist)
+               pa_proplist_free(proplist);
+
+       if (handle)
+               free(handle);
+
+       return err;
 
 }
 
 EXPORT_API
-int mm_sound_pa_write(const int handle, voidbuf, const int size)
+int mm_sound_pa_write(const int handle, void *buf, const int size)
 {
-    mm_sound_handle_t* phandle = NULL;
-    int err = MM_ERROR_NONE;
+       mm_sound_handle_t *phandle = NULL;
+       int err = MM_ERROR_NONE;
 
-    if (buf == NULL)
-        return MM_ERROR_INVALID_ARGUMENT;
+       if (buf == NULL)
+               return MM_ERROR_INVALID_ARGUMENT;
 
-    if (size < 0)
-        return MM_ERROR_INVALID_ARGUMENT;
-    else if (size == 0)
-        return MM_ERROR_NONE;
+       if (size < 0)
+               return MM_ERROR_INVALID_ARGUMENT;
+       else if (size == 0)
+               return MM_ERROR_NONE;
 
-    CHECK_HANDLE_RANGE(handle);
-    GET_HANDLE_DATA(phandle, mm_sound_handle_mgr.handles, &handle, __mm_sound_handle_comparefunc);
+       CHECK_HANDLE_RANGE(handle);
+       GET_HANDLE_DATA(phandle, mm_sound_handle_mgr.handles, &handle, __mm_sound_handle_comparefunc);
 
 #ifdef __STREAM_DEBUG__
-    debug_msg("phandle(%x) s(%x), handle(%d), rate(%d), ch(%d) stream_idx(%d), buf(%p), size(%d)",
-        phandle, phandle->s, phandle->handle, phandle->rate, phandle->channels, phandle->stream_idx. buf, size);
+       debug_msg("phandle(%x) s(%x), handle(%d), rate(%d), ch(%d) stream_idx(%d), buf(%p), size(%d)",
+                         phandle, phandle->s, phandle->handle, phandle->rate, phandle->channels, phandle->stream_idx.buf, size);
 #endif
 
-    if(phandle == NULL) {
-        debug_msg("phandle is null");
-        return MM_ERROR_SOUND_INTERNAL;
-    }
+       if (phandle == NULL) {
+               debug_msg("phandle is null");
+               return MM_ERROR_SOUND_INTERNAL;
+       }
 
-    if (0 > pa_simple_write(phandle->s, buf, size, &err)) {
-        debug_error("pa_simple_write() failed with %s", pa_strerror(err));
-        return MM_ERROR_SOUND_INTERNAL;
-    }
+       if (0 > pa_simple_write(phandle->s, buf, size, &err)) {
+               debug_error("pa_simple_write() failed with %s", pa_strerror(err));
+               return MM_ERROR_SOUND_INTERNAL;
+       }
 
-    return size;
+       return size;
 
 }
 
 EXPORT_API
 int mm_sound_pa_close(const int handle)
 {
-    mm_sound_handle_t* phandle = NULL;
-    int err = MM_ERROR_NONE;
+       mm_sound_handle_t *phandle = NULL;
+       int err = MM_ERROR_NONE;
 
-    CHECK_HANDLE_RANGE(handle);
-    GET_HANDLE_DATA(phandle, mm_sound_handle_mgr.handles, &handle, __mm_sound_handle_comparefunc);
-    if(phandle == NULL) {
-        debug_msg("phandle is null");
-        return MM_ERROR_SOUND_INTERNAL;
-    }
+       CHECK_HANDLE_RANGE(handle);
+       GET_HANDLE_DATA(phandle, mm_sound_handle_mgr.handles, &handle, __mm_sound_handle_comparefunc);
+       if (phandle == NULL) {
+               debug_msg("phandle is null");
+               return MM_ERROR_SOUND_INTERNAL;
+       }
 
-    debug_msg("phandle(%x) s(%x), handle(%d), rate(%d), ch(%d) stream_idx(%d)",
-            phandle, phandle->s, phandle->handle, phandle->rate, phandle->channels, phandle->stream_idx);
+       debug_msg("phandle(%x) s(%x), handle(%d), rate(%d), ch(%d) stream_idx(%d)",
+                         phandle, phandle->s, phandle->handle, phandle->rate, phandle->channels, phandle->stream_idx);
 
        switch (phandle->mode) {
        case HANDLE_MODE_OUTPUT:
@@ -458,7 +470,7 @@ int mm_sound_pa_close(const int handle)
        case HANDLE_MODE_OUTPUT_AP_CALL:
        case HANDLE_MODE_OUTPUT_VIDEO:
                if (0 > pa_simple_flush(phandle->s, &err)) {
-            err = MM_ERROR_SOUND_INTERNAL;
+                       err = MM_ERROR_SOUND_INTERNAL;
                        debug_msg("pa_simple_flush() failed with %s", pa_strerror(err));
                }
                break;
@@ -467,36 +479,35 @@ int mm_sound_pa_close(const int handle)
        }
 
        pa_simple_free(phandle->s);
-    phandle->s = NULL;
+       phandle->s = NULL;
 
-    debug_msg("leave: handle[%d] stream_index[%d]", handle, phandle->stream_idx);
+       debug_msg("leave: handle[%d] stream_index[%d]", handle, phandle->stream_idx);
 
-    mm_sound_handle_mgr.handles = g_list_remove(mm_sound_handle_mgr.handles, phandle);
-    if(phandle != NULL) {
-        free(phandle);
-        phandle = NULL;
-    }
+       mm_sound_handle_mgr.handles = g_list_remove(mm_sound_handle_mgr.handles, phandle);
+       if (phandle != NULL) {
+               free(phandle);
+               phandle = NULL;
+       }
 
-    return err;
+       return err;
 
 }
 
 EXPORT_API
 int mm_sound_pa_drain(const int handle)
 {
-    mm_sound_handle_t* phandle = NULL;
-    int err = MM_ERROR_NONE;
+       mm_sound_handle_t *phandle = NULL;
+       int err = MM_ERROR_NONE;
 
        CHECK_HANDLE_RANGE(handle);
-    GET_HANDLE_DATA(phandle, mm_sound_handle_mgr.handles, &handle, __mm_sound_handle_comparefunc);
-    if(phandle == NULL)
-        return MM_ERROR_SOUND_INTERNAL;
+       GET_HANDLE_DATA(phandle, mm_sound_handle_mgr.handles, &handle, __mm_sound_handle_comparefunc);
+       if (phandle == NULL)
+               return MM_ERROR_SOUND_INTERNAL;
 
-    if (0 > pa_simple_drain(phandle->s, &err)) {
+       if (0 > pa_simple_drain(phandle->s, &err)) {
                debug_error("pa_simple_drain() failed with %s", pa_strerror(err));
                err = MM_ERROR_SOUND_INTERNAL;
        }
 
        return err;
 }
-
index 0f551a8d67109940a0995a89b814089fe2ad55ec..95560af27ee34c5acc4cc7c275d8399735886bb6 100644 (file)
@@ -71,9 +71,8 @@ static int _notify_signal_handled(audio_event_t event, uint32_t event_id, uint32
                return MM_ERROR_SOUND_INTERNAL;
        }
 
-       if ((ret = mm_sound_dbus_emit_signal(AUDIO_PROVIDER_AUDIO_CLIENT, AUDIO_EVENT_CLIENT_HANDLED, params))) {
+       if ((ret = mm_sound_dbus_emit_signal(AUDIO_PROVIDER_AUDIO_CLIENT, AUDIO_EVENT_CLIENT_HANDLED, params)))
                debug_error("dbus send signal for client handled failed");
-       }
 
        debug_fleave();
        return ret;
@@ -747,7 +746,7 @@ int mm_sound_proxy_play_tone(int tone, int repeat, int volume, int volume_config
        debug_fenter();
 
        params = g_variant_new("(iiiiiiibsi)", tone, repeat, volume, volume_config, session_type,
-                               session_options, client_pid , _enable_session, stream_type, stream_index);
+                                               session_options, client_pid, _enable_session, stream_type, stream_index);
        if (params) {
                if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_SOUND_SERVER, AUDIO_METHOD_PLAY_DTMF, params, &result)) != MM_ERROR_NONE) {
                        debug_error("dbus play tone failed");
index 6cdec6294334cfdb1c9f1c55e88b08ed04baf877..076d3802ef84681c3b02abea861abd092ae03afa 100644 (file)
@@ -38,7 +38,7 @@ int _MMSoundMgrIpcPlayDTMF(int tone, int repeat, int volume, int volume_config,
                           gboolean enable_session, int *codechandle, char *stream_type, int stream_index);
 int _MMSoundMgrIpcPlayDTMFWithStreamInfo(int tone, int repeat, int volume, int client_pid, int *codechandle, char *stream_type, int stream_index);
 
-int __mm_sound_mgr_ipc_notify_play_file_end (int handle);
+int __mm_sound_mgr_ipc_notify_play_file_end(int handle);
 
 #endif /* __MM_SOUND_MGR_H__ */
 
index 2e637c346523ff54f6d6cf0a9f5a7ae2ac80be12..d239ffbcb580e7e164a515ae2862409abd7f24e0 100644 (file)
 #define __MM_SOUND_PLUGIN_H__
 
 enum {
-    MM_SOUND_PLUGIN_TYPE_NONE = 0,
-    MM_SOUND_PLUGIN_TYPE_CODEC,
-    MM_SOUND_PLUGIN_TYPE_RUN,
-    MM_SOUND_PLUGIN_TYPE_LAST,
+       MM_SOUND_PLUGIN_TYPE_NONE = 0,
+       MM_SOUND_PLUGIN_TYPE_CODEC,
+       MM_SOUND_PLUGIN_TYPE_RUN,
+       MM_SOUND_PLUGIN_TYPE_LAST,
 };
 
 typedef struct {
-    int type;
-    void *module;
+       int type;
+       void *module;
 } MMSoundPluginType;
 
 /* Plugin Interface */
index d26ede6a97ed852a60017e2890f0f8942794651c..2cea7a9a6325929855b67cc3b808d650fbfa8a93 100644 (file)
@@ -61,13 +61,13 @@ typedef struct {
 } mmsound_codec_param_t;
 
 typedef struct {
-    int* (*GetSupportTypes)(void);
-    int (*SetThreadPool) (int (*)(void*, void (*)(void*)));
-    int (*Parse)(const char*, mmsound_codec_info_t*);
-    int (*Create)(mmsound_codec_param_t*, mmsound_codec_info_t*, MMHandleType*);
-    int (*Play)(MMHandleType);
-    int (*Stop)(MMHandleType);
-    int (*Destroy)(MMHandleType);
+       int* (*GetSupportTypes)(void);
+       int (*SetThreadPool) (int (*)(void*, void (*)(void*)));
+       int (*Parse)(const char*, mmsound_codec_info_t*);
+       int (*Create)(mmsound_codec_param_t*, mmsound_codec_info_t*, MMHandleType*);
+       int (*Play)(MMHandleType);
+       int (*Stop)(MMHandleType);
+       int (*Destroy)(MMHandleType);
 } mmsound_codec_interface_t;
 
 /* Utility Functions */
index 24dfa19c7173d8d9f74306b717d3fd6ae4898064..eb31ed967635acd2b2322b4e49642a1d2a9b2c11 100644 (file)
@@ -70,7 +70,7 @@ typedef struct {
        bool stop_by_user;
 
        bool enable_session;
- } __mmsound_mgr_codec_handle_t;
+} __mmsound_mgr_codec_handle_t;
 
 static MMSoundPluginType *g_codec_plugins = NULL;
 static __mmsound_mgr_codec_handle_t g_slots[MANAGER_HANDLE_MAX];
@@ -132,33 +132,33 @@ static void _sound_codec_device_connected_callback(MMSoundDevice_t device, bool
        int result = MM_ERROR_NONE;
        mm_sound_device_type_e type;
 
-       debug_warning ("device_connected_callback called : handle[%p], connected[%d], slotid[%d]", device, is_connected, slotid);
+       debug_warning("device_connected_callback called : handle[%p], connected[%d], slotid[%d]", device, is_connected, slotid);
 
-       if (mm_sound_get_device_type (device, &type) != MM_ERROR_NONE) {
+       if (mm_sound_get_device_type(device, &type) != MM_ERROR_NONE) {
                debug_error("getting device type failed");
                return;
        }
 
        switch (type) {
-               case MM_SOUND_DEVICE_TYPE_AUDIOJACK:
-               case MM_SOUND_DEVICE_TYPE_BLUETOOTH:
-               case MM_SOUND_DEVICE_TYPE_HDMI:
-               case MM_SOUND_DEVICE_TYPE_MIRRORING:
-               case MM_SOUND_DEVICE_TYPE_USB_AUDIO:
-                       if (!is_connected) {
-                               debug_warning("sound device unplugged");
-                               result = MMSoundMgrCodecStop(slotid);
-                               if (result != MM_ERROR_NONE)
-                                       debug_error("MMSoundMgrCodecStop error %d", result);
-
-                               result = mm_sound_remove_device_connected_callback(g_slots[slotid].subs_id);
-                               if (result != MM_ERROR_NONE)
-                                       debug_error("mm_sound_remove_device_connected_callback error %d", result);
-                       }
-                       break;
+       case MM_SOUND_DEVICE_TYPE_AUDIOJACK:
+       case MM_SOUND_DEVICE_TYPE_BLUETOOTH:
+       case MM_SOUND_DEVICE_TYPE_HDMI:
+       case MM_SOUND_DEVICE_TYPE_MIRRORING:
+       case MM_SOUND_DEVICE_TYPE_USB_AUDIO:
+               if (!is_connected) {
+                       debug_warning("sound device unplugged");
+                       result = MMSoundMgrCodecStop(slotid);
+                       if (result != MM_ERROR_NONE)
+                               debug_error("MMSoundMgrCodecStop error %d", result);
+
+                       result = mm_sound_remove_device_connected_callback(g_slots[slotid].subs_id);
+                       if (result != MM_ERROR_NONE)
+                               debug_error("mm_sound_remove_device_connected_callback error %d", result);
+               }
+               break;
 
-               default:
-                       break;
+       default:
+               break;
        }
 }
 #endif
@@ -267,9 +267,8 @@ int MMSoundMgrCodecInit(const char *targetdir, GSourceFunc _shutdown_cb)
 
        MMSoundPluginScan(targetdir, MM_SOUND_PLUGIN_TYPE_CODEC, &g_codec_plugins);
        if (g_codec_plugins) {
-               while (g_codec_plugins[loop].type != MM_SOUND_PLUGIN_TYPE_NONE) {
+               while (g_codec_plugins[loop].type != MM_SOUND_PLUGIN_TYPE_NONE)
                        _MMSoundMgrCodecRegisterInterface(&g_codec_plugins[loop++]);
-               }
        }
 
        if (_shutdown_cb)
@@ -443,9 +442,8 @@ int MMSoundMgrCodecPlay(int *slotid, const mmsound_mgr_codec_param_t *param)
                g_slots[*slotid].status = STATUS_IDLE;
                SLOT_UNLOCK();
 #ifdef FOCUS_INTEGRATION
-               if (param->focus_handle) {
+               if (param->focus_handle)
                        need_focus_unregister = 1;
-               }
 #endif
                goto cleanup;
        }
@@ -455,9 +453,8 @@ int MMSoundMgrCodecPlay(int *slotid, const mmsound_mgr_codec_param_t *param)
                debug_error("Fail to play : 0x%08X", err);
                g_plugins[g_slots[*slotid].pluginid].Destroy(g_slots[*slotid].plughandle);
 #ifdef FOCUS_INTEGRATION
-               if (param->focus_handle) {
+               if (param->focus_handle)
                        need_focus_unregister = 1;
-               }
 #endif
        }
 
@@ -690,12 +687,12 @@ int MMSoundMgrCodecPlayDtmf(int *slotid, const mmsound_mgr_codec_param_t *param)
 #endif
 
        g_slots[*slotid].pluginid = plugin_id;
-       g_slots[*slotid].param    = param->param;               /* This arg is used callback data */
+       g_slots[*slotid].param = param->param;  /* This arg is used callback data */
        g_slots[*slotid].session_type = param->session_type;
        g_slots[*slotid].session_options = param->session_options;
 #ifdef FOCUS_INTEGRATION
-       g_slots[*slotid].focus_handle= param->focus_handle;
-       g_slots[*slotid].focus_wcb_id= param->focus_wcb_id;
+       g_slots[*slotid].focus_handle = param->focus_handle;
+       g_slots[*slotid].focus_wcb_id = param->focus_wcb_id;
 #endif
        g_slots[*slotid].enable_session = param->enable_session;
        g_slots[*slotid].pid = (int)param->param;
@@ -795,8 +792,7 @@ int MMSoundMgrCodecPlayDtmfWithStreamInfo(int *slotid, const mmsound_mgr_codec_p
 #endif
 
        err = _mm_sound_mgr_codec_slot_get_empty(slotid);
-       if (err != MM_ERROR_NONE || *slotid < 0)
-       {
+       if (err != MM_ERROR_NONE || *slotid < 0) {
                debug_error("Empty g_slot is not found");
                goto cleanup;
        }
@@ -853,9 +849,8 @@ int MMSoundMgrCodecStop(const int slotid)
 
        debug_enter("(Slotid : [%d])", slotid);
 
-       if (slotid < 0 || MANAGER_HANDLE_MAX <= slotid) {
+       if (slotid < 0 || MANAGER_HANDLE_MAX <= slotid)
                return MM_ERROR_INVALID_ARGUMENT;
-       }
 
        SLOT_LOCK();
        if (g_slots[slotid].status == STATUS_IDLE) {
@@ -870,9 +865,8 @@ int MMSoundMgrCodecStop(const int slotid)
        g_slots[slotid].stop_by_user = true;
 
        err = g_plugins[g_slots[slotid].pluginid].Stop(g_slots[slotid].plughandle);
-       if (err != MM_ERROR_NONE) {
+       if (err != MM_ERROR_NONE)
                debug_error("Fail to STOP Code : 0x%08X", err);
-       }
 
 cleanup:
        SLOT_UNLOCK();
@@ -897,15 +891,15 @@ int MMSoundMgrCodecClearFocus(int pid)
                                        g_slots[slotid].session_type != MM_SESSION_TYPE_VIDEOCALL &&
                                        g_slots[slotid].session_type != MM_SESSION_TYPE_VOIP &&
                                        g_slots[slotid].session_type != MM_SESSION_TYPE_VOICE_RECOGNITION &&
-                                       g_slots[slotid].enable_session ) {
+                                       g_slots[slotid].enable_session) {
                                        if ((g_slots[slotid].session_options & MM_SESSION_OPTION_PAUSE_OTHERS) ||
                                                g_slots[slotid].session_type == MM_SESSION_TYPE_ALARM ||
                                                g_slots[slotid].session_type == MM_SESSION_TYPE_NOTIFY ||
                                                g_slots[slotid].session_type == MM_SESSION_TYPE_EMERGENCY) {
                                                err = mm_sound_release_focus(g_slots[slotid].focus_handle, FOCUS_FOR_BOTH, NULL);
-                                               if (err) {
+                                               if (err)
                                                        debug_error("mm_sound_release_focus failed [0x%x]", err);
-                                               }
+
                                                if (mm_sound_unregister_focus(g_slots[slotid].focus_handle) || err) {
                                                        debug_error("Focus clean up failed [0x%x]", err);
                                                        err = MM_ERROR_POLICY_INTERNAL;
@@ -942,37 +936,35 @@ static int _MMSoundMgrCodecStopCallback(int param)
        int err = MM_ERROR_NONE;
 
        if (param < 0 || param >= MANAGER_HANDLE_MAX) {
-               debug_error ("Slot index param [%d] is invalid", param);
+               debug_error("Slot index param [%d] is invalid", param);
                return MM_ERROR_INVALID_ARGUMENT;
        }
 
        debug_enter("(Slot : %d) stop-by-user : %d", param, g_slots[param].stop_by_user);
 
-       if (g_slots[param].stop_by_user == false) {
+       if (g_slots[param].stop_by_user == false)
                SLOT_LOCK();
-       }
 
 #ifdef FOCUS_INTEGRATION
        /*
         * Unregister FOCUS here
         */
-       debug_msg("[CODEC MGR] enable_session %d ",g_slots[param].enable_session);
+       debug_msg("[CODEC MGR] enable_session %d ", g_slots[param].enable_session);
 
        if (g_slots[param].focus_handle || g_slots[param].focus_wcb_id) {
                if (g_slots[param].session_type != MM_SESSION_TYPE_CALL &&
                        g_slots[param].session_type != MM_SESSION_TYPE_VIDEOCALL &&
                        g_slots[param].session_type != MM_SESSION_TYPE_VOIP &&
                        g_slots[param].session_type != MM_SESSION_TYPE_VOICE_RECOGNITION &&
-                       g_slots[param].enable_session ) {
+                       g_slots[param].enable_session) {
                        if ((g_slots[param].session_options & MM_SESSION_OPTION_PAUSE_OTHERS) ||
                                g_slots[param].session_type == MM_SESSION_TYPE_ALARM ||
                                g_slots[param].session_type == MM_SESSION_TYPE_NOTIFY ||
                                g_slots[param].session_type == MM_SESSION_TYPE_EMERGENCY) {
                                if (g_slots[param].current_focus_type != FOCUS_NONE) {
                                        err = mm_sound_release_focus(g_slots[param].focus_handle, g_slots[param].current_focus_type, NULL);
-                                       if (err) {
+                                       if (err)
                                                debug_error("mm_sound_release_focus failed [0x%x]", err);
-                                       }
                                }
                                if (mm_sound_unregister_focus(g_slots[param].focus_handle) || err) {
                                        debug_error("Focus clean up failed [0x%x]", err);
@@ -1006,9 +998,8 @@ static int _MMSoundMgrCodecStopCallback(int param)
                _mm_sound_mgr_codec_shutdown_timer_start();
 
 finish:
-       if (g_slots[param].stop_by_user == false) {
+       if (g_slots[param].stop_by_user == false)
                SLOT_UNLOCK();
-       }
 
        debug_fleave();
 
index 91f5862c5453c526c91aa65ec6df96d168e8aa19..f4bd3a8d118c63bced9387bdcb403acb23135164 100644 (file)
        Functions For handling request from client
 ******************************************************************************************/
 // except msgid
-int _MMSoundMgrIpcPlayFile(char* filename,int tone, int repeat, int volume, int volume_config,
-                          int session_type, int session_options, int client_pid, gboolean enable_session,
-                          int *codechandle, char *stream_type, int stream_index)
+int _MMSoundMgrIpcPlayFile(char* filename, int tone, int repeat, int volume, int volume_config,
+                                               int session_type, int session_options, int client_pid, gboolean enable_session,
+                                               int *codechandle, char *stream_type, int stream_index)
 {
-       mmsound_mgr_codec_param_t param = {0,};
+       mmsound_mgr_codec_param_t param = { 0, };
        int ret = MM_ERROR_NONE;
 
        /* Set sound player parameter */
@@ -93,7 +93,7 @@ int _MMSoundMgrIpcClearFocus(int pid)
 int _MMSoundMgrIpcPlayFileWithStreamInfo(char *filename, int repeat, int volume,
                           int client_pid, int *codechandle, char *stream_type, int stream_index)
 {
-       mmsound_mgr_codec_param_t param = {0,};
+       mmsound_mgr_codec_param_t param = { 0, };
        int ret = MM_ERROR_NONE;
 
        /* Set sound player parameter */
@@ -115,10 +115,11 @@ int _MMSoundMgrIpcPlayFileWithStreamInfo(char *filename, int repeat, int volume,
 }
 
 int _MMSoundMgrIpcPlayDTMF(int tone, int repeat, int volume, int volume_config,
-                          int session_type, int session_options, int client_pid,
-                          gboolean enable_session, int *codechandle, char *stream_type, int stream_index)
+                                               int session_type, int session_options, int client_pid,
+                                               gboolean enable_session, int *codechandle,
+                                               char *stream_type, int stream_index)
 {
-       mmsound_mgr_codec_param_t param = {0,};
+       mmsound_mgr_codec_param_t param = { 0, };
        int ret = MM_ERROR_NONE;
 
        /* Set sound player parameter */
@@ -135,14 +136,14 @@ int _MMSoundMgrIpcPlayDTMF(int tone, int repeat, int volume, int volume_config,
 
        debug_msg("DTMF %d", param.tone);
        debug_msg("Loop %d", param.repeat_count);
-       debug_msg("Volume %d",param.volume);
-       debug_msg("VolumeConfig %x",param.volume_config);
+       debug_msg("Volume %d", param.volume);
+       debug_msg("VolumeConfig %x", param.volume_config);
        debug_msg("session %d", param.session_type);
        debug_msg("session options %x", param.session_options);
        debug_msg("enable_session %d", param.enable_session);
 
        ret = MMSoundMgrCodecPlayDtmf(codechandle, &param);
-       if ( ret != MM_ERROR_NONE) {
+       if (ret != MM_ERROR_NONE) {
                debug_error("Will be closed a sources, codec handle : [0x%d]", *codechandle);
                return ret;
        }
@@ -150,9 +151,10 @@ int _MMSoundMgrIpcPlayDTMF(int tone, int repeat, int volume, int volume_config,
        return ret;
 }
 
-int _MMSoundMgrIpcPlayDTMFWithStreamInfo(int tone, int repeat, int volume, int client_pid, int *codechandle, char *stream_type, int stream_index)
+int _MMSoundMgrIpcPlayDTMFWithStreamInfo(int tone, int repeat, int volume, int client_pid, int *codechandle,
+                                                                               char *stream_type, int stream_index)
 {
-       mmsound_mgr_codec_param_t param = {0,};
+       mmsound_mgr_codec_param_t param = { 0, };
        int ret = MM_ERROR_NONE;
 
        /* Set sound player parameter */
@@ -165,13 +167,13 @@ int _MMSoundMgrIpcPlayDTMFWithStreamInfo(int tone, int repeat, int volume, int c
 
        debug_msg("DTMF %d", param.tone);
        debug_msg("Loop %d", param.repeat_count);
-       debug_msg("Volume %d",param.volume);
+       debug_msg("Volume %d", param.volume);
        debug_msg("stream type %s", param.stream_type);
        debug_msg("stream index %d", param.stream_index);
 
 
        ret = MMSoundMgrCodecPlayDtmfWithStreamInfo(codechandle, &param);
-       if ( ret != MM_ERROR_NONE) {
+       if (ret != MM_ERROR_NONE) {
                debug_error("Will be closed a sources, codec handle : [0x%d]", *codechandle);
                return ret;
        }
@@ -183,7 +185,8 @@ int _MMSoundMgrIpcPlayDTMFWithStreamInfo(int tone, int repeat, int volume, int c
        Functions For Server-Side to notify Clients
 ******************************************************************************************/
 
-int __mm_sound_mgr_ipc_notify_play_file_end (int handle) {
-    return __mm_sound_mgr_ipc_dbus_notify_play_file_end(handle);
+int __mm_sound_mgr_ipc_notify_play_file_end(int handle)
+{
+       return __mm_sound_mgr_ipc_dbus_notify_play_file_end(handle);
 }
 
index bd37bc0e324bb8dcbce9a0806d2cf503d561c04a..de4cf0224bc92f2be54b96e425cc6a232b464eb5 100644 (file)
 #define INTERFACE_SOUND_SERVER "org.tizen.SoundServer1"
 
 /* workaround for AF volume gain tuning */
-#define PROC_DBUS_OBJECT       "/Org/Tizen/ResourceD/Process"
-#define PROC_DBUS_INTERFACE    "org.tizen.resourced.process"
-#define PROC_DBUS_METHOD       "ProcExclude"
+#define PROC_DBUS_OBJECT "/Org/Tizen/ResourceD/Process"
+#define PROC_DBUS_INTERFACE "org.tizen.resourced.process"
+#define PROC_DBUS_METHOD "ProcExclude"
 
 /* Introspection data for the service we are exporting */
 static const gchar introspection_xml[] =
-  "<node>"
-  "  <interface name='org.tizen.SoundServer1'>"
-  "    <method name='MethodTest1'>"
-  "      <arg type='i' name='num1' direction='in'/>"
-  "      <arg type='i' name='num2' direction='in'/>"
-  "      <arg type='i' name='multiple' direction='out'/>"
-  "    </method>"
-  "    <method name='GetBTA2DPStatus'>"
-  "      <arg type='b' name='is_bt_on' direction='out'/>"
-  "      <arg type='s' name='bt_name' direction='out'/>"
-  "    </method>"
-  "    <method name='PlayFileStart'>"
-  "      <arg type='s' name='filename' direction='in'/>"
-  "      <arg type='i' name='tone' direction='in'/>"
-  "      <arg type='i' name='repeat' direction='in'/>"
-  "      <arg type='i' name='volume' direction='in'/>"
-  "      <arg type='i' name='vol_config' direction='in'/>"
-  "      <arg type='i' name='session_type' direction='in'/>"
-  "      <arg type='i' name='session_option' direction='in'/>"
-  "      <arg type='i' name='client_pid' direction='in'/>"
-  "      <arg type='b' name='enable_session' direction='in'/>"
-  "      <arg type='s' name='stream_type' direction='in'/>"
-  "      <arg type='i' name='stream_index' direction='in'/>"
-  "      <arg type='i' name='handle' direction='out'/>"
-  "    </method>"
-  "       <method name='PlayFileStartWithStreamInfo'>"
-  "         <arg type='s' name='filename' direction='in'/>"
-  "         <arg type='i' name='repeat' direction='in'/>"
-  "         <arg type='i' name='volume' direction='in'/>"
-  "         <arg type='i' name='client_pid' direction='in'/>"
-  "         <arg type='s' name='stream_type' direction='in'/>"
-  "         <arg type='i' name='stream_index' direction='in'/>"
-  "         <arg type='i' name='handle' direction='out'/>"
-  "       </method>"
-  "    <method name='PlayFileStop'>"
-  "      <arg type='i' name='handle' direction='in'/>"
-  "    </method>"
+       "<node>"
+       "  <interface name='org.tizen.SoundServer1'>"
+       "    <method name='MethodTest1'>"
+       "      <arg type='i' name='num1' direction='in'/>"
+       "      <arg type='i' name='num2' direction='in'/>"
+       "      <arg type='i' name='multiple' direction='out'/>"
+       "    </method>"
+       "    <method name='GetBTA2DPStatus'>"
+       "      <arg type='b' name='is_bt_on' direction='out'/>"
+       "      <arg type='s' name='bt_name' direction='out'/>"
+       "    </method>"
+       "    <method name='PlayFileStart'>"
+       "      <arg type='s' name='filename' direction='in'/>"
+       "      <arg type='i' name='tone' direction='in'/>"
+       "      <arg type='i' name='repeat' direction='in'/>"
+       "      <arg type='i' name='volume' direction='in'/>"
+       "      <arg type='i' name='vol_config' direction='in'/>"
+       "      <arg type='i' name='session_type' direction='in'/>"
+       "      <arg type='i' name='session_option' direction='in'/>"
+       "      <arg type='i' name='client_pid' direction='in'/>"
+       "      <arg type='b' name='enable_session' direction='in'/>"
+       "      <arg type='s' name='stream_type' direction='in'/>"
+       "      <arg type='i' name='stream_index' direction='in'/>"
+       "      <arg type='i' name='handle' direction='out'/>"
+       "    </method>"
+       "          <method name='PlayFileStartWithStreamInfo'>"
+       "            <arg type='s' name='filename' direction='in'/>"
+       "            <arg type='i' name='repeat' direction='in'/>"
+       "            <arg type='i' name='volume' direction='in'/>"
+       "            <arg type='i' name='client_pid' direction='in'/>"
+       "            <arg type='s' name='stream_type' direction='in'/>"
+       "            <arg type='i' name='stream_index' direction='in'/>"
+       "            <arg type='i' name='handle' direction='out'/>"
+       "          </method>"
+       "    <method name='PlayFileStop'>"
+       "      <arg type='i' name='handle' direction='in'/>"
+       "    </method>"
 #ifdef FOCUS_INTEGRATION
-  "    <method name='ClearFocus'>"
-  "      <arg type='i' name='pid' direction='in'/>"
-  "    </method>"
+       "    <method name='ClearFocus'>"
+       "      <arg type='i' name='pid' direction='in'/>"
+       "    </method>"
 #endif
-  "    <method name='PlayDTMF'>"
-  "      <arg type='i' name='tone' direction='in'/>"
-  "      <arg type='i' name='repeat' direction='in'/>"
-  "      <arg type='i' name='volume' direction='in'/>"
-  "      <arg type='i' name='vol_config' direction='in'/>"
-  "      <arg type='i' name='session_type' direction='in'/>"
-  "      <arg type='i' name='session_option' direction='in'/>"
-  "      <arg type='i' name='client_pid' direction='in'/>"
-  "      <arg type='b' name='enable_session' direction='in'/>"
-  "         <arg type='s' name='stream_type' direction='in'/>"
-  "         <arg type='i' name='stream_index' direction='in'/>"
-  "      <arg type='i' name='handle' direction='out'/>"
-  "    </method>"
-  "       <method name='PlayDTMFWithStreamInfo'>"
-  "         <arg type='i' name='tone' direction='in'/>"
-  "         <arg type='i' name='repeat' direction='in'/>"
-  "         <arg type='i' name='volume' direction='in'/>"
-  "         <arg type='i' name='client_pid' direction='in'/>"
-  "         <arg type='s' name='stream_type' direction='in'/>"
-  "         <arg type='i' name='stream_index' direction='in'/>"
-  "         <arg type='i' name='handle' direction='out'/>"
-  "       </method>"
-  "    <method name='GetConnectedDeviceList'>"
-  "      <arg type='i' name='device_mask' direction='in'/>"
-  "      <arg type='a(iiiis)' name='device_list' direction='out'/>"
-  "    </method>"
-  "  </interface>"
-  "</node>";
+       "    <method name='PlayDTMF'>"
+       "      <arg type='i' name='tone' direction='in'/>"
+       "      <arg type='i' name='repeat' direction='in'/>"
+       "      <arg type='i' name='volume' direction='in'/>"
+       "      <arg type='i' name='vol_config' direction='in'/>"
+       "      <arg type='i' name='session_type' direction='in'/>"
+       "      <arg type='i' name='session_option' direction='in'/>"
+       "      <arg type='i' name='client_pid' direction='in'/>"
+       "      <arg type='b' name='enable_session' direction='in'/>"
+       "            <arg type='s' name='stream_type' direction='in'/>"
+       "            <arg type='i' name='stream_index' direction='in'/>"
+       "      <arg type='i' name='handle' direction='out'/>"
+       "    </method>"
+       "          <method name='PlayDTMFWithStreamInfo'>"
+       "            <arg type='i' name='tone' direction='in'/>"
+       "            <arg type='i' name='repeat' direction='in'/>"
+       "            <arg type='i' name='volume' direction='in'/>"
+       "            <arg type='i' name='client_pid' direction='in'/>"
+       "            <arg type='s' name='stream_type' direction='in'/>"
+       "            <arg type='i' name='stream_index' direction='in'/>"
+       "            <arg type='i' name='handle' direction='out'/>"
+       "          </method>"
+       "    <method name='GetConnectedDeviceList'>"
+       "      <arg type='i' name='device_mask' direction='in'/>"
+       "      <arg type='a(iiiis)' name='device_list' direction='out'/>"
+       "    </method>"
+       "  </interface>"
+       "</node>";
 static GDBusConnection* conn_g;
 
 static void handle_method_play_file_start(GDBusMethodInvocation* invocation);
@@ -159,12 +159,11 @@ static GDBusNodeInfo *introspection_data = NULL;
 guint sound_server_owner_id ;
 
 /*
-        For pass error code with 'g_dbus_method_invocation_return_error'
-        We have to use some glib features like GError, GQuark
+               For pass error code with 'g_dbus_method_invocation_return_error'
+               We have to use some glib features like GError, GQuark
 */
 /* Only For error types which is currently being used in server-side */
-static const GDBusErrorEntry mm_sound_error_entries[] =
-{
+static const GDBusErrorEntry mm_sound_error_entries[] = {
        {MM_ERROR_OUT_OF_MEMORY, "org.tizen.multimedia.OutOfMemory"},
        {MM_ERROR_OUT_OF_STORAGE, "org.tizen.multimedia.OutOfStorage"},
        {MM_ERROR_INVALID_ARGUMENT, "org.tizen.multimedia.InvalidArgument"},
@@ -191,9 +190,8 @@ static const char* _convert_error_code(int err_code)
        int i = 0;
 
        for (i = 0; i < G_N_ELEMENTS(mm_sound_error_entries); i++) {
-               if (err_code == mm_sound_error_entries[i].error_code) {
+               if (err_code == mm_sound_error_entries[i].error_code)
                        return mm_sound_error_entries[i].dbus_error_name;
-               }
        }
 
        return "org.tizen.multimedia.common.Unknown";
@@ -201,7 +199,7 @@ static const char* _convert_error_code(int err_code)
 
 static int mm_sound_mgr_ipc_dbus_send_signal(audio_event_t event, GVariant *parameter)
 {
-       if(mm_sound_dbus_emit_signal(AUDIO_PROVIDER_SOUND_SERVER, event, parameter) != MM_ERROR_NONE) {
+       if (mm_sound_dbus_emit_signal(AUDIO_PROVIDER_SOUND_SERVER, event, parameter) != MM_ERROR_NONE) {
                debug_error("Sound Server Emit signal failed");
                return MM_ERROR_SOUND_INTERNAL;
        }
@@ -267,11 +265,10 @@ static void handle_method_test(GDBusMethodInvocation* invocation)
        g_variant_get(params, "(ii)", &val, &val2);
        debug_log("Got value : %d , %d", val, val2);
 
-       if ((ret = mm_sound_mgr_ipc_dbus_send_signal(AUDIO_EVENT_TEST, g_variant_new("(i)", val+val2))) != MM_ERROR_NONE) {
+       if ((ret = mm_sound_mgr_ipc_dbus_send_signal(AUDIO_EVENT_TEST, g_variant_new("(i)", val+val2))) != MM_ERROR_NONE)
                debug_error("signal send error : %X", ret);
-       } else {
+       else
                debug_error("signal send success");
-       }
 
 send_reply:
        if (ret == MM_ERROR_NONE) {
@@ -303,22 +300,21 @@ static void handle_method_play_file_start(GDBusMethodInvocation* invocation)
        }
 
        g_variant_get(params, "(siiiiiiibsi)", &filename, &tone, &repeat, &volume,
-                     &vol_config, &session_type, &session_option, &pid, &enable_session, &stream_type, &stream_index);
+                               &vol_config, &session_type, &session_option, &pid, &enable_session, &stream_type, &stream_index);
        if (!filename) {
-           debug_error("filename null");
-           ret = MM_ERROR_SOUND_INTERNAL;
-           goto send_reply;
+               debug_error("filename null");
+               ret = MM_ERROR_SOUND_INTERNAL;
+               goto send_reply;
        }
        ret = _MMSoundMgrIpcPlayFile(filename, tone, repeat, volume, vol_config,
                                session_type, session_option, _get_sender_pid(invocation), enable_session, &slotid, stream_type, stream_index);
 
 
 send_reply:
-       if (ret == MM_ERROR_NONE) {
+       if (ret == MM_ERROR_NONE)
                _method_call_return_value(invocation, g_variant_new("(i)", slotid));
-       } else {
+       else
                _method_call_return_error(invocation, ret);
-       }
 
        g_free(filename);
        g_free(stream_type);
@@ -344,19 +340,18 @@ static void handle_method_play_file_start_with_stream_info(GDBusMethodInvocation
 
        g_variant_get(params, "(siiisi)", &filename, &repeat, &volume, &pid, &stream_type, &stream_index);
        if (!filename) {
-           debug_error("filename null");
-           ret = MM_ERROR_SOUND_INTERNAL;
-           goto send_reply;
+               debug_error("filename null");
+               ret = MM_ERROR_SOUND_INTERNAL;
+               goto send_reply;
        }
        ret = _MMSoundMgrIpcPlayFileWithStreamInfo(filename, repeat, volume, _get_sender_pid(invocation),
-                   &slotid, stream_type, stream_index);
+                                                                                       &slotid, stream_type, stream_index);
 
 send_reply:
-       if (ret == MM_ERROR_NONE) {
+       if (ret == MM_ERROR_NONE)
                _method_call_return_value(invocation, g_variant_new("(i)", slotid));
-       } else {
+       else
                _method_call_return_error(invocation, ret);
-       }
 
        g_free(filename);
        g_free(stream_type);
@@ -381,17 +376,17 @@ static void handle_method_play_dtmf(GDBusMethodInvocation* invocation)
        }
 
        g_variant_get(params, "(iiiiiiibsi)", &tone, &repeat, &volume,
-                     &vol_config, &session_type, &session_option, &pid, &enable_session, &stream_type, &stream_index);
+                               &vol_config, &session_type, &session_option, &pid, &enable_session, &stream_type, &stream_index);
        debug_error("volume - %d", volume);
        ret = _MMSoundMgrIpcPlayDTMF(tone, repeat, volume, vol_config,
-                                    session_type, session_option, _get_sender_pid(invocation), enable_session, &slotid, stream_type, stream_index);
+                                                               session_type, session_option, _get_sender_pid(invocation),
+                                                               enable_session, &slotid, stream_type, stream_index);
 
 send_reply:
-       if (ret == MM_ERROR_NONE) {
+       if (ret == MM_ERROR_NONE)
                _method_call_return_value(invocation, g_variant_new("(i)", slotid));
-       } else {
+       else
                _method_call_return_error(invocation, ret);
-       }
 
        g_free(stream_type);
 
@@ -417,11 +412,10 @@ static void handle_method_play_dtmf_with_stream_info(GDBusMethodInvocation* invo
        ret = _MMSoundMgrIpcPlayDTMFWithStreamInfo(tone, repeat, volume, _get_sender_pid(invocation), &slotid, stream_type, stream_index);
 
 send_reply:
-       if (ret == MM_ERROR_NONE) {
+       if (ret == MM_ERROR_NONE)
                _method_call_return_value(invocation, g_variant_new("(i)", slotid));
-       } else {
+       else
                _method_call_return_error(invocation, ret);
-       }
 
        debug_fleave();
 }
@@ -444,11 +438,10 @@ static void handle_method_play_file_stop(GDBusMethodInvocation* invocation)
        ret = _MMSoundMgrIpcStop(handle);
 
 send_reply:
-       if (ret == MM_ERROR_NONE) {
+       if (ret == MM_ERROR_NONE)
                _method_call_return_value(invocation, g_variant_new("()"));
-       } else {
+       else
                _method_call_return_error(invocation, ret);
-       }
 
        debug_fleave();
 }
@@ -472,11 +465,10 @@ static void handle_method_clear_focus(GDBusMethodInvocation* invocation)
        ret = _MMSoundMgrIpcClearFocus(pid);
 
 send_reply:
-       if (ret == MM_ERROR_NONE) {
+       if (ret == MM_ERROR_NONE)
                _method_call_return_value(invocation, g_variant_new("()"));
-       } else {
+       else
                _method_call_return_error(invocation, ret);
-       }
 
        debug_fleave();
 }
@@ -500,9 +492,8 @@ static void handle_method_call(GDBusConnection *connection,
        debug_log("Method Call, obj : %s, intf : %s, method : %s", object_path, interface_name, method_name);
 
        for (method_idx = 0; method_idx < AUDIO_METHOD_MAX; method_idx++) {
-               if (!g_strcmp0(method_name, methods[method_idx].info.name)) {
+               if (!g_strcmp0(method_name, methods[method_idx].info.name))
                        methods[method_idx].handler(invocation);
-               }
        }
 }
 
@@ -532,8 +523,7 @@ static gboolean handle_set_property(GDBusConnection *connection,
        return TRUE;
 }
 
-static const GDBusInterfaceVTable interface_vtable =
-{
+static const GDBusInterfaceVTable interface_vtable = {
        handle_method_call,
        handle_get_property,
        handle_set_property
@@ -592,9 +582,8 @@ static int _mm_sound_mgr_dbus_own_name(GBusType bus_type, const char* wellknown_
 static void _mm_sound_mgr_dbus_unown_name(guint oid)
 {
        debug_log("Unown name for Sound-Server [%d]", oid);
-       if (oid > 0) {
+       if (oid > 0)
                g_bus_unown_name(oid);
-       }
 }
 
 int __mm_sound_mgr_ipc_dbus_notify_play_file_end(int handle)
@@ -606,9 +595,8 @@ int __mm_sound_mgr_ipc_dbus_notify_play_file_end(int handle)
 
        param = g_variant_new("(i)", handle);
        if (param) {
-               if ((ret = mm_sound_mgr_ipc_dbus_send_signal(AUDIO_EVENT_PLAY_FILE_END, param)) != MM_ERROR_NONE) {
+               if ((ret = mm_sound_mgr_ipc_dbus_send_signal(AUDIO_EVENT_PLAY_FILE_END, param)) != MM_ERROR_NONE)
                        debug_error("Send play file end for '%d' failed", handle);
-               }
        } else {
                debug_error("Build variant for dbus param failed");
        }
index 2e7f0828f451a9859c547e0db93900573b23e653..e56ec80ad15c95cd1e90b2f88d1f7fa2da8a2192 100644 (file)
 #include <mm_debug.h>
 
 static char* __strcatdup(const char *str1, const char *str2, const char *str3);
-static int _MMSoundPluginGetList(const char *plugdir ,char ***list);
+static int _MMSoundPluginGetList(const char *plugdirchar ***list);
 static int _MMSoundPluginDestroyList(char **list);
 
 int MMSoundPluginScan(const char *plugindir, const int type, MMSoundPluginType **pluginlist)
 {
-    char **list = NULL;
-    int err = MM_ERROR_NONE;
-    char *item = NULL;
-    int index = 0;
-    MMSoundPluginType plugin[100];
-    int plugin_index = 0;
-
-    debug_fenter ();
-
-    debug_msg(" Plugin dir :: %s ", plugindir);
-    err = _MMSoundPluginGetList(plugindir, &list);
-    if (err != MM_ERROR_NONE)
-        return err;
-
-    while((item = list[index++]) != NULL) {
-        if(MMSoundPluginOpen(item, &plugin[plugin_index]) != MM_ERROR_NONE) {
-            debug_warning("%s is not sound plugin", item);
-            continue;
-        }
-        if (plugin[plugin_index].type != type)
-            MMSoundPluginClose(&plugin[plugin_index]);
-        else
-            plugin_index++;
-    }
-
-    _MMSoundPluginDestroyList(list);
-
-    *pluginlist = (MMSoundPluginType*) malloc(sizeof(MMSoundPluginType) * (plugin_index+1));
-    if ((*pluginlist) == NULL) {
-        debug_critical("Memory allocation fail");
-        /* Occur segmentation fault */
-        *pluginlist = (void*)1;
-    }
-
-    memcpy(*pluginlist, plugin, sizeof(MMSoundPluginType) * (plugin_index+1));
-    /* Marking end of array */
-    (*pluginlist)[plugin_index].type = MM_SOUND_PLUGIN_TYPE_NONE;
-    (*pluginlist)[plugin_index].module = NULL;
-
-    debug_fleave ();
-
-    return MM_ERROR_NONE;
+       char **list = NULL;
+       int err = MM_ERROR_NONE;
+       char *item = NULL;
+       int index = 0;
+       MMSoundPluginType plugin[100];
+       int plugin_index = 0;
+
+       debug_fenter();
+
+       debug_msg(" Plugin dir :: %s ", plugindir);
+       err = _MMSoundPluginGetList(plugindir, &list);
+       if (err != MM_ERROR_NONE)
+               return err;
+
+       while ((item = list[index++]) != NULL) {
+               if (MMSoundPluginOpen(item, &plugin[plugin_index]) != MM_ERROR_NONE) {
+                       debug_warning("%s is not sound plugin", item);
+                       continue;
+               }
+               if (plugin[plugin_index].type != type)
+                       MMSoundPluginClose(&plugin[plugin_index]);
+               else
+                       plugin_index++;
+       }
+
+       _MMSoundPluginDestroyList(list);
+
+       *pluginlist = (MMSoundPluginType*) malloc(sizeof(MMSoundPluginType) * (plugin_index+1));
+       if ((*pluginlist) == NULL) {
+               debug_critical("Memory allocation fail");
+               /* Occur segmentation fault */
+               *pluginlist = (void*)1;
+       }
+
+       memcpy(*pluginlist, plugin, sizeof(MMSoundPluginType) * (plugin_index+1));
+       /* Marking end of array */
+       (*pluginlist)[plugin_index].type = MM_SOUND_PLUGIN_TYPE_NONE;
+       (*pluginlist)[plugin_index].module = NULL;
+
+       debug_fleave();
+
+       return MM_ERROR_NONE;
 }
 
 int MMSoundPluginRelease(MMSoundPluginType *pluginlist)
 {
-    int loop = 0;
+       int loop = 0;
 
-    debug_fenter ();
+       debug_fenter();
 
-    while (pluginlist[loop].type != MM_SOUND_PLUGIN_TYPE_NONE) {
-        MMSoundPluginClose(&pluginlist[loop++]);
-    }
+       while (pluginlist[loop].type != MM_SOUND_PLUGIN_TYPE_NONE)
+               MMSoundPluginClose(&pluginlist[loop++]);
 
-    free (pluginlist);
+       free(pluginlist);
 
-    debug_fleave ();
+       debug_fleave();
 
-    return MM_ERROR_NONE;
+       return MM_ERROR_NONE;
 }
 
 int MMSoundPluginOpen(char *file, MMSoundPluginType *plugin)
 {
-    void *pdll = NULL;
-    int (*func)(void) = NULL;
-    int t = -1;
-
-    debug_fenter ();
-
-    pdll = dlopen(file, RTLD_NOW|RTLD_GLOBAL);
-
-    if (pdll == NULL) {
-        debug_error("%s", dlerror());
-        return MM_ERROR_SOUND_INVALID_FILE;
-    }
-
-    func = (int (*)(void))dlsym(pdll, "MMSoundGetPluginType");
-    if (func == NULL) {
-        dlclose(pdll);
-        debug_error("Cannot find symbol : MMSoundGetPluginType");
-        return MM_ERROR_SOUND_INVALID_FILE;
-    }
-    t = func();
-
-    debug_msg("%s is %s", file,
-                t == MM_SOUND_PLUGIN_TYPE_CODEC ? "CODEC":
-                t == MM_SOUND_PLUGIN_TYPE_RUN ? "RUN" : "Unknown");
-    switch(t)
-    {
-        case MM_SOUND_PLUGIN_TYPE_CODEC:
-        case MM_SOUND_PLUGIN_TYPE_RUN:
-            plugin->type = t;
-            plugin->module = pdll;
-            break;
-        default:
-            debug_error("Type is %d",t);
-            dlclose(pdll);
-            return MM_ERROR_SOUND_INVALID_FILE;
-    }
-
-    debug_fleave ();
-
-    return MM_ERROR_NONE;
+       void *pdll = NULL;
+       int (*func)(void) = NULL;
+       int t = -1;
+
+       debug_fenter();
+
+       pdll = dlopen(file, RTLD_NOW | RTLD_GLOBAL);
+
+       if (pdll == NULL) {
+               debug_error("%s", dlerror());
+               return MM_ERROR_SOUND_INVALID_FILE;
+       }
+
+       func = (int (*)(void))dlsym(pdll, "MMSoundGetPluginType");
+       if (func == NULL) {
+               dlclose(pdll);
+               debug_error("Cannot find symbol : MMSoundGetPluginType");
+               return MM_ERROR_SOUND_INVALID_FILE;
+       }
+       t = func();
+
+       debug_msg("%s is %s", file,
+                       t == MM_SOUND_PLUGIN_TYPE_CODEC ? "CODEC" :
+                       t == MM_SOUND_PLUGIN_TYPE_RUN ? "RUN" : "Unknown");
+       switch (t) {
+       case MM_SOUND_PLUGIN_TYPE_CODEC:
+       case MM_SOUND_PLUGIN_TYPE_RUN:
+               plugin->type = t;
+               plugin->module = pdll;
+               break;
+       default:
+               debug_error("Type is %d", t);
+               dlclose(pdll);
+               return MM_ERROR_SOUND_INVALID_FILE;
+       }
+
+       debug_fleave();
+
+       return MM_ERROR_NONE;
 }
 
 int MMSoundPluginClose(MMSoundPluginType *plugin)
 {
-       debug_fenter ();
+       debug_fenter();
 
-    if(plugin->module)
-        dlclose(plugin->module);
-    plugin->type = MM_SOUND_PLUGIN_TYPE_NONE;
-    plugin->module = NULL;
+       if (plugin->module)
+               dlclose(plugin->module);
+       plugin->type = MM_SOUND_PLUGIN_TYPE_NONE;
+       plugin->module = NULL;
 
-    debug_fleave ();
-    return MM_ERROR_NONE;
+       debug_fleave();
+       return MM_ERROR_NONE;
 }
 
 int MMSoundPluginGetSymbol(MMSoundPluginType *plugin, const char *symbol, void **func)
 {
-    void *fn = NULL;
+       void *fn = NULL;
 
-    debug_fenter ();
+       debug_fenter();
 
-    if (plugin->module == NULL)
-        return MM_ERROR_SOUND_INVALID_FILE;
-    fn = dlsym(plugin->module, symbol);
-    if (fn == NULL)
-        return MM_ERROR_SOUND_INVALID_FILE;
-    *func = fn;
+       if (plugin->module == NULL)
+               return MM_ERROR_SOUND_INVALID_FILE;
+       fn = dlsym(plugin->module, symbol);
+       if (fn == NULL)
+               return MM_ERROR_SOUND_INVALID_FILE;
+       *func = fn;
 
-    debug_fleave ();
-    return MM_ERROR_NONE;
+       debug_fleave();
+       return MM_ERROR_NONE;
 }
 #define MAX_PATH_SIZE 256
-static int _MMSoundPluginGetList(const char *plugdir ,char ***list)
+static int _MMSoundPluginGetList(const char *plugdirchar ***list)
 {
        struct dirent **entry = NULL;
        int items;
@@ -190,15 +188,15 @@ static int _MMSoundPluginGetList(const char *plugdir ,char ***list)
                return MM_ERROR_INVALID_ARGUMENT;
 
        temp = (char **)malloc(sizeof(char *) * (items + 1));
-       if(!temp) {
+       if (!temp) {
                ret = MM_ERROR_OUT_OF_MEMORY;
                goto free_entry;
        }
        memset(temp, 0, sizeof(char*) * (items + 1));
        memset(curdir, '\0', sizeof(curdir));
-       if(NULL == getcwd(curdir, sizeof(curdir)-1)) {
+       if (NULL == getcwd(curdir, sizeof(curdir)-1)) {
                if (temp) {
-                       free (temp);
+                       free(temp);
                        temp = NULL;
                }
                ret = MM_ERROR_OUT_OF_STORAGE;
@@ -208,15 +206,15 @@ static int _MMSoundPluginGetList(const char *plugdir ,char ***list)
        if (chdir(plugdir) != 0) {
                debug_error("chdir error");
                if (temp) {
-                       free (temp);
+                       free(temp);
                        temp = NULL;
                }
                ret = MM_ERROR_INVALID_ARGUMENT;
                goto free_entry;
        }
 
-       for(item_idx = items; item_idx--; ) {
-               if(stat(entry[item_idx]->d_name, &finfo) < 0) {
+       for (item_idx = items; item_idx--; ) {
+               if (stat(entry[item_idx]->d_name, &finfo) < 0) {
                        debug_error("Stat error");
                        if (temp) {
                                free(temp);
@@ -228,15 +226,13 @@ static int _MMSoundPluginGetList(const char *plugdir ,char ***list)
 
                debug_log("item %d is %s", item_idx, entry[item_idx]->d_name);
 
-               if (S_ISREG(finfo.st_mode)) {
+               if (S_ISREG(finfo.st_mode))
                        temp[tn++] = __strcatdup(plugdir, "/", entry[item_idx]->d_name);
-               }
        }
        *list =  temp;
 free_entry:
-       for(item_idx = 0; item_idx < items; item_idx++) {
+       for (item_idx = 0; item_idx < items; item_idx++)
                free(entry[item_idx]);
-       }
        free(entry);
        return ret;
 }
@@ -244,23 +240,22 @@ free_entry:
 static int _MMSoundPluginDestroyList(char **list)
 {
        int tn = 0;
-       while(list[tn]) {
+       while (list[tn])
                free(list[tn++]);
-       }
-       free (list);
+       free(list);
        return MM_ERROR_NONE;
 }
 
 static char* __strcatdup(const char *str1, const char *str2, const char *str3)
 {
-    char *dest = NULL;
-    int len = 0;
-    len = strlen(str1) + strlen(str2) + strlen(str3) + 1;
-    dest = (char*) malloc(len*sizeof(char));
-    if (!dest)
-        return NULL;
-    strncpy(dest, str1, len-1);
-    strncat(dest, str2, len-strlen(dest)-1);
-    strncat(dest, str3, len-strlen(dest)-1);
-    return dest;
+       char *dest = NULL;
+       int len = 0;
+       len = strlen(str1) + strlen(str2) + strlen(str3) + 1;
+       dest = (char*) malloc(len*sizeof(char));
+       if (!dest)
+               return NULL;
+       strncpy(dest, str1, len-1);
+       strncat(dest, str2, len-strlen(dest)-1);
+       strncat(dest, str3, len-strlen(dest)-1);
+       return dest;
 }
index 5489d79919e1e47dc1d41f0f60c4c28e88a9b2a9..09ddc6a1108ae655206d047ff3e2097378b5596e 100644 (file)
 #define USE_SYSTEM_SERVER_PROCESS_MONITORING
 
 typedef struct {
-    char plugdir[MAX_PLUGIN_DIR_PATH_LEN];
-    int startserver;
-    int printlist;
-    int testmode;
+       char plugdir[MAX_PLUGIN_DIR_PATH_LEN];
+       int startserver;
+       int printlist;
+       int testmode;
 } server_arg;
 
 static int _get_option(int argc, char **argv, server_arg *arg);
@@ -131,7 +131,7 @@ static int _get_option(int argc, char **argv, server_arg *arg)
 //__attribute__ ((destructor))
 static void _exit_handler(int sig)
 {
-       switch(sig) {
+       switch (sig) {
        case SIGINT:
                sigaction(SIGINT, &sigint_action, NULL);
                debug_error("signal(SIGINT) error");
@@ -187,7 +187,7 @@ int main(int argc, char **argv)
        /* Daemon process create */
        if (!serveropt.testmode && serveropt.startserver) {
 #if !defined(USE_SYSTEM_SERVER_PROCESS_MONITORING)
-               daemon(0,0); //chdir to ("/"), and close stdio
+               daemon(0, 0); //chdir to ("/"), and close stdio
 #endif
        }
 
index 02e2e74b66b646bd9cda9ef4ef7e0fc25562d1ce..3a07bd6224237c6f29af26559b2f08556bc35c0e 100644 (file)
@@ -33,8 +33,7 @@ GThreadPool *g_pool;
 
 #define MAX_UNUSED_THREADS_IN_THREADPOOL       10
 
-typedef struct __THREAD_INFO
-{
+typedef struct __THREAD_INFO {
        void (*func)(gpointer data);
        void *param;
 } THREAD_INFO;
@@ -58,7 +57,7 @@ static void __ThreadWork(gpointer data, gpointer user_data)
 
                /* Info was allocated by MMSoundThreadPoolRun().
                        The actual content of info should be  freed whether inside func or outside (if handle) */
-               debug_log ("free [%p]", info);
+               debug_log("free [%p]", info);
                free(info);
                info = NULL;
        } else {
@@ -75,12 +74,12 @@ int MMSoundThreadPoolDump(int fulldump)
 
        if (fulldump) {
                debug_log("##### [ThreadPool] max threads=[%d], max unused=[%d], max idle time=[%d]",
-                               g_thread_pool_get_max_threads (g_pool),
+                               g_thread_pool_get_max_threads(g_pool),
                                g_thread_pool_get_max_unused_threads(),
                                g_thread_pool_get_max_idle_time());
        }
        debug_log("***** [ThreadPool] running=[%d], unused=[%d]",
-                       g_thread_pool_get_num_threads (g_pool),
+                       g_thread_pool_get_num_threads(g_pool),
                        g_thread_pool_get_num_unused_threads());
 
        return MM_ERROR_NONE;
@@ -88,7 +87,7 @@ int MMSoundThreadPoolDump(int fulldump)
 
 int MMSoundThreadPoolInit()
 {
-       int i=0;
+       int i = 0;
        GError *error = NULL;
 
        debug_enter();
@@ -97,24 +96,23 @@ int MMSoundThreadPoolInit()
        g_pool = g_thread_pool_new(__ThreadWork, NULL, -1, FALSE, &error);
        if (g_pool == NULL && error != NULL) {
                debug_error("thread pool created failed : %s", error->message);
-               g_error_free (error);
+               g_error_free(error);
                return MM_ERROR_SOUND_INTERNAL;
        }
-       debug_msg ("thread pool created successfully");
+       debug_msg("thread pool created successfully");
 
        MMSoundThreadPoolDump(TRUE);
 
        /* Thread pool setting : this will maintain at least 10 unused threads and this will be reused. */
        /* If no unused thread left, new thread will be created, but always maintain 10 unused thread */
-       debug_msg ("thread pool set max unused threads to %d", MAX_UNUSED_THREADS_IN_THREADPOOL);
+       debug_msg("thread pool set max unused threads to %d", MAX_UNUSED_THREADS_IN_THREADPOOL);
        g_thread_pool_set_max_unused_threads(MAX_UNUSED_THREADS_IN_THREADPOOL);
 
        /* To reserve unused threads, let's start some threads for beginning
                his dummy thread will be remained unused as soon as it started */
        debug_msg("run threads to reserve minimum thread");
-       for (i = 0; i < MAX_UNUSED_THREADS_IN_THREADPOOL; i++) {
+       for (i = 0; i < MAX_UNUSED_THREADS_IN_THREADPOOL; i++)
                MMSoundThreadPoolRun((void *)i, __DummyWork);
-       }
 
        MMSoundThreadPoolDump(TRUE);
 
index 78c47c2d8b463dc0642fb9f4bda4411be2bacb67..7557ab88bc132c877b1b876a72702437d8fea108 100644 (file)
@@ -86,28 +86,27 @@ typedef struct {
 #endif
 
 typedef struct {
-     /* AMR Buffer */
-       int                             size; /* sizeof hole amr data */
-       pthread_mutex_t         mutex;
-
-     /* Audio Infomations */
-       int                             handle;
-
-     /* control Informations */
-       int                             repeat_count;
-       int                             (*stop_cb)(int);
-       int                             cb_param;
-       int                             state;
-       int                             number;
-       double                  volume;
-       int                             time;
-       int                             pid;
-
-       int                             thread_state;
+       /* AMR Buffer */
+       int size; /* sizeof hole amr data */
+       pthread_mutex_t mutex;
+
+       /* Audio Infomations */
+       int handle;
+
+       /* control Informations */
+       int repeat_count;
+       int (*stop_cb)(int);
+       int cb_param;
+       int state;
+       int number;
+       double volume;
+       int time;
+       int pid;
+
+       int thread_state;
 } tone_info_t;
 
-typedef enum
-{
+typedef enum {
        LOW_FREQUENCY = 0,
        MIDDLE_FREQUENCY,
        HIGH_FREQUENCY,
@@ -116,8 +115,7 @@ typedef enum
        LOOP_INDEX,
 } volume_type_e;
 
-typedef struct st_tone
-{
+typedef struct st_tone {
        float low_frequency;
        float middle_frequency;
        float high_frequency;
@@ -126,8 +124,7 @@ typedef struct st_tone
        int loopIndx;
 } TONE;
 
-static const int TONE_SEGMENT[][MM_SOUND_TONE_NUM] =
-{
+static const int TONE_SEGMENT[][MM_SOUND_TONE_NUM] = {
        {941,   1336,   0,      -1,     0,      0,
        -1,     -1,     -1,     -1,     0,      0},// 0 key: 1336Hz, 941Hz
 
@@ -223,7 +220,7 @@ static const int TONE_SEGMENT[][MM_SOUND_TONE_NUM] =
        {425,   0,      0,      200,    0,      0,
                0,      0,      0,      600,    0,      0,
         425,   0,      0,      200,    0,      0,
-               0,      0,      0,      3000,0, 0,
+               0,      0,      0,      3000,   0,      0,
        -1,     -1,     -1,     -1,     0,      0}, //Call supervisory tone, Call Waiting: CEPT, JAPAN: 425Hz, 200ms ON, 600ms OFF, 200ms ON, 3s OFF...
 
        {440,   0,      0,      300,    0,      0,
@@ -238,21 +235,21 @@ static const int TONE_SEGMENT[][MM_SOUND_TONE_NUM] =
                0,      0,      0,      4000,   0,      0,
        -1,     -1,     -1,     -1,     0,      0}, //Call supervisory tone, Ring Tone: CEPT, JAPAN: 425Hz, 1s ON, 4s OFF...
 
-       {440,  480,     0,      2000,   0,      0,
+       {440,   480,    0,      2000,   0,      0,
                0,        0,    0,      4000,   0,      0,
        -1,     -1,     -1,     -1,     0,      0}, //Call supervisory tone, Ring Tone: ANSI (IS-95): 440Hz + 480Hz, 2s ON, 4s OFF...
 
-       {400,   1200,     0,    35,     0,       0,
+       {400,   1200,   0,      35,     0,       0,
        -1,     -1,     -1,     -1,     1,      0}, // General beep: 400Hz+1200Hz, 35ms ON
 
        {1200,  0,      0, 100, 0,      0,
                0,      0,      0, 100, 0,      0,
                -1,     -1,     -1,     -1,     2,      0}, //Proprietary tone, positive acknowlegement: 1200Hz, 100ms ON, 100ms OFF 2 bursts
 
-       {300, 400, 500,  400,   0,      0,
+       {300,   400,    500,    400,    0,      0,
                -1,     -1,     -1,     -1,     1,      0}, //Proprietary tone, negative acknowlegement: 300Hz+400Hz+500Hz, 400ms ON
 
-       {400, 1200,   0,  200,  0,      0,
+       {400,   1200,   0,      200,    0,      0,
                -1,     -1,     -1,     -1,     1,      0}, //Proprietary tone, prompt tone: 400Hz+1200Hz, 200ms ON
 
        {400,   1200,   0,      35,     0,      0,
@@ -269,8 +266,8 @@ static const int TONE_SEGMENT[][MM_SOUND_TONE_NUM] =
                -1,     -1,     -1,     -1,     8,      0}, //Call supervisory tone (IS-95), abbreviated intercept: intercept tone limited to 4 seconds
 
        {480,   620,    0,      250,    0,      0,
-            0, 0,      0,      250,    0,      0,
-               -1,     -1,     -1,     -1,     8,      0 }, //Call supervisory tone (IS-95), abbreviated congestion: congestion tone limited to 4 seconds
+       0,      0,      0,      250,    0,      0,
+       -1,     -1,     -1,     -1,     8,      0}, //Call supervisory tone (IS-95), abbreviated congestion: congestion tone limited to 4 seconds
 
        {350,   440,    0,      100,    0,      0,
                0,      0,      0,      100,    0,      0,
@@ -342,12 +339,12 @@ static const int TONE_SEGMENT[][MM_SOUND_TONE_NUM] =
        {2091,  0,      0,      32,     0,      0,
        2556,   0,      0,      64,     3,      0,
        2091,   0,      0,      32,     0,      0,
-               0,      0,      0,      200,    0,      0,
+       0,      0,      0,      200,    0,      0,
        2091,   0,      0,      32,     0,      0,
        2556,   0,      0,      64,     3,      4,
        2091,   0,      0,      32,     0,      0,
-               0,      0,      0,      200,    0,      0,
-               -1,     -1,     -1,     -1,     1,      0},//ISDN Call Signal SP PRI tone:{2091Hz 32ms ON, 2556 64ms ON} 4 times 2091Hz 16ms ON, 200ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 4 times, 2091Hz 16ms ON, 200ms OFF
+       0,      0,      0,      200,    0,      0,
+       -1,     -1,     -1,     -1,     1,      0},//ISDN Call Signal SP PRI tone:{2091Hz 32ms ON, 2556 64ms ON} 4 times 2091Hz 16ms ON, 200ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 4 times, 2091Hz 16ms ON, 200ms OFF
 
        {0,     0,      0,      -1,     0,      0,
        -1,     -1,     -1,     -1,     1,      0}, //ISDN Call sign PAT3 tone: silent tone
@@ -355,7 +352,7 @@ static const int TONE_SEGMENT[][MM_SOUND_TONE_NUM] =
        {2091,  0,      0,      32,     0,      0,
        2556,   0,      0,      64,     4,      0,
        2091,   0,      0,      20,     0,      0,
-               -1,     -1,     -1,     -1,     1,      0}, //ISDN Ping Ring tone: {2091Hz 32ms ON, 2556Hz 64ms ON} 5 times 2091Hz 20ms ON
+       -1,     -1,     -1,     -1,     1,      0}, //ISDN Ping Ring tone: {2091Hz 32ms ON, 2556Hz 64ms ON} 5 times 2091Hz 20ms ON
 
        {0,     0,      0,      -1,     0,      0,
        -1,     -1,     -1,     -1,     1,      0}, //ISDN Pat5 tone: silent tone
@@ -378,7 +375,7 @@ static const int TONE_SEGMENT[][MM_SOUND_TONE_NUM] =
 
        {1300,  0,      0,      25,     0,      0,
        1450,   0,      0,      25,     39,     0,
-               0,      0,      0,4000, 0,      0,
+       0,      0,      0,      4000,   0,      0,
        -1,     -1,     -1,     -1,     0,      0}, //TONE_CDMA_LOW_L tone: {1300Hz 25ms, 1450Hz 25ms} 40 times, 4000ms OFF, Repeat ....
 
        {3700,  0,      0,      25,     0,      0,
@@ -388,7 +385,7 @@ static const int TONE_SEGMENT[][MM_SOUND_TONE_NUM] =
 
        {2600,  0,      0,      25,     0,      0,
        2900,   0,      0,      25,     15,     0,
-               0,      0,      0,400,  0,      0,
+       0,      0,      0,      400,    0,      0,
        -1,     -1,     -1,     -1,     0,      0}, //CDMA MED SS tone: {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 400ms OFF, repeat ....
 
        {1300,  0,      0,      25,     0,      0,
@@ -398,14 +395,14 @@ static const int TONE_SEGMENT[][MM_SOUND_TONE_NUM] =
 
        {3700,  0,      0,      25,     0,      0,
        4000,   0,      0,      25,     7,      0,
-               0,      0,      0,      200,    0,      0,
+       0,      0,      0,      200,    0,      0,
        3700,   0,      0,      25,     0,      0,
        4000,   0,      0,      25,     7,      3,
-               0,      0,      0,      200,    0,      0,
+       0,      0,      0,      200,    0,      0,
        3700,   0,      0,      25,     0,      0,
        4000,   0,      0,      25,     15,     6,
-               0,      0,      0,      4000,0, 0,
-               -1,     -1,     -1,     -1,     0,      0}, //CDMA HIGH SSL tone: {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 4000ms OFF, repeat ...
+       0,      0,      0,      4000,   0,      0,
+       -1,     -1,     -1,     -1,     0,      0}, //CDMA HIGH SSL tone: {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 4000ms OFF, repeat ...
 
        {2600,  0,      0,      25,     0,      0,
        2900,   0,      0,      25,     7,      0,
@@ -415,7 +412,7 @@ static const int TONE_SEGMENT[][MM_SOUND_TONE_NUM] =
                0,      0,      0,      200,    0,      0,
        2600,   0,      0,      25,     0,      0,
        2900,   0,      0,      25,     15,     6,
-               0,      0,      0,      4000,0, 0,
+               0,      0,      0,      4000,   0,      0,
                -1,     -1,     -1,     -1,     0,      0}, //CDMA MED SSL tone: {2600Hz 25ms, 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 4000ms OFF, repeat ...
 
        {1300,  0,      0,      25,     0,      0,
@@ -426,7 +423,7 @@ static const int TONE_SEGMENT[][MM_SOUND_TONE_NUM] =
                0,      0,      0,      200,    0,      0,
        1300,   0,      0,      25,     0,      0,
        1450,   0,      0,      25,     15,     6,
-               0,      0,      0,      4000,0, 0,
+               0,      0,      0,      4000,   0,      0,
                -1,     -1,     -1,     -1,     0,      0}, //CDMA LOW SSL tone: {1300Hz 25ms, 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 16 times, 4000ms OFF, repeat ...
 
        {3700,  0,      0,      25,     0,      0,
@@ -604,8 +601,8 @@ static const int TONE_SEGMENT[][MM_SOUND_TONE_NUM] =
                0,      0,      0,      200,    0,      0,
        2600,   0,      0,      25,     0,      0,
        2900,   0,      0,      25,     7,      3,
-               0,      0,      0,      1000,0, 0,
-               -1,     -1,     -1,     -1,     0,      0 }, //CDMA HIGH PBX SLS tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 1000ms OFF, REPEAT....//
+       0,      0,      0,      1000,   0,      0,
+       -1,     -1,     -1,     -1,     0,      0 }, //CDMA HIGH PBX SLS tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 1000ms OFF, REPEAT....//
 
        {1300,  0,      0,      25,     0,      0,
        1450,   0,      0,      25,     15,     0,
@@ -688,10 +685,10 @@ static const int TONE_SEGMENT[][MM_SOUND_TONE_NUM] =
        831,            0,      0,      62, 0,  0,
        784,            0,      0,      62, 0,  0,
        1109,   0,      0,      62, 0,  0,
-       784,    0,      0,      62, 0,  0,
+       784,    0,      0,      62, 0,  0,
        831,            0,      0,      62, 0,  0,
-       784,    0,      0,      62, 0,  0,
-               -1,     -1,     -1,     -1,     1,      0}, //CDMA ALERT INCALL LITE tone: 587Hz 62ms, 784 62ms, 831Hz 62ms, 784Hz 62ms, 1109 62ms, 784Hz 62ms, 831Hz 62ms, 784Hz 62ms
+       784,    0,      0,      62, 0,  0,
+       -1,     -1,     -1,     -1,     1,      0}, //CDMA ALERT INCALL LITE tone: 587Hz 62ms, 784 62ms, 831Hz 62ms, 784Hz 62ms, 1109 62ms, 784Hz 62ms, 831Hz 62ms, 784Hz 62ms
 
        {941,   0,      0,      125,    0,      0,
                0,      0,      0,      10,     0,      0,
@@ -750,10 +747,10 @@ static void _running_tone(void *param);
 
 int* MMSoundPlugCodecToneGetSupportTypes(void)
 {
-    debug_enter();
-    static int suported[2] = {MM_SOUND_SUPPORTED_CODEC_DTMF, 0};
-    debug_leave();
-    return suported;
+       debug_enter();
+       static int suported[2] = {MM_SOUND_SUPPORTED_CODEC_DTMF, 0};
+       debug_leave();
+       return suported;
 }
 
 int MMSoundPlugCodecToneCreate(mmsound_codec_param_t *param, mmsound_codec_info_t *info, MMHandleType *handle)
@@ -816,24 +813,23 @@ int MMSoundPlugCodecToneCreate(mmsound_codec_param_t *param, mmsound_codec_info_
        *handle = (MMHandleType)toneInfo;
 
        debug_msg("wait until thread_stare THREAD_STATE_START");
-       while((toneInfo->thread_state == THREAD_STATE_NONE) && (wait_count < WAIT_THREAD_WAIT_CNT)) {
+       while ((toneInfo->thread_state == THREAD_STATE_NONE) && (wait_count < WAIT_THREAD_WAIT_CNT)) {
                usleep(WAIT_THREAD_WAIT_TIME * 1000);
                wait_count++;
        }
 
-       if (wait_count >= WAIT_THREAD_WAIT_CNT) {
+       if (wait_count >= WAIT_THREAD_WAIT_CNT)
                debug_error("timeout for thread pool. wait_count: %d ms ", WAIT_THREAD_WAIT_CNT * WAIT_THREAD_WAIT_TIME);
-       } else {
+       else
                debug_msg("_running_tone thread is started");
-       }
 
        debug_leave();
        return MM_ERROR_NONE;
 
 Error:
-       if(toneInfo) {
-               if(toneInfo->handle) {
-                       if(MM_ERROR_NONE != mm_sound_pa_close(toneInfo->handle))
+       if (toneInfo) {
+               if (toneInfo->handle) {
+                       if (MM_ERROR_NONE != mm_sound_pa_close(toneInfo->handle))
                                debug_error("mm_sound_pa_close() fail. handle(%lu)", toneInfo->handle);
                }
                free(toneInfo);
@@ -856,7 +852,7 @@ int MMSoundPlugCodecToneDestroy(MMHandleType handle)
 
        pthread_mutex_destroy(&toneInfo->mutex);
        if (toneInfo)
-               free (toneInfo);
+               free(toneInfo);
 
        debug_leave();
        return err;
@@ -884,56 +880,55 @@ _create_tone(double *sample, TONE _TONE, double volume, int *toneSize, gboolean
        short *pbuf;
        double i = 0;
        double amplitude, f1, f2, f3;
-       int quota= 0;
+       int quota = 0;
        float low_frequency;
        float middle_frequency;
        float high_frequency;
        int sample_size = 0;
        char* buffer;
 
-       if(is_cycle_ended) {
-               low_frequency           = 0;
-               middle_frequency                = 0;
-               high_frequency          = 0;
+       if (is_cycle_ended) {
+               low_frequency = 0;
+               middle_frequency = 0;
+               high_frequency = 0;
        } else {
-               low_frequency           = _TONE.low_frequency;
-               middle_frequency                = _TONE.middle_frequency;
-               high_frequency          = _TONE.high_frequency;
+               low_frequency = _TONE.low_frequency;
+               middle_frequency = _TONE.middle_frequency;
+               high_frequency = _TONE.high_frequency;
        }
 
-       if(sample == NULL) {
+       if (sample == NULL) {
                debug_error("Sample buffer is not allocated");
                return NULL;
        }
 
        /* Create a buffer for the tone */
-       if((_TONE.playingTime >  MAX_DURATION) || (_TONE.playingTime == -1) ) {
+       if ((_TONE.playingTime >  MAX_DURATION) || (_TONE.playingTime == -1))
                *toneSize = ((MAX_DURATION / 1000.) * SAMPLERATE * SAMPLE_SIZE * CHANNELS) / 8;
-       } else   {
+       else
                *toneSize = ((_TONE.playingTime / 1000.) * SAMPLERATE * SAMPLE_SIZE * CHANNELS) / 8;
-       }
-       *toneSize = ((*toneSize+1)>>1)<<1;
+
+       *toneSize = ((*toneSize + 1) >> 1) << 1;
        sample_size = (*toneSize) / (SAMPLE_SIZE / 8);
 
        debug_log("%0.f, %0.f, %0.f _TONE.playing_time: %d toneSize: %d",
                        low_frequency, middle_frequency, high_frequency, _TONE.playingTime, *toneSize);
 
-       buffer = g_malloc (*toneSize);
-       if(buffer == NULL) {
+       buffer = g_malloc(*toneSize);
+       if (buffer == NULL) {
                debug_error("Buffer is not allocated");
                return NULL;
        } else {
                pbuf = (short*)buffer;
 
-               if(_TONE.low_frequency > 0) {
+               if (_TONE.low_frequency > 0)
                        quota++;
-               }
-               if(_TONE.middle_frequency > 0) {
+
+               if (_TONE.middle_frequency > 0)
                        quota++;
-               }
-               if(_TONE.high_frequency > 0) {
+
+               if (_TONE.high_frequency > 0)
                        quota++;
-               }
 
                if (quota == 0) {
                        debug_error("quota is zero!!!");
@@ -946,11 +941,11 @@ _create_tone(double *sample, TONE _TONE, double volume, int *toneSize, gboolean
                         * We add the fundamental frequencies together.
                         */
 
-                       f1 = sin (2 * M_PI * low_frequency      * ((*sample) / SAMPLERATE));
-                       f2 = sin (2 * M_PI * middle_frequency   * ((*sample) / SAMPLERATE));
-                       f3 = sin (2 * M_PI * high_frequency     * ((*sample) / SAMPLERATE));
+                       f1 = sin(2 * M_PI * low_frequency * ((*sample) / SAMPLERATE));
+                       f2 = sin(2 * M_PI * middle_frequency * ((*sample) / SAMPLERATE));
+                       f3 = sin(2 * M_PI * high_frequency * ((*sample) / SAMPLERATE));
 
-                       if(f1 + f2 + f3 != 0) {
+                       if (f1 + f2 + f3 != 0) {
                                amplitude = (f1 + f2 + f3) / quota;
                                /* Adjust the volume */
                                amplitude *= volume;
@@ -989,14 +984,14 @@ static int
 _mm_get_waveCnt_PlayingTime(int toneTime, TONE _TONE, int *waveCnt, int *waveRestPlayTime)
 {
        int ret = MM_ERROR_NONE;
-       if(waveCnt == NULL || waveRestPlayTime == NULL) {
+       if (waveCnt == NULL || waveRestPlayTime == NULL) {
                debug_error("waveCnt || waveRestPlayTime buffer is NULL");
                return MM_ERROR_SOUND_INTERNAL;
        }
        /*Set  wave count and wave playing time*/
-       if_TONE.playingTime == -1) {
+       if (_TONE.playingTime == -1) {
                *waveCnt = abs(toneTime) /MAX_DURATION;
-               *waveRestPlayTime =  abs(toneTime) % MAX_DURATION;
+               *waveRestPlayTime = abs(toneTime) % MAX_DURATION;
        } else {
                *waveCnt = _TONE.playingTime /MAX_DURATION;
                *waveRestPlayTime =  _TONE.playingTime % MAX_DURATION;
@@ -1008,14 +1003,14 @@ static int
 _mm_get_CurIndex(TONE _TONE, int *CurArrayPlayCnt, int *CurIndex)
 {
        int ret = MM_ERROR_NONE;
-       if(CurArrayPlayCnt == NULL || CurIndex == NULL) {
+       if (CurArrayPlayCnt == NULL || CurIndex == NULL) {
                debug_error("CurArrayPlayCnt || CurIndex buffer is NULL");
                return MM_ERROR_SOUND_INTERNAL;
        }
 
-       if(_TONE.loopCnt != 0 && *CurArrayPlayCnt <= _TONE.loopCnt) {
+       if (_TONE.loopCnt != 0 && *CurArrayPlayCnt <= _TONE.loopCnt) {
                (*CurArrayPlayCnt)++;
-               if(*CurArrayPlayCnt >_TONE.loopCnt) {
+               if (*CurArrayPlayCnt > _TONE.loopCnt) {
                        (*CurIndex)++;
                        *CurArrayPlayCnt = 0;
                } else {
@@ -1033,13 +1028,13 @@ static void _running_tone(void *param)
        char *ptoneBuf = NULL;
        char filename[100];
 
-       if(param == NULL) {
+       if (param == NULL) {
                debug_error("param Buffer is not allocated");
                return;
        }
        tone_info_t *toneInfo = (tone_info_t*) param;
        int toneKey = 0;
-       int toneTime =0;
+       int toneTime = 0;
        int prePlayingTime = 0;
        int duration = 0;
        int playingTime = 0;
@@ -1058,21 +1053,21 @@ static void _running_tone(void *param)
        pthread_mutex_unlock(&toneInfo->mutex);
        double sample = 0;
        toneTime = toneInfo->time;
-       if(toneTime != 0) {
+       if (toneTime != 0) {
                toneKey = toneInfo->number;
-               debug_msg ("toneKey number = %d", toneKey);
+               debug_msg("toneKey number = %d", toneKey);
 
                /* Set pid check file */
                snprintf(filename, sizeof(filename), "/proc/%d/cmdline", toneInfo->pid);
 
                debug_msg("Wait start signal");
-               while(toneInfo->state == STATE_READY)
+               while (toneInfo->state == STATE_READY)
                        usleep(10);
                debug_msg("Recv start signal");
                pthread_mutex_lock(&toneInfo->mutex);
 
-               if ((toneInfo->state == STATE_STOP)||(toneInfo->thread_state == THREAD_STATE_STOP)) {
-                       debug_msg("state is stop. state(%d)  thread_state(%d) goto exit.", toneInfo->state, toneInfo->thread_state );
+               if ((toneInfo->state == STATE_STOP) || (toneInfo->thread_state == THREAD_STATE_STOP)) {
+                       debug_msg("state is stop. state(%d)  thread_state(%d) goto exit.", toneInfo->state, toneInfo->thread_state);
                        pthread_mutex_unlock(&toneInfo->mutex);
                        goto exit;
                } else {
@@ -1087,22 +1082,22 @@ static void _running_tone(void *param)
 
        while (toneInfo->thread_state == THREAD_STATE_START) {
                TONE _TONE = _mm_get_tone(toneKey, CurIndex); /*Pop one of Tone Set */
-               if(_mm_get_waveCnt_PlayingTime(toneTime, _TONE, &numWave, &waveRestPlayTime) != MM_ERROR_NONE) {
+               if (_mm_get_waveCnt_PlayingTime(toneTime, _TONE, &numWave, &waveRestPlayTime) != MM_ERROR_NONE) {
                        debug_error("_mm_get_waveCnt_PlayingTime return value error");
                        goto exit;
                }
 
-               if(_mm_get_CurIndex(_TONE, &CurArrayPlayCnt, &CurIndex) != MM_ERROR_NONE) {
+               if (_mm_get_CurIndex(_TONE, &CurArrayPlayCnt, &CurIndex) != MM_ERROR_NONE) {
                        debug_error("_mm_get_CurIndex return value error");
                        goto exit;
                }
 
-               debug_log ("Predefined Tone[%d] Total Play time (ms) : %d, _TONE.playing_time: %d _numWave = %d low_frequency: %0.f, middle_frequency: %0.f, high_frequency: %0.f",
+               debug_log("Predefined Tone[%d] Total Play time (ms) : %d, _TONE.playing_time: %d _numWave = %d low_frequency: %0.f, middle_frequency: %0.f, high_frequency: %0.f",
                        CurIndex, toneTime, _TONE.playingTime, numWave, _TONE.low_frequency, _TONE.middle_frequency, _TONE.high_frequency);
 
 
                if (_TONE.low_frequency == -1) { /* skip frequency which's value is -1*/
-                       if((_TONE.loopCnt > 0) && (CurArrayPlayCnt == _TONE.loopCnt)) {
+                       if ((_TONE.loopCnt > 0) && (CurArrayPlayCnt == _TONE.loopCnt)) {
                                is_cycle_ended = TRUE;
                                debug_log("[is_cycle_ended]");
                        }
@@ -1111,46 +1106,44 @@ static void _running_tone(void *param)
                }
 
                /* Write pcm data */
-               for(CurWaveIndex = 0; CurWaveIndex < numWave+1; CurWaveIndex++) {
-                       if(CurWaveIndex == numWave ) { /* play the last tone set*/
+               for (CurWaveIndex = 0; CurWaveIndex < numWave+1; CurWaveIndex++) {
+                       if (CurWaveIndex == numWave) /* play the last tone set*/
                                playingTime = waveRestPlayTime;
-                       } else {
+                       else
                                playingTime = MAX_DURATION;
-                       }
+
                        duration = playingTime;
 
-                       if(playingTime == 0) {
+                       if (playingTime == 0)
                                break;
-                       }
 
-                       if(prePlayingTime + playingTime > toneTime && toneTime != -1) {
+                       if (prePlayingTime + playingTime > toneTime && toneTime != -1)
                                playingTime = toneTime - prePlayingTime;
-                       }
 
                        ptoneBuf = _create_tone(&sample, _TONE, toneInfo->volume, &toneSize, is_cycle_ended);
-                       if(ptoneBuf == NULL) {
+                       if (ptoneBuf == NULL) {
                                debug_error("Tone Buffer is not allocated");
                                goto exit;
                        }
-                       debug_log ("[TONE] Play.....%dth %dms", CurWaveIndex, playingTime);
+                       debug_log("[TONE] Play.....%dth %dms", CurWaveIndex, playingTime);
                        mm_sound_pa_write(toneInfo->handle, ptoneBuf, ((toneSize * playingTime /duration + 1)>>1)<<1);
                        prePlayingTime += playingTime;
-                       debug_log ("previous_sum: %d", prePlayingTime);
-                       g_free (ptoneBuf);
+                       debug_log("previous_sum: %d", prePlayingTime);
+                       g_free(ptoneBuf);
                        ptoneBuf = NULL;
 
-                       if(prePlayingTime == toneTime || toneInfo->state != STATE_PLAY) {
-                               debug_log ("Finished.....on Total Playing Time : %d _TONE.playing_time: %d", prePlayingTime, _TONE.playingTime);
+                       if (prePlayingTime == toneTime || toneInfo->state != STATE_PLAY) {
+                               debug_log("Finished.....on Total Playing Time : %d _TONE.playing_time: %d", prePlayingTime, _TONE.playingTime);
                                mm_sound_pa_drain(toneInfo->handle);
-                               debug_log ("Finished.....quit loop");
+                               debug_log("Finished.....quit loop");
                                goto exit;
                        }
-                       debug_log ("[%d] CurIndex: %d previous_sum: %d", CurArrayPlayCnt, CurIndex, prePlayingTime);
+                       debug_log("[%d] CurIndex: %d previous_sum: %d", CurArrayPlayCnt, CurIndex, prePlayingTime);
                }
        }
 
-exit :
-       if(MM_ERROR_NONE != mm_sound_pa_close(toneInfo->handle))
+exit:
+       if (MM_ERROR_NONE != mm_sound_pa_close(toneInfo->handle))
                debug_error("mm_sound_pa_close() fail. handle(%lu)", toneInfo->handle);
 
 #if 0
@@ -1186,9 +1179,8 @@ int MMSoundPlugCodecToneStop(MMHandleType handle)
        pthread_mutex_unlock(&toneInfo->mutex);
        debug_msg("sent stop signal");
 
-       while(toneInfo->state != STATE_NONE) {
+       while (toneInfo->state != STATE_NONE)
                usleep(30000);
-       }
 
        debug_leave();
 
@@ -1198,10 +1190,10 @@ int MMSoundPlugCodecToneStop(MMHandleType handle)
 static
 int MMSoundPlugCodecToneSetThreadPool(int (*func)(void*, void (*)(void*)))
 {
-    debug_enter("(func : 0x%x)", func);
-    g_thread_pool_func = func;
-    debug_leave();
-    return MM_ERROR_NONE;
+       debug_enter("(func : 0x%x)", func);
+       g_thread_pool_func = func;
+       debug_leave();
+       return MM_ERROR_NONE;
 }
 
 #if 0
@@ -1222,25 +1214,25 @@ static int _MMSoundToneFini(void)
 EXPORT_API
 int MMSoundGetPluginType(void)
 {
-    debug_enter();
-    debug_leave();
-    return MM_SOUND_PLUGIN_TYPE_CODEC;
+       debug_enter();
+       debug_leave();
+       return MM_SOUND_PLUGIN_TYPE_CODEC;
 }
 
 EXPORT_API
 int MMSoundPlugCodecGetInterface(mmsound_codec_interface_t *intf)
 {
-    debug_enter();
+       debug_enter();
 
-    intf->GetSupportTypes   = MMSoundPlugCodecToneGetSupportTypes;
-    intf->Create            = MMSoundPlugCodecToneCreate;
-    intf->Destroy           = MMSoundPlugCodecToneDestroy;
-    intf->Play              = MMSoundPlugCodecTonePlay;
-    intf->Stop              = MMSoundPlugCodecToneStop;
-    intf->SetThreadPool     = MMSoundPlugCodecToneSetThreadPool;
+       intf->GetSupportTypes = MMSoundPlugCodecToneGetSupportTypes;
+       intf->Create = MMSoundPlugCodecToneCreate;
+       intf->Destroy = MMSoundPlugCodecToneDestroy;
+       intf->Play = MMSoundPlugCodecTonePlay;
+       intf->Stop = MMSoundPlugCodecToneStop;
+       intf->SetThreadPool = MMSoundPlugCodecToneSetThreadPool;
 
-    debug_leave();
+       debug_leave();
 
-    return MM_ERROR_NONE;
+       return MM_ERROR_NONE;
 }
 
index 19cc427830e13c0cbdcd9d23707bd2b25c3ba035..dbd81ceb9d7f926fd0975342a31e7a19e5d3743d 100644 (file)
@@ -36,8 +36,7 @@
 #include <sndfile.h>
 #include <pulse/pulseaudio.h>
 
-typedef struct
-{
+typedef struct {
        int handle;
        int repeat_count;
        int (*stop_cb)(int);
@@ -93,26 +92,27 @@ static void _sound_unprepare(wave_info_t *h)
 }
 
 /* Context Callbacks */
-static void _pa_context_state_callback(pa_context *c, void *userdata) {
+static void _pa_context_state_callback(pa_context *c, void *userdata)
+{
        pa_threaded_mainloop *m = (pa_threaded_mainloop *)userdata;
        assert(c);
 
        switch (pa_context_get_state(c)) {
-               case PA_CONTEXT_CONNECTING:
-               case PA_CONTEXT_AUTHORIZING:
-               case PA_CONTEXT_SETTING_NAME:
-                       debug_log("context(%p), state(%d)", c, pa_context_get_state(c));
-                       break;
-
-               case PA_CONTEXT_READY:
-               case PA_CONTEXT_TERMINATED:
-               case PA_CONTEXT_FAILED:
-                       debug_warning("context(%p), state(%d)", c, pa_context_get_state(c));
-                       pa_threaded_mainloop_signal(m, 0);
-                       break;
-
-               default:
-                       break;
+       case PA_CONTEXT_CONNECTING:
+       case PA_CONTEXT_AUTHORIZING:
+       case PA_CONTEXT_SETTING_NAME:
+               debug_log("context(%p), state(%d)", c, pa_context_get_state(c));
+               break;
+
+       case PA_CONTEXT_READY:
+       case PA_CONTEXT_TERMINATED:
+       case PA_CONTEXT_FAILED:
+               debug_warning("context(%p), state(%d)", c, pa_context_get_state(c));
+               pa_threaded_mainloop_signal(m, 0);
+               break;
+
+       default:
+               break;
        }
 }
 
@@ -129,17 +129,17 @@ static void _pa_stream_state_callback(pa_stream *s, void *userdata)
        assert(s);
 
        switch (pa_stream_get_state(s)) {
-               case PA_STREAM_CREATING:
-                       debug_log("stream(%p), state(%d)", s, pa_stream_get_state(s));
-                       break;
-               case PA_STREAM_READY:
-               case PA_STREAM_FAILED:
-               case PA_STREAM_TERMINATED:
-                       debug_warning("stream(%p), state(%d)", s, pa_stream_get_state(s));
-                       pa_threaded_mainloop_signal(m, 0);
-                       break;
-               default:
-                       break;
+       case PA_STREAM_CREATING:
+               debug_log("stream(%p), state(%d)", s, pa_stream_get_state(s));
+               break;
+       case PA_STREAM_READY:
+       case PA_STREAM_FAILED:
+       case PA_STREAM_TERMINATED:
+               debug_warning("stream(%p), state(%d)", s, pa_stream_get_state(s));
+               pa_threaded_mainloop_signal(m, 0);
+               break;
+       default:
+               break;
        }
 }
 
@@ -219,7 +219,7 @@ static void _pa_stream_write_callback(pa_stream *s, size_t length, void *userdat
        if ((bytes = sf_readf_short(h->sf, data, (sf_count_t)(data_length / frame_size))) > 0)
                bytes *= (sf_count_t)frame_size;
 
-       debug_log("=== %lld / %d ===",bytes, data_length);
+       debug_log("=== %lld / %d ===", bytes, data_length);
 
        if (bytes > 0)
                pa_stream_write(s, data, (size_t)bytes, NULL, 0, PA_SEEK_RELATIVE);
@@ -472,7 +472,7 @@ static int _mm_sound_plug_codec_wave_create(mmsound_codec_param_t *param, mmsoun
 
        memset(p, 0, sizeof(wave_info_t));
        p->handle = 0;
-       p->repeat_count = param ->repeat_count;
+       p->repeat_count = param->repeat_count;
        p->stop_cb = param->stop_cb;
        p->cb_param = param->param;
        MMSOUND_STRNCPY(p->filename, param->pfilename, MM_SOUND_MAX_FILENAME);