Modify codes for complying Tizen coding rule 63/50763/5 accepted/tizen/mobile/20151103.024725 accepted/tizen/tv/20151103.024737 accepted/tizen/wearable/20151103.024750 submit/tizen/20151102.121151
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 2 Nov 2015 01:48:16 +0000 (10:48 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 2 Nov 2015 11:54:40 +0000 (20:54 +0900)
[Version] Release 0.3.22
[profile] Common
[Issue Type] code clean-up

Change-Id: I7ecac71f4d8032ffd9823f6f6ea526760e920a34
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
include/sound_manager.h
include/sound_manager_internal.h
include/sound_manager_private.h
packaging/capi-media-sound-manager.spec
src/sound_manager.c
src/sound_manager_internal.c
src/sound_manager_private.c
test/sound_manager_test.c

index e6774b2a2ec95d5aa0bbf7c6b4b648da2820019b..73f33e9238c265eab8c52fee17044e19004e093a 100644 (file)
@@ -38,8 +38,7 @@ extern "C"
  * @brief Enumeration for sound manager's error codes.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
-typedef enum
-{
+typedef enum {
        SOUND_MANAGER_ERROR_NONE              = TIZEN_ERROR_NONE,                    /**< Successful */
        SOUND_MANAGER_ERROR_OUT_OF_MEMORY     = TIZEN_ERROR_OUT_OF_MEMORY,           /**< Out of memory */
        SOUND_MANAGER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,       /**< Invalid parameter */
@@ -62,8 +61,7 @@ typedef enum
  * @brief Enumeration for sound type.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
-typedef enum
-{
+typedef enum {
        SOUND_TYPE_SYSTEM,          /**< Sound type for system */
        SOUND_TYPE_NOTIFICATION,    /**< Sound type for notifications */
        SOUND_TYPE_ALARM,           /**< Sound type for alarm */
@@ -155,7 +153,7 @@ typedef enum {
  * @see sound_manager_create_stream_information()
  * @see sound_manager_destroy_stream_information()
  */
-typedef void (* sound_stream_focus_state_changed_cb) (sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data);
+typedef void (*sound_stream_focus_state_changed_cb) (sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data);
 
 /**
  * @brief Called when the focus state for each sound stream type is changed regardless of the process.
@@ -169,7 +167,7 @@ typedef void (* sound_stream_focus_state_changed_cb) (sound_stream_info_h stream
  * @see sound_manager_set_focus_state_watch_cb()
  * @see sound_manager_unset_focus_state_watch_cb()
  */
-typedef void (* sound_stream_focus_state_watch_cb) (sound_stream_focus_mask_e changed_focus_mask, sound_stream_focus_state_e changed_focus_state, sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data);
+typedef void (*sound_stream_focus_state_watch_cb) (sound_stream_focus_mask_e changed_focus_mask, sound_stream_focus_state_e changed_focus_state, sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data);
 
 /**
  * @}
@@ -262,7 +260,7 @@ typedef enum {
  * @see sound_manager_set_session_interrupted_cb()
  * @see sound_manager_unset_session_interrupted_cb()
  */
-typedef void (* sound_session_interrupted_cb) (sound_session_interrupted_code_e code, void *user_data);
+typedef void (*sound_session_interrupted_cb) (sound_session_interrupted_code_e code, void *user_data);
 
 /**
  * @}
@@ -355,7 +353,7 @@ typedef enum {
  * @see sound_manager_set_device_connected_cb()
  * @see sound_manager_unset_device_connected_cb()
  */
-typedef void (* sound_device_connected_cb) (sound_device_h device, bool is_connected, void *user_data);
+typedef void (*sound_device_connected_cb) (sound_device_h device, bool is_connected, void *user_data);
 
 /**
  * @brief Called when the information of a sound device was changed.
@@ -367,7 +365,7 @@ typedef void (* sound_device_connected_cb) (sound_device_h device, bool is_conne
  * @see sound_manager_set_device_information_changed_cb()
  * @see sound_manager_unset_device_information_changed_cb()
  */
-typedef void (* sound_device_information_changed_cb) (sound_device_h device, sound_device_changed_info_e changed_info, void *user_data);
+typedef void (*sound_device_information_changed_cb) (sound_device_h device, sound_device_changed_info_e changed_info, void *user_data);
 
 /**
  * @}
@@ -402,7 +400,7 @@ typedef void (*sound_manager_volume_changed_cb) (sound_type_e type, unsigned int
  * @see sound_manager_set_volume()
  * @see sound_manager_get_volume()
  */
-int sound_manager_get_max_volume (sound_type_e type, int *max);
+int sound_manager_get_max_volume(sound_type_e type, int *max);
 
 /**
  * @brief Sets the volume level specified for a particular sound type.
@@ -420,7 +418,7 @@ int sound_manager_get_max_volume (sound_type_e type, int *max);
  * @see sound_manager_get_max_volume()
  * @see sound_manager_get_volume()
  */
-int sound_manager_set_volume (sound_type_e type, int volume);
+int sound_manager_set_volume(sound_type_e type, int volume);
 
 /**
  * @brief Gets the volume level specified for a particular sound type.
@@ -435,7 +433,7 @@ int sound_manager_set_volume (sound_type_e type, int volume);
  * @see sound_manager_get_max_volume()
  * @see sound_manager_set_volume()
  */
-int sound_manager_get_volume (sound_type_e type, int *volume);
+int sound_manager_get_volume(sound_type_e type, int *volume);
 
 /**
  * @brief Sets the type of the sound being currently played.
@@ -449,7 +447,7 @@ int sound_manager_get_volume (sound_type_e type, int *volume);
  * @see sound_manager_get_current_sound_type()
  * @see sound_manager_unset_current_sound_type()
  */
-int sound_manager_set_current_sound_type (sound_type_e type);
+int sound_manager_set_current_sound_type(sound_type_e type);
 
 /**
  * @brief Gets the type of the sound being currently played.
@@ -464,7 +462,7 @@ int sound_manager_set_current_sound_type (sound_type_e type);
  * @see sound_manager_set_current_sound_type()
  * @see sound_manager_unset_current_sound_type()
  */
-int sound_manager_get_current_sound_type (sound_type_e *type);
+int sound_manager_get_current_sound_type(sound_type_e *type);
 
 /**
  * @brief Unsets the type of the sound being currently played.
@@ -476,7 +474,7 @@ int sound_manager_get_current_sound_type (sound_type_e *type);
  * @see sound_manager_set_current_sound_type()
  * @see sound_manager_get_current_sound_type()
  */
-int sound_manager_unset_current_sound_type (void);
+int sound_manager_unset_current_sound_type(void);
 
 /**
  * @brief Registers a callback function to be invoked when the volume level is changed.
@@ -492,7 +490,7 @@ int sound_manager_unset_current_sound_type (void);
  * @see sound_manager_unset_volume_changed_cb()
  * @see sound_manager_volume_changed_cb()
  */
-int sound_manager_set_volume_changed_cb (sound_manager_volume_changed_cb callback, void *user_data);
+int sound_manager_set_volume_changed_cb(sound_manager_volume_changed_cb callback, void *user_data);
 
 /**
  * @brief Unregisters the volume change callback.
@@ -502,7 +500,7 @@ int sound_manager_set_volume_changed_cb (sound_manager_volume_changed_cb callbac
  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
  * @see sound_manager_set_volume_changed_cb()
  */
-int sound_manager_unset_volume_changed_cb (void);
+int sound_manager_unset_volume_changed_cb(void);
 
 /**
  * @}
@@ -517,7 +515,7 @@ int sound_manager_unset_volume_changed_cb (void);
  * @brief Creates a handle for stream information.
  * @since_tizen 3.0
  * @details    To apply the stream policy according to this stream information, this handle should be passed to other APIs\n
- *     related to playback or recording. (e.g., player, wav-player, audio-io, etc.)
+ *     related to playback or recording. (e.g., player, wav-player, audio-io, etc.)
  * @param[in]  stream_type     The type of stream
  * @param[in]  callback        The focus state change callback function (mandatory)
  * @param[in]  user_data       The user data to be passed to the callback function
@@ -537,7 +535,7 @@ int sound_manager_unset_volume_changed_cb (void);
  * @see sound_manager_destroy_focus()
  * @see sound_manager_get_focus_state()
  */
-int sound_manager_create_stream_information (sound_stream_type_e stream_type, sound_stream_focus_state_changed_cb callback, void *user_data, sound_stream_info_h *stream_info);
+int sound_manager_create_stream_information(sound_stream_type_e stream_type, sound_stream_focus_state_changed_cb callback, void *user_data, sound_stream_info_h *stream_info);
 
 /**
  * @brief Destroys the handle for stream information.
@@ -557,7 +555,7 @@ int sound_manager_create_stream_information (sound_stream_type_e stream_type, so
  * @see sound_manager_destroy_focus()
  * @see sound_manager_get_focus_state()
  */
-int sound_manager_destroy_stream_information (sound_stream_info_h stream_info);
+int sound_manager_destroy_stream_information(sound_stream_info_h stream_info);
 
 /**
  * @brief Adds the device to the stream information for the stream routing.
@@ -566,8 +564,8 @@ int sound_manager_destroy_stream_information (sound_stream_info_h stream_info);
  * @param[in]  device          The device item from sound_device_list_h
  *
  * @remarks    @a Use sound_manager_get_current_device_list() and sound_manager_get_next_device() to get the device.\n
- *     SOUND_MANAGER_ERROR_POLICY could be returned according to the stream type of the stream_info.\n
- *     The available type of the stream_info for this API is SOUND_STREAM_TYPE_VOIP.
+ *     SOUND_MANAGER_ERROR_POLICY could be returned according to the stream type of the stream_info.\n
+ *     The available type of the stream_info for this API is SOUND_STREAM_TYPE_VOIP.
  *
  * @return @c 0 on success,
  *         otherwise a negative error value
@@ -581,7 +579,7 @@ int sound_manager_destroy_stream_information (sound_stream_info_h stream_info);
  * @see sound_manager_remove_device_for_stream_routing()
  * @see sound_manager_apply_stream_routing()
  */
-int sound_manager_add_device_for_stream_routing (sound_stream_info_h stream_info, sound_device_h device);
+int sound_manager_add_device_for_stream_routing(sound_stream_info_h stream_info, sound_device_h device);
 
 /**
  * @brief Removes the device to the stream information for the stream routing.
@@ -602,7 +600,7 @@ int sound_manager_add_device_for_stream_routing (sound_stream_info_h stream_info
  * @see sound_manager_add_device_for_stream_routing()
  * @see sound_manager_apply_stream_routing()
  */
-int sound_manager_remove_device_for_stream_routing (sound_stream_info_h stream_info, sound_device_h device);
+int sound_manager_remove_device_for_stream_routing(sound_stream_info_h stream_info, sound_device_h device);
 
 /**
  * @brief Applies the stream routing.
@@ -623,7 +621,7 @@ int sound_manager_remove_device_for_stream_routing (sound_stream_info_h stream_i
  * @see sound_manager_add_device_for_stream_routing()
  * @see sound_manager_remove_device_for_stream_routing()
  */
-int sound_manager_apply_stream_routing (sound_stream_info_h stream_info);
+int sound_manager_apply_stream_routing(sound_stream_info_h stream_info);
 
 /**
  * @brief Acquires the stream focus.
@@ -645,7 +643,7 @@ int sound_manager_apply_stream_routing (sound_stream_info_h stream_info);
  * @see sound_manager_release_focus()
  * @see sound_manager_get_focus_state()
  */
-int sound_manager_acquire_focus (sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, const char *additional_info);
+int sound_manager_acquire_focus(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, const char *additional_info);
 
 /**
  * @brief Releases the acquired focus.
@@ -666,7 +664,7 @@ int sound_manager_acquire_focus (sound_stream_info_h stream_info, sound_stream_f
  * @see sound_manager_acquire_focus()
  * @see sound_manager_get_focus_state()
  */
-int sound_manager_release_focus (sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, const char *additional_info);
+int sound_manager_release_focus(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, const char *additional_info);
 
 /**
  * @brief Gets the state of focus.
@@ -685,7 +683,7 @@ int sound_manager_release_focus (sound_stream_info_h stream_info, sound_stream_f
  * @see sound_manager_acquire_focus()
  * @see sound_manager_release_focus()
  */
-int sound_manager_get_focus_state (sound_stream_info_h stream_info, sound_stream_focus_state_e *state_for_playback, sound_stream_focus_state_e *state_for_recording);
+int sound_manager_get_focus_state(sound_stream_info_h stream_info, sound_stream_focus_state_e *state_for_playback, sound_stream_focus_state_e *state_for_recording);
 
 /**
  * @brief Registers the watch callback function to be invoked when the focus state for each sound stream type is changed regardless of the process.
@@ -703,7 +701,7 @@ int sound_manager_get_focus_state (sound_stream_info_h stream_info, sound_stream
  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
  * @see sound_manager_unset_focus_state_watch_cb()
  */
-int sound_manager_set_focus_state_watch_cb (sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_watch_cb callback, void *user_data);
+int sound_manager_set_focus_state_watch_cb(sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_watch_cb callback, void *user_data);
 
 /**
  * @brief Unregisters the focus state watch callback.
@@ -715,7 +713,7 @@ int sound_manager_set_focus_state_watch_cb (sound_stream_focus_mask_e focus_mask
  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
  * @see sound_manager_set_focus_state_watch_cb()
  */
-int sound_manager_unset_focus_state_watch_cb (void);
+int sound_manager_unset_focus_state_watch_cb(void);
 
 /**
  * @}
@@ -746,7 +744,7 @@ int sound_manager_unset_focus_state_watch_cb (void);
  * @see sound_manager_set_voip_session_mode()
  * @see sound_manager_get_voip_session_mode()
  */
-int sound_manager_set_session_type (sound_session_type_e type);
+int sound_manager_set_session_type(sound_session_type_e type);
 
 /**
  * @deprecated Deprecated since 3.0.
@@ -765,7 +763,7 @@ int sound_manager_set_session_type (sound_session_type_e type);
  * @see sound_manager_set_voip_session_mode()
  * @see sound_manager_get_voip_session_mode()
  */
-int sound_manager_get_session_type (sound_session_type_e *type);
+int sound_manager_get_session_type(sound_session_type_e *type);
 
 /**
  * @deprecated Deprecated since 3.0. Use sound_manager_create_stream_information() instead.
@@ -785,7 +783,7 @@ int sound_manager_get_session_type (sound_session_type_e *type);
  * @see sound_manager_set_media_session_resumption_option()
  * @see sound_manager_get_media_session_resumption_option()
  */
-int sound_manager_set_media_session_option (sound_session_option_for_starting_e s_option, sound_session_option_for_during_play_e d_option);
+int sound_manager_set_media_session_option(sound_session_option_for_starting_e s_option, sound_session_option_for_during_play_e d_option);
 
 /**
  * @deprecated Deprecated since 3.0. Use sound_manager_create_stream_information() instead.
@@ -805,7 +803,7 @@ int sound_manager_set_media_session_option (sound_session_option_for_starting_e
  * @see sound_manager_set_media_session_resumption_option()
  * @see sound_manager_get_media_session_resumption_option()
  */
-int sound_manager_get_media_session_option (sound_session_option_for_starting_e *s_option, sound_session_option_for_during_play_e *d_option);
+int sound_manager_get_media_session_option(sound_session_option_for_starting_e *s_option, sound_session_option_for_during_play_e *d_option);
 
 /**
  * @deprecated Deprecated since 3.0. Use sound_manager_create_stream_information() instead.
@@ -824,7 +822,7 @@ int sound_manager_get_media_session_option (sound_session_option_for_starting_e
  * @see sound_manager_get_media_session_option()
  * @see sound_manager_get_media_session_resumption_option()
  */
-int sound_manager_set_media_session_resumption_option (sound_session_option_for_resumption_e option);
+int sound_manager_set_media_session_resumption_option(sound_session_option_for_resumption_e option);
 
 /**
  * @deprecated Deprecated since 3.0. Use sound_manager_create_stream_information() instead.
@@ -843,7 +841,7 @@ int sound_manager_set_media_session_resumption_option (sound_session_option_for_
  * @see sound_manager_get_media_session_option()
  * @see sound_manager_set_media_session_resumption_option()
  */
-int sound_manager_get_media_session_resumption_option (sound_session_option_for_resumption_e *option);
+int sound_manager_get_media_session_resumption_option(sound_session_option_for_resumption_e *option);
 
 /**
  * @deprecated Deprecated since 3.0. Use sound_manager_create_stream_information() instead.
@@ -862,7 +860,7 @@ int sound_manager_get_media_session_resumption_option (sound_session_option_for_
  * @see sound_manager_get_session_type()
  * @see sound_manager_get_voip_session_mode()
 */
-int sound_manager_set_voip_session_mode (sound_session_voip_mode_e mode);
+int sound_manager_set_voip_session_mode(sound_session_voip_mode_e mode);
 
 /**
  * @deprecated Deprecated since 3.0. Use sound_manager_create_stream_information() instead.
@@ -881,7 +879,7 @@ int sound_manager_set_voip_session_mode (sound_session_voip_mode_e mode);
  * @see sound_manager_get_session_type()
  * @see sound_manager_set_voip_session_mode()
 */
-int sound_manager_get_voip_session_mode (sound_session_voip_mode_e *mode);
+int sound_manager_get_voip_session_mode(sound_session_voip_mode_e *mode);
 
 /**
  * @deprecated Deprecated since 3.0. Use sound_manager_create_stream_information() instead.
@@ -898,7 +896,7 @@ int sound_manager_get_voip_session_mode (sound_session_voip_mode_e *mode);
  * @see sound_manager_unset_session_interrupted_cb()
  * @see sound_session_interrupted_cb()
  */
-int sound_manager_set_session_interrupted_cb (sound_session_interrupted_cb callback, void *user_data);
+int sound_manager_set_session_interrupted_cb(sound_session_interrupted_cb callback, void *user_data);
 
 /**
  * @deprecated Deprecated since 3.0.
@@ -910,7 +908,7 @@ int sound_manager_set_session_interrupted_cb (sound_session_interrupted_cb callb
  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
  * @see sound_manager_set_session_interrupted_cb()
  */
-int sound_manager_unset_session_interrupted_cb (void);
+int sound_manager_unset_session_interrupted_cb(void);
 
 /**
  * @}
@@ -943,7 +941,7 @@ int sound_manager_unset_session_interrupted_cb (void);
  * @see sound_manager_get_device_name()
  * @see sound_manager_get_device_state()
  */
-int sound_manager_get_current_device_list (sound_device_mask_e device_mask, sound_device_list_h *device_list);
+int sound_manager_get_current_device_list(sound_device_mask_e device_mask, sound_device_list_h *device_list);
 
 /**
  * @brief Gets the next item of the device list.
@@ -963,7 +961,7 @@ int sound_manager_get_current_device_list (sound_device_mask_e device_mask, soun
  * @see sound_manager_get_device_name()
  * @see sound_manager_get_device_state()
  */
-int sound_manager_get_next_device (sound_device_list_h device_list, sound_device_h *device);
+int sound_manager_get_next_device(sound_device_list_h device_list, sound_device_h *device);
 
 /**
  * @brief Gets the previous item of the device list.
@@ -983,7 +981,7 @@ int sound_manager_get_next_device (sound_device_list_h device_list, sound_device
  * @see sound_manager_get_device_name()
  * @see sound_manager_get_device_state()
  */
-int sound_manager_get_prev_device (sound_device_list_h device_list, sound_device_h *device);
+int sound_manager_get_prev_device(sound_device_list_h device_list, sound_device_h *device);
 
 /**
  * @brief Gets the type of the device.
@@ -1002,7 +1000,7 @@ int sound_manager_get_prev_device (sound_device_list_h device_list, sound_device
  * @see sound_manager_get_device_name()
  * @see sound_manager_get_device_state()
  */
-int sound_manager_get_device_type (sound_device_h device, sound_device_type_e *type);
+int sound_manager_get_device_type(sound_device_h device, sound_device_type_e *type);
 
 /**
  * @brief Gets the io direction of the device.
@@ -1021,7 +1019,7 @@ int sound_manager_get_device_type (sound_device_h device, sound_device_type_e *t
  * @see sound_manager_get_device_name()
  * @see sound_manager_get_device_state()
  */
-int sound_manager_get_device_io_direction (sound_device_h device, sound_device_io_direction_e *io_direction);
+int sound_manager_get_device_io_direction(sound_device_h device, sound_device_io_direction_e *io_direction);
 
 /**
  * @brief Gets the id of the device.
@@ -1040,7 +1038,7 @@ int sound_manager_get_device_io_direction (sound_device_h device, sound_device_i
  * @see sound_manager_get_device_name()
  * @see sound_manager_get_device_state()
  */
-int sound_manager_get_device_id (sound_device_h device, int *id);
+int sound_manager_get_device_id(sound_device_h device, int *id);
 
 /**
  * @brief Gets the name of the device.
@@ -1060,7 +1058,7 @@ int sound_manager_get_device_id (sound_device_h device, int *id);
  * @see sound_manager_get_device_id()
  * @see sound_manager_get_device_state()
  */
-int sound_manager_get_device_name (sound_device_h device, char **name);
+int sound_manager_get_device_name(sound_device_h device, char **name);
 
 /**
  * @brief Gets the state of the device.
@@ -1079,7 +1077,7 @@ int sound_manager_get_device_name (sound_device_h device, char **name);
  * @see sound_manager_get_device_id()
  * @see sound_manager_get_device_name()
  */
-int sound_manager_get_device_state (sound_device_h device, sound_device_state_e *state);
+int sound_manager_get_device_state(sound_device_h device, sound_device_state_e *state);
 
 /**
  * @brief Registers a callback function to be invoked when the state of connection of a sound device was changed.
@@ -1099,7 +1097,7 @@ int sound_manager_get_device_state (sound_device_h device, sound_device_state_e
  * @see sound_manager_unset_device_connected_cb()
  * @see sound_device_connected_cb()
  */
-int sound_manager_set_device_connected_cb (sound_device_mask_e device_mask, sound_device_connected_cb callback, void *user_data);
+int sound_manager_set_device_connected_cb(sound_device_mask_e device_mask, sound_device_connected_cb callback, void *user_data);
 
 /**
  * @brief Unregisters the callback function which is called when the state of connection of a sound device was changed.
@@ -1110,7 +1108,7 @@ int sound_manager_set_device_connected_cb (sound_device_mask_e device_mask, soun
  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
  * @see sound_manager_set_device_connected_cb()
  */
-int sound_manager_unset_device_connected_cb (void);
+int sound_manager_unset_device_connected_cb(void);
 
 /**
  * @brief Registers a callback function to be invoked when the information of a sound device was changed.
@@ -1127,7 +1125,7 @@ int sound_manager_unset_device_connected_cb (void);
  * @see sound_manager_unset_device_information_changed_cb()
  * @see sound_device_information_changed_cb()
  */
-int sound_manager_set_device_information_changed_cb (sound_device_mask_e device_mask, sound_device_information_changed_cb callback, void *user_data);
+int sound_manager_set_device_information_changed_cb(sound_device_mask_e device_mask, sound_device_information_changed_cb callback, void *user_data);
 
 /**
  * @brief Unregisters the callback function which is called when the information of a sound device was changed.
@@ -1138,7 +1136,7 @@ int sound_manager_set_device_information_changed_cb (sound_device_mask_e device_
  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
  * @see sound_manager_set_device_information_changed_cb()
  */
-int sound_manager_unset_device_information_changed_cb (void);
+int sound_manager_unset_device_information_changed_cb(void);
 
 /**
  * @}
index 26aa8436a87e72e8eb7a6b7b64d301ef14b18e08..a18b3a292140c118f64a760ad81b18676b349d21 100644 (file)
@@ -72,7 +72,7 @@ typedef enum {
  * @brief Creates a handle for stream information.
  * @since_tizen 3.0
  * @details    To apply the stream policy according to this stream information, this handle should be passed to other APIs\n
- *     related to playback or recording. (e.g., player, wav-player, audio-io, etc.)
+ *     related to playback or recording. (e.g., player, wav-player, audio-io, etc.)
  * @param[in]  stream_type     The type of stream for internal usage
  * @param[in]  callback        The focus state change callback function (mandatory)
  * @param[in]  user_data       The user data to be passed to the callback function
@@ -91,7 +91,7 @@ typedef enum {
  * @see sound_manager_destroy_focus()
  * @see sound_manager_get_focus_state()
  */
-int sound_manager_create_stream_information_internal (sound_stream_type_internal_e stream_type, sound_stream_focus_state_changed_cb callback, void *user_data, sound_stream_info_h *stream_info);
+int sound_manager_create_stream_information_internal(sound_stream_type_internal_e stream_type, sound_stream_focus_state_changed_cb callback, void *user_data, sound_stream_info_h *stream_info);
 
 /**
  * @internal
@@ -114,7 +114,7 @@ int sound_manager_create_stream_information_internal (sound_stream_type_internal
  * @see sound_manager_create_stream_information_internal()
  * @see sound_manager_destroy_stream_information()
  */
-int sound_manager_set_stream_routing_option (sound_stream_info_h stream_info, const char *name, int value);
+int sound_manager_set_stream_routing_option(sound_stream_info_h stream_info, const char *name, int value);
 
 /**
  * @internal
@@ -131,7 +131,7 @@ int sound_manager_set_stream_routing_option (sound_stream_info_h stream_info, co
  * @see sound_manager_create_stream_information()
  * @see sound_manager_destroy_stream_information()
  */
-int sound_manager_is_available_stream_information (sound_stream_info_h stream_info, native_api_e api_name, bool *is_available);
+int sound_manager_is_available_stream_information(sound_stream_info_h stream_info, native_api_e api_name, bool *is_available);
 
 /**
  * @internal
@@ -147,7 +147,7 @@ int sound_manager_is_available_stream_information (sound_stream_info_h stream_in
  * @see sound_manager_create_stream_information()
  * @see sound_manager_destroy_stream_information()
  */
-int sound_manager_get_type_from_stream_information (sound_stream_info_h stream_info, char **type);
+int sound_manager_get_type_from_stream_information(sound_stream_info_h stream_info, char **type);
 
 /**
  * @internal
@@ -163,7 +163,7 @@ int sound_manager_get_type_from_stream_information (sound_stream_info_h stream_i
  * @see sound_manager_create_stream_information()
  * @see sound_manager_destroy_stream_information()
  */
-int sound_manager_get_index_from_stream_information (sound_stream_info_h stream_info, int *index);
+int sound_manager_get_index_from_stream_information(sound_stream_info_h stream_info, int *index);
 
 /**
  * @internal
@@ -184,7 +184,7 @@ int sound_manager_get_index_from_stream_information (sound_stream_info_h stream_
  * @see sound_manager_start_virtual_stream()
  * @see sound_manager_stop_virtual_stream()
  */
-int sound_manager_create_virtual_stream (sound_stream_info_h stream_info, virtual_sound_stream_h *virtual_stream);
+int sound_manager_create_virtual_stream(sound_stream_info_h stream_info, virtual_sound_stream_h *virtual_stream);
 
 /**
  * @internal
@@ -201,7 +201,7 @@ int sound_manager_create_virtual_stream (sound_stream_info_h stream_info, virtua
  * @see sound_manager_start_virtual_stream()
  * @see sound_manager_stop_virtual_stream()
  */
-int sound_manager_destroy_virtual_stream (virtual_sound_stream_h virtual_stream);
+int sound_manager_destroy_virtual_stream(virtual_sound_stream_h virtual_stream);
 
 /**
  * @internal
@@ -219,7 +219,7 @@ int sound_manager_destroy_virtual_stream (virtual_sound_stream_h virtual_stream)
  * @see sound_manager_destroy_virtual_stream()
  * @see sound_manager_stop_virtual_stream()
  */
-int sound_manager_start_virtual_stream (virtual_sound_stream_h virtual_stream);
+int sound_manager_start_virtual_stream(virtual_sound_stream_h virtual_stream);
 
 /**
  * @internal
@@ -236,7 +236,7 @@ int sound_manager_start_virtual_stream (virtual_sound_stream_h virtual_stream);
  * @see sound_manager_destroy_virtual_stream()
  * @see sound_manager_start_virtual_stream()
  */
-int sound_manager_stop_virtual_stream (virtual_sound_stream_h virtual_stream);
+int sound_manager_stop_virtual_stream(virtual_sound_stream_h virtual_stream);
 
 /**
  * @}
index ff1a218ef7a62ce7106b23031421382288932d0f..104bac8eac865f3f8ed3319c0b37537ab2b7d665 100644 (file)
@@ -43,38 +43,40 @@ extern "C"
 #include <mm_sound_private.h>
 #include "sound_manager_internal.h"
 
-#define _CHECK_CONDITION(condition,error,msg)     \
-    if(condition) {} else \
-    { LOGE("[%s] %s(0x%08x)",__FUNCTION__, msg,error); return error;}; \
+#define _CHECK_CONDITION(condition, error, msg)     \
+if (condition) { \
+} else { \
+       LOGE("[%s] %s(0x%08x)", __FUNCTION__, msg, error); \
+       return error; \
+}; \
 
-#define SM_INSTANCE_CHECK(handle)   \
-        _CHECK_CONDITION(handle != NULL,SOUND_MANAGER_ERROR_INVALID_PARAMETER,"SOUND_MANAGER_ERROR_INVALID_PARAMETER")
+#define SM_INSTANCE_CHECK(handle) \
+_CHECK_CONDITION(handle != NULL, SOUND_MANAGER_ERROR_INVALID_PARAMETER, "SOUND_MANAGER_ERROR_INVALID_PARAMETER")
 
-#define SM_NULL_ARG_CHECK(arg)      \
-        _CHECK_CONDITION(arg != NULL,SOUND_MANAGER_ERROR_INVALID_PARAMETER,"SOUND_MANAGER_ERROR_INVALID_PARAMETER")
+#define SM_NULL_ARG_CHECK(arg) \
+_CHECK_CONDITION(arg != NULL, SOUND_MANAGER_ERROR_INVALID_PARAMETER, "SOUND_MANAGER_ERROR_INVALID_PARAMETER")
 
-#define SM_STATE_CHECK(handle,expected_state)       \
-        _CHECK_CONDITION(handle->state == expected_state,SOUND_MANAGER_ERROR_INVALID_STATE,"SOUND_MANAGER_ERROR_INVALID_STATE")
+#define SM_STATE_CHECK(handle, expected_state) \
+_CHECK_CONDITION(handle->state == expected_state, SOUND_MANAGER_ERROR_INVALID_STATE, "SOUND_MANAGER_ERROR_INVALID_STATE")
 
-#define SM_RANGE_ARG_CHECK(arg, min, max)      \
-        _CHECK_CONDITION(arg <= max,SOUND_MANAGER_ERROR_INVALID_PARAMETER,"SOUND_MANAGER_ERROR_INVALID_PARAMETER") \
-        _CHECK_CONDITION(arg >= min,SOUND_MANAGER_ERROR_INVALID_PARAMETER,"SOUND_MANAGER_ERROR_INVALID_PARAMETER")
+#define SM_RANGE_ARG_CHECK(arg, min, max) \
+_CHECK_CONDITION(arg <= max, SOUND_MANAGER_ERROR_INVALID_PARAMETER, "SOUND_MANAGER_ERROR_INVALID_PARAMETER") \
+_CHECK_CONDITION(arg >= min, SOUND_MANAGER_ERROR_INVALID_PARAMETER, "SOUND_MANAGER_ERROR_INVALID_PARAMETER")
 
-#define SM_INSTANCE_CHECK_FOR_PRIV(handle)   \
-        _CHECK_CONDITION(handle != NULL,MM_ERROR_INVALID_ARGUMENT,"MM_ERROR_INVALID_ARGUMENT")
+#define SM_INSTANCE_CHECK_FOR_PRIV(handle) \
+_CHECK_CONDITION(handle != NULL, MM_ERROR_INVALID_ARGUMENT, "MM_ERROR_INVALID_ARGUMENT")
 
-#define SM_NULL_ARG_CHECK_FOR_PRIV(arg)      \
-        _CHECK_CONDITION(arg != NULL,MM_ERROR_INVALID_ARGUMENT,"MM_ERROR_INVALID_ARGUMENT")
+#define SM_NULL_ARG_CHECK_FOR_PRIV(arg) \
+_CHECK_CONDITION(arg != NULL, MM_ERROR_INVALID_ARGUMENT, "MM_ERROR_INVALID_ARGUMENT")
 
-#define SM_STATE_CHECK_FOR_PRIV(handle,expected_state)       \
-        _CHECK_CONDITION(handle->state == expected_state,MM_ERROR_SOUND_INVALID_STATE,"MM_ERROR_SOUND_INVALID_STATE")
+#define SM_STATE_CHECK_FOR_PRIV(handle, expected_state) \
+_CHECK_CONDITION(handle->state == expected_state, MM_ERROR_SOUND_INVALID_STATE, "MM_ERROR_SOUND_INVALID_STATE")
 
-#define SM_ENTER_CRITICAL_SECTION_WITH_RETURN(x_mutex,x_return) \
-switch ( pthread_mutex_lock( x_mutex ) ) \
-{ \
+#define SM_ENTER_CRITICAL_SECTION_WITH_RETURN(x_mutex, x_return) \
+switch (pthread_mutex_lock(x_mutex)) { \
 case EINVAL: \
        LOGW("try mutex init..\n"); \
-       if( 0 > pthread_mutex_init( x_mutex, NULL) ) { \
+       if (0 > pthread_mutex_init(x_mutex, NULL)) { \
                return x_return; \
        } else { \
                break; \
@@ -88,7 +90,7 @@ default: \
 }
 
 #define SM_LEAVE_CRITICAL_SECTION(x_mutex) \
-if( pthread_mutex_unlock( x_mutex ) ) { \
+if (pthread_mutex_unlock(x_mutex)) { \
        LOGE("mutex unlock failed\n"); \
 }
 
@@ -184,95 +186,95 @@ typedef struct {
        unsigned int subs_id; /* for internal device connected subscription */
        void *user_data;
        sound_session_interrupted_cb user_cb;
-}_session_interrupt_info_s;
+} _session_interrupt_info_s;
 
 typedef struct {
        unsigned int subs_id;
        void *user_data;
        sound_manager_volume_changed_cb user_cb;
-}_volume_changed_info_s;
+} _volume_changed_info_s;
 
 typedef struct {
        int index;
        void *user_data;
        sound_stream_focus_state_watch_cb user_cb;
-}_focus_watch_info_s;
+} _focus_watch_info_s;
 
 typedef struct {
        unsigned int subs_id;
        void *user_data;
        sound_device_connected_cb user_cb;
-}_device_connected_info_s;
+} _device_connected_info_s;
 
 typedef struct {
        unsigned int subs_id;
        void *user_data;
        sound_device_information_changed_cb user_cb;
-}_device_changed_info_s;
+} _device_changed_info_s;
 
-void _focus_session_interrupt_cb (mm_sound_focus_state_e state, const char *reason_for_change, bool is_wcb, void *user_data);
+void _focus_session_interrupt_cb(mm_sound_focus_state_e state, const char *reason_for_change, bool is_wcb, void *user_data);
 
-void _voip_focus_state_change_callback (sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data);
+void _voip_focus_state_change_callback(sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data);
 
 void _device_connected_cb(sound_device_h device, bool is_connected, void *user_data);
 
-void _focus_state_change_callback (int index, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e state, const char *reason_for_change, const char *additional_info, void *user_data);
+void _focus_state_change_callback(int index, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e state, const char *reason_for_change, const char *additional_info, void *user_data);
 
-void _focus_watch_callback (int id, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e state, const char *reason_for_change, const char *additional_info, void *user_data);
+void _focus_watch_callback(int id, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e state, const char *reason_for_change, const char *additional_info, void *user_data);
 
-int _convert_sound_manager_error_code (const char *func, int code);
+int _convert_sound_manager_error_code(const char *func, int code);
 
-int _convert_stream_type (sound_stream_type_e enum_type, char **stream_type);
+int _convert_stream_type(sound_stream_type_e enum_type, char **stream_type);
 
-int _convert_stream_type_for_internal (sound_stream_type_internal_e stream_type_enum, char **stream_type);
+int _convert_stream_type_for_internal(sound_stream_type_internal_e stream_type_enum, char **stream_type);
 
-int _convert_stream_type_to_change_reason (const char *stream_type, sound_stream_focus_change_reason_e *change_reason);
+int _convert_stream_type_to_change_reason(const char *stream_type, sound_stream_focus_change_reason_e *change_reason);
 
-int _convert_device_type (sound_device_type_e device_type_enum, char **device_type);
+int _convert_device_type(sound_device_type_e device_type_enum, char **device_type);
 
-int _convert_device_io_direction (mm_sound_device_io_direction_e io_direction, sound_device_io_direction_e *sound_io_direction);
+int _convert_device_io_direction(mm_sound_device_io_direction_e io_direction, sound_device_io_direction_e *sound_io_direction);
 
-const char* _convert_api_name (native_api_e api_name);
+const char* _convert_api_name(native_api_e api_name);
 
-int _get_stream_conf_info (const char *stream_type, stream_conf_info_s *info);
+int _get_stream_conf_info(const char *stream_type, stream_conf_info_s *info);
 
-int _set_manual_route_info (unsigned int index, manual_route_info_s *info);
+int _set_manual_route_info(unsigned int index, manual_route_info_s *info);
 
-int _set_route_option (unsigned int index, const char *key, int value);
+int _set_route_option(unsigned int index, const char *key, int value);
 
-int _convert_sound_type (sound_type_e sound_type, const char **volume_type);
+int _convert_sound_type(sound_type_e sound_type, const char **volume_type);
 
-int _convert_sound_type_to_enum (char *sound_type, sound_type_e *sound_type_enum);
+int _convert_sound_type_to_enum(char *sound_type, sound_type_e *sound_type_enum);
 
-int _get_volume_max_level (const char *direction, const char *volume_type, unsigned int *max_level);
+int _get_volume_max_level(const char *direction, const char *volume_type, unsigned int *max_level);
 
-int _get_current_volume_type (const char *direction, char **volume_type);
+int _get_current_volume_type(const char *direction, char **volume_type);
 
-void _update_focus_status (unsigned int index, unsigned int acquired_focus_status);
+void _update_focus_status(unsigned int index, unsigned int acquired_focus_status);
 
-void _pa_context_state_cb (pa_context *c, void *userdata);
+void _pa_context_state_cb(pa_context *c, void *userdata);
 
-void _pa_stream_state_cb (pa_stream *s, void * userdata);
+void _pa_stream_state_cb(pa_stream *s, void * userdata);
 
-int _set_session_mode (_session_mode_e mode);
+int _set_session_mode(_session_mode_e mode);
 
 int _make_pa_connection_and_register_focus(sound_stream_info_s *stream_h, sound_stream_focus_state_changed_cb callback, void *user_data);
 
 int _destroy_pa_connection_and_unregister_focus(sound_stream_info_s *stream_h);
 
-int _add_device_for_stream_routing (sound_stream_info_s *stream_info, sound_device_h device);
+int _add_device_for_stream_routing(sound_stream_info_s *stream_info, sound_device_h device);
 
-int _remove_device_for_stream_routing (sound_stream_info_s *stream_info, sound_device_h device);
+int _remove_device_for_stream_routing(sound_stream_info_s *stream_info, sound_device_h device);
 
-int _apply_stream_routing (sound_stream_info_s *stream_info);
+int _apply_stream_routing(sound_stream_info_s *stream_info);
 
-int _create_virtual_stream (sound_stream_info_s *stream_info, virtual_sound_stream_info_s **virtual_stream);
+int _create_virtual_stream(sound_stream_info_s *stream_info, virtual_sound_stream_info_s **virtual_stream);
 
-int _destroy_virtual_stream (virtual_sound_stream_info_s *virtual_stream);
+int _destroy_virtual_stream(virtual_sound_stream_info_s *virtual_stream);
 
-int _start_virtual_stream (virtual_sound_stream_info_s *virtual_stream);
+int _start_virtual_stream(virtual_sound_stream_info_s *virtual_stream);
 
-int _stop_virtual_stream (virtual_sound_stream_info_s *virtual_stream);
+int _stop_virtual_stream(virtual_sound_stream_info_s *virtual_stream);
 
 #ifdef __cplusplus
 }
index 42241ed857495ff32ee77fe1fb78b1fab112a2de..87fc84c0e428296d66d0e7cb25c1e37505f4a803 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.3.21
+Version:    0.3.22
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 44a3a7127f8a8bbc6eb14979b26655bf84c7b195..e4b4bcfd1464fe969d95393c47682dc180bbb7e4 100644 (file)
@@ -35,7 +35,7 @@ extern int g_stream_info_count;
 extern pthread_mutex_t g_stream_info_count_mutex;
 pthread_mutex_t g_interrupt_cb_mutex, g_device_info_cb_mutex, g_device_conn_cb_mutex, g_volume_cb_mutex;
 
-int sound_manager_get_max_volume (sound_type_e type, int *max)
+int sound_manager_get_max_volume(sound_type_e type, int *max)
 {
        const char *volume_type = NULL;
        unsigned int max_level = 0;
@@ -46,17 +46,17 @@ int sound_manager_get_max_volume (sound_type_e type, int *max)
 
        if (type >= SOUND_TYPE_NUM || type < 0)
                return _convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
-       ret = _convert_sound_type (type, &volume_type);
+       ret = _convert_sound_type(type, &volume_type);
        if (ret == MM_ERROR_NONE) {
                ret = _get_volume_max_level("out", volume_type, &max_level);
                if (ret == MM_ERROR_NONE)
-                       *max = (int)max_level -1;       // actual volume step can be max step - 1
+                       *max = (int)max_level -1;       /* actual volume step can be max step - 1 */
        }
 
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_set_volume (sound_type_e type, int volume)
+int sound_manager_set_volume(sound_type_e type, int volume)
 {
        int ret = MM_ERROR_NONE;
 
@@ -71,7 +71,7 @@ int sound_manager_set_volume (sound_type_e type, int volume)
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_get_volume (sound_type_e type, int *volume)
+int sound_manager_get_volume(sound_type_e type, int *volume)
 {
        int ret = MM_ERROR_NONE;
        unsigned int uvolume;
@@ -90,7 +90,7 @@ int sound_manager_get_volume (sound_type_e type, int *volume)
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_set_current_sound_type (sound_type_e type)
+int sound_manager_set_current_sound_type(sound_type_e type)
 {
        int ret = MM_ERROR_NONE;
 
@@ -102,7 +102,7 @@ int sound_manager_set_current_sound_type (sound_type_e type)
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_get_current_sound_type (sound_type_e *type)
+int sound_manager_get_current_sound_type(sound_type_e *type)
 {
        int ret = MM_ERROR_NONE;
        volume_type_t mm_sound_vol_type = VOLUME_TYPE_UNKNOWN;
@@ -115,9 +115,9 @@ int sound_manager_get_current_sound_type (sound_type_e *type)
        if (ret == MM_ERROR_NONE) {
                if (mm_sound_vol_type == VOLUME_TYPE_UNKNOWN) {
                        /* get the volume type of the current playing stream */
-                       ret = _get_current_volume_type ("out", &volume_type);
+                       ret = _get_current_volume_type("out", &volume_type);
                        if (ret == MM_ERROR_NONE) {
-                               ret = _convert_sound_type_to_enum (volume_type, type);
+                               ret = _convert_sound_type_to_enum(volume_type, type);
                                free(volume_type);
                        }
                } else {
@@ -129,7 +129,7 @@ int sound_manager_get_current_sound_type (sound_type_e *type)
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_unset_current_sound_type (void)
+int sound_manager_unset_current_sound_type(void)
 {
        int ret = MM_ERROR_NONE;
 
@@ -138,7 +138,7 @@ int sound_manager_unset_current_sound_type (void)
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_set_volume_changed_cb (sound_manager_volume_changed_cb callback, void* user_data)
+int sound_manager_set_volume_changed_cb(sound_manager_volume_changed_cb callback, void* user_data)
 {
        int ret = MM_ERROR_NONE;
        unsigned int subs_id = 0;
@@ -157,7 +157,7 @@ int sound_manager_set_volume_changed_cb (sound_manager_volume_changed_cb callbac
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_unset_volume_changed_cb (void)
+int sound_manager_unset_volume_changed_cb(void)
 {
        int ret = MM_ERROR_NONE;
 
@@ -179,7 +179,7 @@ int sound_manager_unset_volume_changed_cb (void)
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_create_stream_information (sound_stream_type_e stream_type, sound_stream_focus_state_changed_cb callback, void *user_data, sound_stream_info_h *stream_info)
+int sound_manager_create_stream_information(sound_stream_type_e stream_type, sound_stream_focus_state_changed_cb callback, void *user_data, sound_stream_info_h *stream_info)
 {
        int ret = MM_ERROR_NONE;
 
@@ -198,7 +198,7 @@ int sound_manager_create_stream_information (sound_stream_type_e stream_type, so
                memset(stream_h, 0, sizeof(sound_stream_info_s));
                ret = _convert_stream_type(stream_type, &stream_h->stream_type);
                if (ret == MM_ERROR_NONE) {
-                       SM_ENTER_CRITICAL_SECTION_WITH_RETURN( &g_stream_info_count_mutex, MM_ERROR_SOUND_INTERNAL);
+                       SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_stream_info_count_mutex, MM_ERROR_SOUND_INTERNAL);
                        ret = _make_pa_connection_and_register_focus(stream_h, callback, user_data);
                        if (ret == MM_ERROR_NONE) {
                                *stream_info = (sound_stream_info_h)stream_h;
@@ -207,15 +207,14 @@ int sound_manager_create_stream_information (sound_stream_type_e stream_type, so
                        }
                        SM_LEAVE_CRITICAL_SECTION(&g_stream_info_count_mutex);
                }
-               if (ret) {
+               if (ret)
                        free(stream_h);
-               }
        }
 
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_destroy_stream_information (sound_stream_info_h stream_info)
+int sound_manager_destroy_stream_information(sound_stream_info_h stream_info)
 {
        int ret = MM_ERROR_NONE;
        sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
@@ -224,7 +223,7 @@ int sound_manager_destroy_stream_information (sound_stream_info_h stream_info)
 
        SM_INSTANCE_CHECK(stream_h);
 
-       SM_ENTER_CRITICAL_SECTION_WITH_RETURN( &g_stream_info_count_mutex, MM_ERROR_SOUND_INTERNAL);
+       SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_stream_info_count_mutex, MM_ERROR_SOUND_INTERNAL);
        ret = _destroy_pa_connection_and_unregister_focus(stream_h);
        free(stream_h);
        stream_h = NULL;
@@ -236,7 +235,7 @@ int sound_manager_destroy_stream_information (sound_stream_info_h stream_info)
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_add_device_for_stream_routing (sound_stream_info_h stream_info, sound_device_h device)
+int sound_manager_add_device_for_stream_routing(sound_stream_info_h stream_info, sound_device_h device)
 {
        int ret = MM_ERROR_NONE;
        sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
@@ -250,7 +249,7 @@ int sound_manager_add_device_for_stream_routing (sound_stream_info_h stream_info
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_remove_device_for_stream_routing (sound_stream_info_h stream_info, sound_device_h device)
+int sound_manager_remove_device_for_stream_routing(sound_stream_info_h stream_info, sound_device_h device)
 {
        int ret = MM_ERROR_NONE;
        sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
@@ -264,7 +263,7 @@ int sound_manager_remove_device_for_stream_routing (sound_stream_info_h stream_i
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_apply_stream_routing (sound_stream_info_h stream_info)
+int sound_manager_apply_stream_routing(sound_stream_info_h stream_info)
 {
        int ret = MM_ERROR_NONE;
        sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
@@ -278,7 +277,7 @@ int sound_manager_apply_stream_routing (sound_stream_info_h stream_info)
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_acquire_focus (sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, const char *additional_info)
+int sound_manager_acquire_focus(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, const char *additional_info)
 {
        int ret = MM_ERROR_NONE;
        sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
@@ -298,7 +297,7 @@ int sound_manager_acquire_focus (sound_stream_info_h stream_info, sound_stream_f
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_release_focus (sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, const char *additional_info)
+int sound_manager_release_focus(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, const char *additional_info)
 {
        int ret = MM_ERROR_NONE;
        sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
@@ -318,7 +317,7 @@ int sound_manager_release_focus (sound_stream_info_h stream_info, sound_stream_f
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_get_focus_state (sound_stream_info_h stream_info, sound_stream_focus_state_e *state_for_playback, sound_stream_focus_state_e *state_for_recording)
+int sound_manager_get_focus_state(sound_stream_info_h stream_info, sound_stream_focus_state_e *state_for_playback, sound_stream_focus_state_e *state_for_recording)
 {
        int ret = MM_ERROR_NONE;
        sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
@@ -330,16 +329,16 @@ int sound_manager_get_focus_state (sound_stream_info_h stream_info, sound_stream
                ret = MM_ERROR_INVALID_ARGUMENT;
 
        if (state_for_playback)
-               *state_for_playback = (stream_h->acquired_focus & SOUND_STREAM_FOCUS_FOR_PLAYBACK)?SOUND_STREAM_FOCUS_STATE_ACQUIRED:SOUND_STREAM_FOCUS_STATE_RELEASED;
+               *state_for_playback = ((stream_h->acquired_focus & SOUND_STREAM_FOCUS_FOR_PLAYBACK) ? (SOUND_STREAM_FOCUS_STATE_ACQUIRED) : (SOUND_STREAM_FOCUS_STATE_RELEASED));
        if (state_for_recording)
-               *state_for_recording = (stream_h->acquired_focus & SOUND_STREAM_FOCUS_FOR_RECORDING)?SOUND_STREAM_FOCUS_STATE_ACQUIRED:SOUND_STREAM_FOCUS_STATE_RELEASED;
+               *state_for_recording = ((stream_h->acquired_focus & SOUND_STREAM_FOCUS_FOR_RECORDING) ? (SOUND_STREAM_FOCUS_STATE_ACQUIRED) : (SOUND_STREAM_FOCUS_STATE_RELEASED));
 
        LOGI("<< leave : acquired_focus(%p)", stream_h->acquired_focus);
 
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_set_focus_state_watch_cb (sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_watch_cb callback, void *user_data)
+int sound_manager_set_focus_state_watch_cb(sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_watch_cb callback, void *user_data)
 {
        int ret = MM_ERROR_NONE;
        int id = -1;
@@ -368,7 +367,7 @@ int sound_manager_set_focus_state_watch_cb (sound_stream_focus_mask_e focus_mask
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_unset_focus_state_watch_cb (void)
+int sound_manager_unset_focus_state_watch_cb(void)
 {
        int ret = MM_ERROR_NONE;
 
@@ -397,7 +396,7 @@ int sound_manager_unset_focus_state_watch_cb (void)
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_set_session_type (sound_session_type_e type)
+int sound_manager_set_session_type(sound_session_type_e type)
 {
        int ret = MM_ERROR_NONE;
        int cur_session = -1;
@@ -450,16 +449,16 @@ int sound_manager_set_session_type (sound_session_type_e type)
                        return SOUND_MANAGER_ERROR_NONE;
                } else {
                        ret = mm_session_finish();
-                       if (ret != MM_ERROR_NONE) {
+                       if (ret != MM_ERROR_NONE)
                                return _convert_sound_manager_error_code(__func__, ret);
-                       }
+
                        g_session_interrupt_cb_table.is_registered = 0;
                        if (cur_session == MM_SESSION_TYPE_VOIP) {
                                g_cached_session_mode = -1;
                                g_cached_voip_device_id = -1;
                                if (g_voip_vstream_h) {
-                                       _stop_virtual_stream (g_voip_vstream_h);
-                                       _destroy_virtual_stream (g_voip_vstream_h);
+                                       _stop_virtual_stream(g_voip_vstream_h);
+                                       _destroy_virtual_stream(g_voip_vstream_h);
                                        g_voip_vstream_h = NULL;
                                }
                                /*voip stream destruction*/
@@ -467,24 +466,22 @@ int sound_manager_set_session_type (sound_session_type_e type)
                                        ret = _destroy_pa_connection_and_unregister_focus(g_voip_stream_info);
                                        free(g_voip_stream_info);
                                        g_voip_stream_info = NULL;
-                                       if (ret != MM_ERROR_NONE) {
+                                       if (ret != MM_ERROR_NONE)
                                                return _convert_sound_manager_error_code(__func__, ret);
-                                       }
                                }
                        }
                }
        }
        ret = mm_session_init(new_session);
-       if (ret == MM_ERROR_NONE) {
+       if (ret == MM_ERROR_NONE)
                g_session_interrupt_cb_table.is_registered = 1;
-       }
 
        LOGI("<< leave : type=%d, ret=%p", type, ret);
 
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_get_session_type (sound_session_type_e *type)
+int sound_manager_get_session_type(sound_session_type_e *type)
 {
        int ret = MM_ERROR_NONE;
        int cur_session;
@@ -496,15 +493,14 @@ int sound_manager_get_session_type (sound_session_type_e *type)
                LOGW("session hasn't been set, setting default session");
                cur_session = SOUND_SESSION_TYPE_DEFAULT;
                ret = mm_session_init(cur_session);
-               if (ret == 0) {
+               if (ret == 0)
                        g_session_interrupt_cb_table.is_registered = 1;
-               }
        }
        if ((cur_session > MM_SESSION_TYPE_EMERGENCY) &&
                        (cur_session != MM_SESSION_TYPE_VOIP)) {
                if (g_cached_session != -1)
                        cur_session = g_cached_session;
-               else //will be never reach here. just prevent code
+               else /* will be never reach here. just prevent code */
                        cur_session = SOUND_SESSION_TYPE_DEFAULT;
        }
 
@@ -535,7 +531,7 @@ int sound_manager_get_session_type (sound_session_type_e *type)
        return 0;
 }
 
-int sound_manager_set_media_session_option (sound_session_option_for_starting_e s_option, sound_session_option_for_during_play_e d_option)
+int sound_manager_set_media_session_option(sound_session_option_for_starting_e s_option, sound_session_option_for_during_play_e d_option)
 {
        int ret = MM_ERROR_NONE;
        int session = 0;
@@ -553,9 +549,9 @@ int sound_manager_set_media_session_option (sound_session_option_for_starting_e
        if (ret != 0 || !g_session_interrupt_cb_table.is_registered) {
                LOGW("session hasn't been set, setting default session");
                ret = mm_session_init(MM_SESSION_TYPE_MEDIA);
-               if (ret == 0) {
+               if (ret == 0)
                        g_session_interrupt_cb_table.is_registered = 1;
-               }
+
        } else if (ret == 0 && session > MM_SESSION_TYPE_MEDIA) {
                if (session == MM_SESSION_TYPE_MEDIA_RECORD) {
                        if (!g_session_interrupt_cb_table.is_registered) {
@@ -571,18 +567,18 @@ int sound_manager_set_media_session_option (sound_session_option_for_starting_e
        case SOUND_SESSION_OPTION_MIX_WITH_OTHERS_WHEN_START:
                if (session_option & MM_SESSION_OPTION_PAUSE_OTHERS) {
                        ret = mm_session_update_option(MM_SESSION_UPDATE_TYPE_REMOVE, MM_SESSION_OPTION_PAUSE_OTHERS);
-                       if (ret) {
+                       if (ret)
                                return _convert_sound_manager_error_code(__func__, ret);
-                       }
+
                        updated = 1;
                }
                break;
        case SOUND_SESSION_OPTION_PAUSE_OTHERS_WHEN_START:
                if (!(session_option & MM_SESSION_OPTION_PAUSE_OTHERS)) {
                        ret = mm_session_update_option(MM_SESSION_UPDATE_TYPE_ADD, MM_SESSION_OPTION_PAUSE_OTHERS);
-                       if (ret) {
+                       if (ret)
                                return _convert_sound_manager_error_code(__func__, ret);
-                       }
+
                        updated = 1;
                }
                break;
@@ -592,33 +588,32 @@ int sound_manager_set_media_session_option (sound_session_option_for_starting_e
        case SOUND_SESSION_OPTION_INTERRUPTIBLE_DURING_PLAY:
                if (session_option & MM_SESSION_OPTION_UNINTERRUPTIBLE) {
                        ret = mm_session_update_option(MM_SESSION_UPDATE_TYPE_REMOVE, MM_SESSION_OPTION_UNINTERRUPTIBLE);
-                       if (ret) {
+                       if (ret)
                                return _convert_sound_manager_error_code(__func__, ret);
-                       }
+
                        updated = 1;
                }
                break;
        case SOUND_SESSION_OPTION_UNINTERRUPTIBLE_DURING_PLAY:
                if (!(session_option & MM_SESSION_OPTION_UNINTERRUPTIBLE)) {
                        ret = mm_session_update_option(MM_SESSION_UPDATE_TYPE_ADD, MM_SESSION_OPTION_UNINTERRUPTIBLE);
-                       if (ret) {
+                       if (ret)
                                return _convert_sound_manager_error_code(__func__, ret);
-                       }
+
                        updated = 1;
                }
                break;
        }
 
-       if (updated) {
+       if (updated)
                LOGI("<< leave : updated");
-       } else {
+       else
                LOGI("<< leave : already set same option(%x), skip it", session_option);
-       }
 
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_get_media_session_option (sound_session_option_for_starting_e *s_option, sound_session_option_for_during_play_e *d_option)
+int sound_manager_get_media_session_option(sound_session_option_for_starting_e *s_option, sound_session_option_for_during_play_e *d_option)
 {
        int ret = MM_ERROR_NONE;
        int session = 0;
@@ -632,37 +627,35 @@ int sound_manager_get_media_session_option (sound_session_option_for_starting_e
        ret = mm_session_get_current_information(&session, &session_options);
        if (ret != 0) {
                ret = mm_session_init(MM_SESSION_TYPE_MEDIA);
-               if (ret == 0) {
+               if (ret == 0)
                        g_session_interrupt_cb_table.is_registered = 1;
-               }
+
        } else if (session > SOUND_SESSION_TYPE_MEDIA) {
                if (session == MM_SESSION_TYPE_MEDIA_RECORD) {
                        if (!g_session_interrupt_cb_table.is_registered) {
                                LOGE("Already set by camera/recorder/audio-io(in)/radio API, but need to set session to Media first");
                                return _convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
                        }
-               } else {
+               } else
                        return _convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
-               }
        }
        /* get option */
-       if (session_options & MM_SESSION_OPTION_PAUSE_OTHERS) {
+       if (session_options & MM_SESSION_OPTION_PAUSE_OTHERS)
                *s_option = SOUND_SESSION_OPTION_PAUSE_OTHERS_WHEN_START;
-       } else {
+       else
                *s_option = SOUND_SESSION_OPTION_MIX_WITH_OTHERS_WHEN_START;
-       }
-       if (session_options & MM_SESSION_OPTION_UNINTERRUPTIBLE) {
+
+       if (session_options & MM_SESSION_OPTION_UNINTERRUPTIBLE)
                *d_option = SOUND_SESSION_OPTION_UNINTERRUPTIBLE_DURING_PLAY;
-       } else {
+       else
                *d_option = SOUND_SESSION_OPTION_INTERRUPTIBLE_DURING_PLAY;
-       }
 
        LOGI("<< leave : option for starting=%d, for during play=%d", *s_option, *d_option);
 
        return SOUND_MANAGER_ERROR_NONE;
 }
 
-int sound_manager_set_media_session_resumption_option (sound_session_option_for_resumption_e option)
+int sound_manager_set_media_session_resumption_option(sound_session_option_for_resumption_e option)
 {
        int ret = MM_ERROR_NONE;
        int session = 0;
@@ -678,51 +671,50 @@ int sound_manager_set_media_session_resumption_option (sound_session_option_for_
        if (ret != 0 || !g_session_interrupt_cb_table.is_registered) {
                LOGW("session hasn't been set, setting default session");
                ret = mm_session_init(MM_SESSION_TYPE_MEDIA);
-               if (ret == 0) {
+               if (ret == 0)
                        g_session_interrupt_cb_table.is_registered = 1;
-               }
+
        } else if (ret == 0 && session > MM_SESSION_TYPE_MEDIA) {
                if (session == MM_SESSION_TYPE_MEDIA_RECORD) {
                        if (!g_session_interrupt_cb_table.is_registered) {
                                LOGE("Already set by camera/recorder/audio-io(in)/radio API, but need to set session to Media first");
                                return _convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
                        }
-               } else {
+               } else
                        return _convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
-               }
+
        }
 
        switch (option) {
        case SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM:
                if (session_option & MM_SESSION_OPTION_RESUME_BY_SYSTEM_OR_MEDIA_PAUSED) {
                        ret = mm_session_update_option(MM_SESSION_UPDATE_TYPE_REMOVE, MM_SESSION_OPTION_RESUME_BY_SYSTEM_OR_MEDIA_PAUSED);
-                       if (ret) {
+                       if (ret)
                                return _convert_sound_manager_error_code(__func__, ret);
-                       }
+
                        updated = 1;
                }
                break;
        case SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM_OR_MEDIA_PAUSED:
                if (!(session_option & MM_SESSION_OPTION_RESUME_BY_SYSTEM_OR_MEDIA_PAUSED)) {
                        ret = mm_session_update_option(MM_SESSION_UPDATE_TYPE_ADD, MM_SESSION_OPTION_RESUME_BY_SYSTEM_OR_MEDIA_PAUSED);
-                       if (ret) {
+                       if (ret)
                                return _convert_sound_manager_error_code(__func__, ret);
-                       }
+
                        updated = 1;
                }
                break;
        }
 
-       if (updated) {
+       if (updated)
                LOGI("<< leave : updated");
-       } else {
+       else
                LOGI("<< leave : already set same option(%x), skip it", session_option);
-       }
 
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_get_media_session_resumption_option (sound_session_option_for_resumption_e *option)
+int sound_manager_get_media_session_resumption_option(sound_session_option_for_resumption_e *option)
 {
        int ret = MM_ERROR_NONE;
        int session = 0;
@@ -736,32 +728,30 @@ int sound_manager_get_media_session_resumption_option (sound_session_option_for_
        if (ret != 0) {
                LOGW("session hasn't been set, setting default session");
                ret = mm_session_init(MM_SESSION_TYPE_MEDIA);
-               if (ret == 0) {
+               if (ret == 0)
                        g_session_interrupt_cb_table.is_registered = 1;
-               }
+
        } else if (session > SOUND_SESSION_TYPE_MEDIA) {
                if (session == MM_SESSION_TYPE_MEDIA_RECORD) {
                        if (!g_session_interrupt_cb_table.is_registered) {
                                LOGE("Already set by camera/recorder/audio-io(in)/radio API, but need to set session to Media first");
                                return _convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
                        }
-               } else {
+               } else
                        return _convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
-               }
        }
        /* get option */
-       if (session_options & MM_SESSION_OPTION_RESUME_BY_SYSTEM_OR_MEDIA_PAUSED) {
+       if (session_options & MM_SESSION_OPTION_RESUME_BY_SYSTEM_OR_MEDIA_PAUSED)
                *option = SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM_OR_MEDIA_PAUSED;
-       } else {
+       else
                *option = SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM;
-       }
 
        LOGI("<< leave : option for resumption=%d (0:by system, 1:by system or media paused)", *option);
 
        return SOUND_MANAGER_ERROR_NONE;
 }
 
-int sound_manager_set_voip_session_mode (sound_session_voip_mode_e mode)
+int sound_manager_set_voip_session_mode(sound_session_voip_mode_e mode)
 {
        int ret = MM_ERROR_NONE;
        int session = 0;
@@ -770,23 +760,23 @@ int sound_manager_set_voip_session_mode (sound_session_voip_mode_e mode)
        LOGI(">> enter : mode=%d", mode);
 
        ret = mm_session_get_current_information(&session, &session_options);
-       if (ret != MM_ERROR_NONE) {
+       if (ret != MM_ERROR_NONE)
                return _convert_sound_manager_error_code(__func__, ret);
-       } else if (session != MM_SESSION_TYPE_VOIP) {
+       else if (session != MM_SESSION_TYPE_VOIP)
                return _convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
-       }
+
        if (mode < SOUND_SESSION_VOIP_MODE_RINGTONE || mode > SOUND_SESSION_VOIP_MODE_VOICE_WITH_BLUETOOTH) {
                ret = MM_ERROR_INVALID_ARGUMENT;
                return _convert_sound_manager_error_code(__func__, ret);
        }
-       ret = _set_session_mode ((_session_mode_e)mode);
+       ret = _set_session_mode((_session_mode_e)mode);
 
        LOGI("<< leave : session=%p, mode=%d, ret=%p", session, mode, ret);
 
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_get_voip_session_mode (sound_session_voip_mode_e *mode)
+int sound_manager_get_voip_session_mode(sound_session_voip_mode_e *mode)
 {
        int ret = MM_ERROR_NONE;
        int session = 0;
@@ -801,9 +791,8 @@ int sound_manager_get_voip_session_mode (sound_session_voip_mode_e *mode)
        if (ret != MM_ERROR_NONE) {
                LOGI("session = %d, option = %d", session, session_options);
                return _convert_sound_manager_error_code(__func__, ret);
-       } else if (session != MM_SESSION_TYPE_VOIP || g_cached_session_mode == -1) {
+       } else if (session != MM_SESSION_TYPE_VOIP || g_cached_session_mode == -1)
                return _convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
-       }
 
        *mode = (sound_session_voip_mode_e)g_cached_session_mode;
 
@@ -812,7 +801,7 @@ int sound_manager_get_voip_session_mode (sound_session_voip_mode_e *mode)
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_set_session_interrupted_cb (sound_session_interrupted_cb callback, void *user_data)
+int sound_manager_set_session_interrupted_cb(sound_session_interrupted_cb callback, void *user_data)
 {
        int ret = MM_ERROR_NONE;
        unsigned int subs_id = 0;
@@ -836,7 +825,7 @@ int sound_manager_set_session_interrupted_cb (sound_session_interrupted_cb callb
                        goto finish;
                ret = mm_sound_focus_set_session_interrupt_callback((mm_sound_focus_session_interrupt_cb)_focus_session_interrupt_cb, NULL);
                if (ret) {
-                       if(mm_sound_remove_device_connected_callback(subs_id) != MM_ERROR_NONE)
+                       if (mm_sound_remove_device_connected_callback(subs_id) != MM_ERROR_NONE)
                                LOGW("mm_sound_remove_device_connected_callback failed");
                        goto finish;
                }
@@ -850,7 +839,7 @@ finish:
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_unset_session_interrupted_cb (void)
+int sound_manager_unset_session_interrupted_cb(void)
 {
        int ret = MM_ERROR_NONE;
 
@@ -859,7 +848,7 @@ int sound_manager_unset_session_interrupted_cb (void)
        if (g_session_interrupt_cb_table.user_cb) {
                ret = mm_sound_focus_unset_session_interrupt_callback();
                if (ret) {
-                       if(mm_sound_remove_device_connected_callback(g_session_interrupt_cb_table.subs_id) != MM_ERROR_NONE)
+                       if (mm_sound_remove_device_connected_callback(g_session_interrupt_cb_table.subs_id) != MM_ERROR_NONE)
                                LOGW("mm_sound_remove_device_connected_callback failed");
                        goto finish;
                }
@@ -878,7 +867,7 @@ finish:
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_get_current_device_list (sound_device_mask_e device_mask, sound_device_list_h *device_list)
+int sound_manager_get_current_device_list(sound_device_mask_e device_mask, sound_device_list_h *device_list)
 {
        int ret = MM_ERROR_NONE;
        ret = mm_sound_get_current_device_list((mm_sound_device_flags_e)device_mask, device_list);
@@ -886,7 +875,7 @@ int sound_manager_get_current_device_list (sound_device_mask_e device_mask, soun
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_get_next_device (sound_device_list_h device_list, sound_device_h *device)
+int sound_manager_get_next_device(sound_device_list_h device_list, sound_device_h *device)
 {
        int ret = MM_ERROR_NONE;
        ret = mm_sound_get_next_device(device_list, device);
@@ -894,7 +883,7 @@ int sound_manager_get_next_device (sound_device_list_h device_list, sound_device
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_get_prev_device (sound_device_list_h device_list, sound_device_h *device)
+int sound_manager_get_prev_device(sound_device_list_h device_list, sound_device_h *device)
 {
        int ret = MM_ERROR_NONE;
        ret = mm_sound_get_prev_device(device_list, device);
@@ -902,7 +891,7 @@ int sound_manager_get_prev_device (sound_device_list_h device_list, sound_device
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_get_device_type (sound_device_h device, sound_device_type_e *type)
+int sound_manager_get_device_type(sound_device_h device, sound_device_type_e *type)
 {
        int ret = MM_ERROR_NONE;
        ret = mm_sound_get_device_type(device, (mm_sound_device_type_e*)type);
@@ -910,19 +899,18 @@ int sound_manager_get_device_type (sound_device_h device, sound_device_type_e *t
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_get_device_io_direction (sound_device_h device, sound_device_io_direction_e *io_direction)
+int sound_manager_get_device_io_direction(sound_device_h device, sound_device_io_direction_e *io_direction)
 {
        int ret = MM_ERROR_NONE;
        mm_sound_device_io_direction_e mm_sound_io_direction;
        ret = mm_sound_get_device_io_direction(device, &mm_sound_io_direction);
-       if (ret == MM_ERROR_NONE) {
+       if (ret == MM_ERROR_NONE)
                ret = _convert_device_io_direction(mm_sound_io_direction, io_direction);
-       }
 
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_get_device_id (sound_device_h device, int *id)
+int sound_manager_get_device_id(sound_device_h device, int *id)
 {
        int ret = MM_ERROR_NONE;
        ret = mm_sound_get_device_id(device, id);
@@ -930,7 +918,7 @@ int sound_manager_get_device_id (sound_device_h device, int *id)
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_get_device_name (sound_device_h device, char **name)
+int sound_manager_get_device_name(sound_device_h device, char **name)
 {
        int ret = MM_ERROR_NONE;
        ret = mm_sound_get_device_name(device, name);
@@ -938,7 +926,7 @@ int sound_manager_get_device_name (sound_device_h device, char **name)
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_get_device_state (sound_device_h device, sound_device_state_e *state)
+int sound_manager_get_device_state(sound_device_h device, sound_device_state_e *state)
 {
        int ret = MM_ERROR_NONE;
        ret = mm_sound_get_device_state(device, (mm_sound_device_state_e*)state);
@@ -946,7 +934,7 @@ int sound_manager_get_device_state (sound_device_h device, sound_device_state_e
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_set_device_connected_cb (sound_device_mask_e device_mask, sound_device_connected_cb callback, void *user_data)
+int sound_manager_set_device_connected_cb(sound_device_mask_e device_mask, sound_device_connected_cb callback, void *user_data)
 {
        int ret = MM_ERROR_NONE;
        unsigned int subs_id = 0;
@@ -965,7 +953,7 @@ int sound_manager_set_device_connected_cb (sound_device_mask_e device_mask, soun
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_unset_device_connected_cb (void)
+int sound_manager_unset_device_connected_cb(void)
 {
        int ret = MM_ERROR_NONE;
 
@@ -978,16 +966,15 @@ int sound_manager_unset_device_connected_cb (void)
                        g_device_connected_cb_table.user_cb = NULL;
                        g_device_connected_cb_table.user_data = NULL;
                }
-       } else {
+       } else
                ret = MM_ERROR_SOUND_INTERNAL;
-       }
 
        SM_LEAVE_CRITICAL_SECTION(&g_device_conn_cb_mutex);
 
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_set_device_information_changed_cb (sound_device_mask_e device_mask, sound_device_information_changed_cb callback, void *user_data)
+int sound_manager_set_device_information_changed_cb(sound_device_mask_e device_mask, sound_device_information_changed_cb callback, void *user_data)
 {
        int ret = MM_ERROR_NONE;
        unsigned int subs_id = 0;
@@ -1006,7 +993,7 @@ int sound_manager_set_device_information_changed_cb (sound_device_mask_e device_
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_unset_device_information_changed_cb (void)
+int sound_manager_unset_device_information_changed_cb(void)
 {
        int ret = MM_ERROR_NONE;
 
@@ -1029,23 +1016,23 @@ int sound_manager_unset_device_information_changed_cb (void)
 }
 
 __attribute__ ((destructor))
-void __sound_manager_finalize (void)
+void __sound_manager_finalize(void)
 {
        int ret = MM_ERROR_NONE;
 
        if (g_session_interrupt_cb_table.is_registered) {
                LOGI("<ENTER>");
                ret = mm_session_finish();
-               if (ret != MM_ERROR_NONE) {
+               if (ret != MM_ERROR_NONE)
                        LOGE("[%s] failed to mm_session_finish(), ret(%p)", __func__, ret);
-               }
+
                g_session_interrupt_cb_table.is_registered = 0;
                LOGI("<LEAVE>");
        }
 }
 
 __attribute__ ((constructor))
-void __sound_manager_initialize (void)
+void __sound_manager_initialize(void)
 {
 
 }
index ce113a96c0635be9d19b8225bc967b57b488788f..6e98f9fbfaee4024b3bf72d06a01b4b7f62a56d2 100644 (file)
@@ -19,7 +19,7 @@
 #include <sound_manager_internal.h>
 #include <mm_sound.h>
 
-int sound_manager_create_stream_information_internal (sound_stream_type_internal_e stream_type, sound_stream_focus_state_changed_cb callback, void *user_data, sound_stream_info_h *stream_info)
+int sound_manager_create_stream_information_internal(sound_stream_type_internal_e stream_type, sound_stream_focus_state_changed_cb callback, void *user_data, sound_stream_info_h *stream_info)
 {
        int ret = MM_ERROR_NONE;
 
@@ -46,7 +46,7 @@ int sound_manager_create_stream_information_internal (sound_stream_type_internal
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_set_stream_routing_option (sound_stream_info_h stream_info, const char *name, int value)
+int sound_manager_set_stream_routing_option(sound_stream_info_h stream_info, const char *name, int value)
 {
        int ret = MM_ERROR_NONE;
        sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
@@ -63,7 +63,7 @@ int sound_manager_set_stream_routing_option (sound_stream_info_h stream_info, co
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_is_available_stream_information (sound_stream_info_h stream_info, native_api_e api_name, bool *is_available)
+int sound_manager_is_available_stream_information(sound_stream_info_h stream_info, native_api_e api_name, bool *is_available)
 {
        int ret = MM_ERROR_NONE;
        int i = 0;
@@ -85,7 +85,7 @@ int sound_manager_is_available_stream_information (sound_stream_info_h stream_in
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_get_type_from_stream_information (sound_stream_info_h stream_info, char **type)
+int sound_manager_get_type_from_stream_information(sound_stream_info_h stream_info, char **type)
 {
        int ret = MM_ERROR_NONE;
        sound_stream_info_s* stream_h = (sound_stream_info_s*)stream_info;
@@ -98,7 +98,7 @@ int sound_manager_get_type_from_stream_information (sound_stream_info_h stream_i
 
        return _convert_sound_manager_error_code(__func__, ret);
 }
-int sound_manager_get_index_from_stream_information (sound_stream_info_h stream_info, int *index)
+int sound_manager_get_index_from_stream_information(sound_stream_info_h stream_info, int *index)
 {
        int ret = MM_ERROR_NONE;
        sound_stream_info_s* stream_h = (sound_stream_info_s*)stream_info;
@@ -111,7 +111,7 @@ int sound_manager_get_index_from_stream_information (sound_stream_info_h stream_
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_create_virtual_stream (sound_stream_info_h stream_info, virtual_sound_stream_h *virtual_stream)
+int sound_manager_create_virtual_stream(sound_stream_info_h stream_info, virtual_sound_stream_h *virtual_stream)
 {
        int ret = MM_ERROR_NONE;
        virtual_sound_stream_info_s *vstream_h = NULL;
@@ -128,7 +128,7 @@ int sound_manager_create_virtual_stream (sound_stream_info_h stream_info, virtua
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_destroy_virtual_stream (virtual_sound_stream_h virtual_stream)
+int sound_manager_destroy_virtual_stream(virtual_sound_stream_h virtual_stream)
 {
        int ret = MM_ERROR_NONE;
        virtual_sound_stream_info_s *vstream_h = (virtual_sound_stream_info_s*)virtual_stream;
@@ -142,7 +142,7 @@ int sound_manager_destroy_virtual_stream (virtual_sound_stream_h virtual_stream)
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_start_virtual_stream (virtual_sound_stream_h virtual_stream)
+int sound_manager_start_virtual_stream(virtual_sound_stream_h virtual_stream)
 {
        int ret = MM_ERROR_NONE;
        virtual_sound_stream_info_s *vstream_h = (virtual_sound_stream_info_s*)virtual_stream;
@@ -156,7 +156,7 @@ int sound_manager_start_virtual_stream (virtual_sound_stream_h virtual_stream)
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_stop_virtual_stream (virtual_sound_stream_h virtual_stream)
+int sound_manager_stop_virtual_stream(virtual_sound_stream_h virtual_stream)
 {
        int ret = MM_ERROR_NONE;
        virtual_sound_stream_info_s *vstream_h = (virtual_sound_stream_info_s*)virtual_stream;
index 5a2a73f493685f077299d6c8a61c78bf975db537..84d593ad485fc35027704b6b1b94422f077f15a8 100644 (file)
@@ -38,11 +38,12 @@ virtual_sound_stream_info_s *g_voip_vstream_h = NULL;
 int g_stream_info_count = 0;
 pthread_mutex_t g_stream_info_count_mutex = PTHREAD_MUTEX_INITIALIZER;
 
-int _convert_sound_manager_error_code (const char *func, int code) {
+int _convert_sound_manager_error_code(const char *func, int code)
+{
        int ret = SOUND_MANAGER_ERROR_NONE;
        char *errorstr = NULL;
 
-       switch(code) {
+       switch (code) {
        case MM_ERROR_FILE_WRITE:
        case MM_ERROR_INVALID_HANDLE:
                ret = SOUND_MANAGER_ERROR_INVALID_OPERATION;
@@ -91,21 +92,20 @@ int _convert_sound_manager_error_code (const char *func, int code) {
                errorstr = "INVALID_STATE";
                break;
        }
-       if (ret) {
-               LOGE("[%s] %s(0x%08x) : core frameworks error code(0x%08x)",func, errorstr, ret, code);
-       } else {
-               LOGD("[%s] %s(0x%08x) : core frameworks error code(0x%08x)",func, errorstr, ret, code);
-       }
+       if (ret)
+               LOGE("[%s] %s(0x%08x) : core frameworks error code(0x%08x)", func, errorstr, ret, code);
+       else
+               LOGD("[%s] %s(0x%08x) : core frameworks error code(0x%08x)", func, errorstr, ret, code);
+
        return ret;
 }
 
-int _convert_stream_type (sound_stream_type_e stream_type_enum, char **stream_type)
+int _convert_stream_type(sound_stream_type_e stream_type_enum, char **stream_type)
 {
        int ret = MM_ERROR_NONE;
 
-       if (stream_type == NULL) {
+       if (stream_type == NULL)
                return MM_ERROR_INVALID_ARGUMENT;
-       }
 
        switch (stream_type_enum) {
        case SOUND_STREAM_TYPE_MEDIA:
@@ -148,13 +148,12 @@ int _convert_stream_type (sound_stream_type_e stream_type_enum, char **stream_ty
        return ret;
 }
 
-int _convert_stream_type_for_internal (sound_stream_type_internal_e stream_type_enum, char **stream_type)
+int _convert_stream_type_for_internal(sound_stream_type_internal_e stream_type_enum, char **stream_type)
 {
        int ret = MM_ERROR_NONE;
 
-       if (stream_type == NULL) {
+       if (stream_type == NULL)
                return MM_ERROR_INVALID_ARGUMENT;
-       }
 
        switch (stream_type_enum) {
        case SOUND_STREAM_TYPE_RINGTONE_CALL:
@@ -182,7 +181,7 @@ int _convert_stream_type_for_internal (sound_stream_type_internal_e stream_type_
        return ret;
 }
 
-int _convert_stream_type_to_change_reason (const char *stream_type, sound_stream_focus_change_reason_e *change_reason)
+int _convert_stream_type_to_change_reason(const char *stream_type, sound_stream_focus_change_reason_e *change_reason)
 {
        int ret = MM_ERROR_NONE;
 
@@ -233,7 +232,7 @@ int _convert_stream_type_to_change_reason (const char *stream_type, sound_stream
        return ret;
 }
 
-static int _convert_stream_type_to_interrupt_reason (const char *stream_type, sound_session_interrupted_code_e *change_reason)
+static int _convert_stream_type_to_interrupt_reason(const char *stream_type, sound_session_interrupted_code_e *change_reason)
 {
        int ret = MM_ERROR_NONE;
 
@@ -272,7 +271,7 @@ static int _convert_stream_type_to_interrupt_reason (const char *stream_type, so
        return ret;
 }
 
-int _convert_sound_type (sound_type_e sound_type, const char **volume_type)
+int _convert_sound_type(sound_type_e sound_type, const char **volume_type)
 {
        int ret = MM_ERROR_NONE;
 
@@ -309,7 +308,7 @@ int _convert_sound_type (sound_type_e sound_type, const char **volume_type)
        return ret;
 }
 
-int _convert_sound_type_to_enum (char *sound_type, sound_type_e *sound_type_enum)
+int _convert_sound_type_to_enum(char *sound_type, sound_type_e *sound_type_enum)
 {
        int ret = MM_ERROR_NONE;
 
@@ -340,7 +339,7 @@ int _convert_sound_type_to_enum (char *sound_type, sound_type_e *sound_type_enum
        return ret;
 }
 
-int _convert_device_type (sound_device_type_e device_type_enum, char **device_type)
+int _convert_device_type(sound_device_type_e device_type_enum, char **device_type)
 {
        int ret = MM_ERROR_NONE;
 
@@ -372,16 +371,16 @@ int _convert_device_type (sound_device_type_e device_type_enum, char **device_ty
                *device_type = "forwarding";
                break;
        }
-       if (!strncmp(*device_type,"",SOUND_DEVICE_TYPE_LEN)) {
+       if (!strncmp(*device_type, "", SOUND_DEVICE_TYPE_LEN)) {
                LOGE("could not find the device_type[%d] in this switch case statement", device_type_enum);
                ret = MM_ERROR_SOUND_INTERNAL;
-       } else {
+       } else
                LOGI("device_type[%s]", *device_type);
-       }
+
        return ret;
 }
 
-int _convert_device_io_direction (mm_sound_device_io_direction_e io_direction, sound_device_io_direction_e *sound_io_direction)
+int _convert_device_io_direction(mm_sound_device_io_direction_e io_direction, sound_device_io_direction_e *sound_io_direction)
 {
        int ret = MM_ERROR_NONE;
 
@@ -401,7 +400,7 @@ int _convert_device_io_direction (mm_sound_device_io_direction_e io_direction, s
        return ret;
 }
 
-const char* _convert_api_name (native_api_e api_name)
+const char* _convert_api_name(native_api_e api_name)
 {
        const char* name = NULL;
        switch (api_name) {
@@ -424,7 +423,7 @@ const char* _convert_api_name (native_api_e api_name)
        return name;
 }
 
-void _focus_state_change_callback (int index, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e state, const char *reason_for_change, const char *additional_info, void *user_data)
+void _focus_state_change_callback(int index, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e state, const char *reason_for_change, const char *additional_info, void *user_data)
 {
        int ret = MM_ERROR_NONE;
        int i = 0;
@@ -438,20 +437,19 @@ void _focus_state_change_callback (int index, mm_sound_focus_type_e focus_type,
        } else {
                for (i = 0; i < SOUND_STREAM_INFO_ARR_MAX; i++) {
                        if (sound_stream_info_arr[i] && sound_stream_info_arr[i]->index == index) {
-                               if (state ==  FOCUS_IS_RELEASED) {
+                               if (state == FOCUS_IS_RELEASED)
                                        sound_stream_info_arr[i]->acquired_focus &= ~focus_type;
-                               } else if (state == FOCUS_IS_ACQUIRED) {
+                               else if (state == FOCUS_IS_ACQUIRED)
                                        sound_stream_info_arr[i]->acquired_focus |= focus_type;
-                               }
+
                                LOGI("[FOCUS USER CALLBACK(%p) START]", sound_stream_info_arr[i]->user_cb);
                                sound_stream_info_arr[i]->user_cb((sound_stream_info_h)sound_stream_info_arr[i], change_reason, additional_info, sound_stream_info_arr[i]->user_data);
                                LOGI("[FOCUS USER CALLBACK(%p) END]", sound_stream_info_arr[i]->user_cb);
                                break;
                        }
                }
-               if (i == SOUND_STREAM_INFO_ARR_MAX) {
+               if (i == SOUND_STREAM_INFO_ARR_MAX)
                        LOGE("could not find index(%d), failed to call user callback", index);
-               }
        }
 
        LOGI("<< leave");
@@ -459,7 +457,7 @@ void _focus_state_change_callback (int index, mm_sound_focus_type_e focus_type,
        return;
 }
 
-void _focus_watch_callback (int index, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e state, const char *reason_for_change, const char *additional_info, void *user_data)
+void _focus_watch_callback(int index, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e state, const char *reason_for_change, const char *additional_info, void *user_data)
 {
        int ret = MM_ERROR_NONE;
        sound_stream_focus_change_reason_e change_reason = SOUND_STREAM_FOCUS_CHANGED_BY_MEDIA;
@@ -471,14 +469,14 @@ void _focus_watch_callback (int index, mm_sound_focus_type_e focus_type, mm_soun
        return;
 }
 
-void _pa_context_state_cb (pa_context *c, void *userdata)
+void _pa_context_state_cb(pa_context *c, void *userdata)
 {
        pa_context_state_t state;
        sound_stream_info_s *stream_info_h = (sound_stream_info_s*)userdata;
        assert(c);
 
        state = pa_context_get_state(c);
-       LOGI ("[%p] context state = [%d]", stream_info_h, state);
+       LOGI("[%p] context state = [%d]", stream_info_h, state);
        switch (state) {
        case PA_CONTEXT_READY:
        case PA_CONTEXT_TERMINATED:
@@ -493,14 +491,14 @@ void _pa_context_state_cb (pa_context *c, void *userdata)
        }
 }
 
-void _pa_stream_state_cb (pa_stream *s, void * userdata)
+void _pa_stream_state_cb(pa_stream *s, void * userdata)
 {
        pa_stream_state_t state;
        virtual_sound_stream_info_s *vstream_h = (virtual_sound_stream_info_s*)userdata;
        assert(s);
 
        state = pa_stream_get_state(s);
-       LOGI ("[%p] stream [%d] state = [%d]", vstream_h, pa_stream_get_index(s), state);
+       LOGI("[%p] stream [%d] state = [%d]", vstream_h, pa_stream_get_index(s), state);
 
        switch (state) {
        case PA_STREAM_READY:
@@ -514,7 +512,7 @@ void _pa_stream_state_cb (pa_stream *s, void * userdata)
        }
 }
 
-int _get_stream_conf_info (const char *stream_type, stream_conf_info_s *info)
+int _get_stream_conf_info(const char *stream_type, stream_conf_info_s *info)
 {
        int ret = MM_ERROR_NONE;
        GVariant *result = NULL;
@@ -528,15 +526,15 @@ int _get_stream_conf_info (const char *stream_type, stream_conf_info_s *info)
        conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
        if (!conn && err) {
                LOGE("g_bus_get_sync() error (%s)", err->message);
-               g_error_free (err);
+               g_error_free(err);
                return MM_ERROR_SOUND_INTERNAL;
        }
-       result = g_dbus_connection_call_sync (conn,
+       result = g_dbus_connection_call_sync(conn,
                                                        PA_BUS_NAME,
                                                        PA_STREAM_MANAGER_OBJECT_PATH,
                                                        PA_STREAM_MANAGER_INTERFACE,
                                                        PA_STREAM_MANAGER_METHOD_NAME_GET_STREAM_INFO,
-                                                       g_variant_new ("(s)", stream_type),
+                                                       g_variant_new("(s)", stream_type),
                                                        G_VARIANT_TYPE("(vvvvv)"),
                                                        G_DBUS_CALL_FLAGS_NONE,
                                                        2000,
@@ -544,7 +542,7 @@ int _get_stream_conf_info (const char *stream_type, stream_conf_info_s *info)
                                                        &err);
        if (!result && err) {
                LOGE("g_dbus_connection_call_sync() for GET_STREAM_INFO error (%s)", err->message);
-               g_error_free (err);
+               g_error_free(err);
                ret = MM_ERROR_SOUND_INTERNAL;
        } else {
                GVariantIter iter;
@@ -557,84 +555,84 @@ int _get_stream_conf_info (const char *stream_type, stream_conf_info_s *info)
                child = g_variant_get_child_value(result, 0);
                item = g_variant_get_variant(child);
                info->priority = g_variant_get_int32(item);
-               g_variant_unref (item);
-               g_variant_unref (child);
-               LOGI ("priority(%d)", info->priority);
+               g_variant_unref(item);
+               g_variant_unref(child);
+               LOGI("priority(%d)", info->priority);
 
                /* get route type */
                child = g_variant_get_child_value(result, 1);
                item = g_variant_get_variant(child);
                info->route_type = g_variant_get_int32(item);
-               g_variant_unref (item);
-               g_variant_unref (child);
-               LOGI ("route_type(%d)", info->route_type);
+               g_variant_unref(item);
+               g_variant_unref(child);
+               LOGI("route_type(%d)", info->route_type);
 
                /* get availabe in-devices */
                child = g_variant_get_child_value(result, 2);
                item = g_variant_get_variant(child);
                size = g_variant_n_children(item);
-               LOGI ("num of avail-in-devices are %d", size);
+               LOGI("num of avail-in-devices are %d", size);
                g_variant_iter_init(&iter, item);
                i = 0;
                while (g_variant_iter_loop(&iter, "&s", &name)) {
-                       if (size == 1 && !strncmp (name, "none", strlen("none"))) {
-                               LOGI (" in-device is [%s], skip it", name);
+                       if (size == 1 && !strncmp(name, "none", strlen("none"))) {
+                               LOGI(" in-device is [%s], skip it", name);
                                break;
                        } else {
-                               LOGI (" in-device name : %s", name);
+                               LOGI(" in-device name : %s", name);
                                info->avail_in_devices[i++] = strdup(name);
                        }
                }
-               g_variant_iter_free (&iter);
-               g_variant_unref (item);
-               g_variant_unref (child);
+               g_variant_iter_free(&iter);
+               g_variant_unref(item);
+               g_variant_unref(child);
 
                /* get available out-devices */
                child = g_variant_get_child_value(result, 3);
                item = g_variant_get_variant(child);
                size = g_variant_n_children(item);
-               LOGI ("num of avail-out-devices are %d", size);
+               LOGI("num of avail-out-devices are %d", size);
                g_variant_iter_init(&iter, item);
                i = 0;
                while (g_variant_iter_loop(&iter, "&s", &name)) {
-                       if (size == 1 && !strncmp (name, "none", strlen("none"))) {
-                               LOGI (" out-device is [%s], skip it", name);
+                       if (size == 1 && !strncmp(name, "none", strlen("none"))) {
+                               LOGI(" out-device is [%s], skip it", name);
                                break;
                        } else {
-                               LOGI (" out-device name : %s", name);
+                               LOGI(" out-device name : %s", name);
                                info->avail_out_devices[i++] = strdup(name);
                        }
                }
-               g_variant_iter_free (&iter);
-               g_variant_unref (item);
-               g_variant_unref (child);
+               g_variant_iter_free(&iter);
+               g_variant_unref(item);
+               g_variant_unref(child);
 
                /* get available frameworks */
                child = g_variant_get_child_value(result, 4);
                item = g_variant_get_variant(child);
                size = g_variant_n_children(item);
-               LOGI ("num of avail-frameworks are %d", size);
+               LOGI("num of avail-frameworks are %d", size);
                g_variant_iter_init(&iter, item);
                i = 0;
                while (g_variant_iter_loop(&iter, "&s", &name)) {
-                       if (size == 1 && !strncmp (name, "none", strlen("none"))) {
-                               LOGI (" framework is [%s], skip it", name);
+                       if (size == 1 && !strncmp(name, "none", strlen("none"))) {
+                               LOGI(" framework is [%s], skip it", name);
                                break;
                        } else {
-                               LOGI (" framework name : %s", name);
+                               LOGI(" framework name : %s", name);
                                info->avail_frameworks[i++] = strdup(name);
                        }
                }
-               g_variant_iter_free (&iter);
-               g_variant_unref (item);
-               g_variant_unref (child);
+               g_variant_iter_free(&iter);
+               g_variant_unref(item);
+               g_variant_unref(child);
                g_variant_unref(result);
        }
        g_object_unref(conn);
        return ret;
 }
 
-int _set_manual_route_info (unsigned int index, manual_route_info_s *info)
+int _set_manual_route_info(unsigned int index, manual_route_info_s *info)
 {
        int ret = MM_ERROR_NONE;
        int i = 0;
@@ -649,7 +647,7 @@ int _set_manual_route_info (unsigned int index, manual_route_info_s *info)
        conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
        if (!conn && err) {
                LOGE("g_bus_get_sync() error (%s)", err->message);
-               g_error_free (err);
+               g_error_free(err);
                return MM_ERROR_SOUND_INTERNAL;
        }
 
@@ -672,12 +670,12 @@ int _set_manual_route_info (unsigned int index, manual_route_info_s *info)
                }
        }
 
-       result = g_dbus_connection_call_sync (conn,
+       result = g_dbus_connection_call_sync(conn,
                                                        PA_BUS_NAME,
                                                        PA_STREAM_MANAGER_OBJECT_PATH,
                                                        PA_STREAM_MANAGER_INTERFACE,
                                                        PA_STREAM_MANAGER_METHOD_NAME_SET_STREAM_ROUTE_DEVICES,
-                                                       g_variant_new ("(uauau)", index, builder_for_in_devices, builder_for_out_devices),
+                                                       g_variant_new("(uauau)", index, builder_for_in_devices, builder_for_out_devices),
                                                        G_VARIANT_TYPE("(s)"),
                                                        G_DBUS_CALL_FLAGS_NONE,
                                                        2000,
@@ -685,17 +683,17 @@ int _set_manual_route_info (unsigned int index, manual_route_info_s *info)
                                                        &err);
        if (!result && err) {
                LOGE("g_dbus_connection_call_sync() for SET_STREAM_ROUTE_DEVICES error (%s)", err->message);
-               g_error_free (err);
+               g_error_free(err);
                ret = MM_ERROR_SOUND_INTERNAL;
        } else {
                const gchar *dbus_ret = NULL;
                g_variant_get(result, "(&s)", &dbus_ret);
                LOGI("g_dbus_connection_call_sync() success, method return value is (%s)", dbus_ret);
-               if (strncmp("STREAM_MANAGER_RETURN_OK", dbus_ret, strlen(dbus_ret))) {
+               if (strncmp("STREAM_MANAGER_RETURN_OK", dbus_ret, strlen(dbus_ret)))
                        ret = MM_ERROR_SOUND_INVALID_STATE;
-               } else {
+               else
                        info->is_set = true;
-               }
+
                g_variant_unref(result);
        }
        g_variant_builder_unref(builder_for_in_devices);
@@ -704,7 +702,7 @@ int _set_manual_route_info (unsigned int index, manual_route_info_s *info)
        return ret;
 }
 
-int _set_route_option (unsigned int index, const char *name, int value)
+int _set_route_option(unsigned int index, const char *name, int value)
 {
        int ret = MM_ERROR_NONE;
 
@@ -717,19 +715,19 @@ int _set_route_option (unsigned int index, const char *name, int value)
        conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
        if (!conn && err) {
                LOGE("g_bus_get_sync() error (%s)", err->message);
-               g_error_free (err);
+               g_error_free(err);
                return MM_ERROR_SOUND_INTERNAL;
        }
 
        LOGI("[OPTION] %s(%d)", name, value);
 
 
-       result = g_dbus_connection_call_sync (conn,
+       result = g_dbus_connection_call_sync(conn,
                                                        PA_BUS_NAME,
                                                        PA_STREAM_MANAGER_OBJECT_PATH,
                                                        PA_STREAM_MANAGER_INTERFACE,
                                                        PA_STREAM_MANAGER_METHOD_NAME_SET_STREAM_ROUTE_OPTION,
-                                                       g_variant_new ("(usi)", index, name, value),
+                                                       g_variant_new("(usi)", index, name, value),
                                                        G_VARIANT_TYPE("(s)"),
                                                        G_DBUS_CALL_FLAGS_NONE,
                                                        2000,
@@ -737,24 +735,24 @@ int _set_route_option (unsigned int index, const char *name, int value)
                                                        &err);
        if (!result && err) {
                LOGE("g_dbus_connection_call_sync() for SET_STREAM_ROUTE_OPTION error (%s)", err->message);
-               g_error_free (err);
+               g_error_free(err);
                ret = MM_ERROR_SOUND_INTERNAL;
        } else {
                const gchar *dbus_ret = NULL;
                g_variant_get(result, "(&s)", &dbus_ret);
                LOGI("g_dbus_connection_call_sync() success, method return value is (%s)", dbus_ret);
-               if (!strncmp("STREAM_MANAGER_RETURN_ERROR_NO_STREAM", dbus_ret, strlen(dbus_ret))) {
+               if (!strncmp("STREAM_MANAGER_RETURN_ERROR_NO_STREAM", dbus_ret, strlen(dbus_ret)))
                        ret = MM_ERROR_SOUND_INVALID_STATE;
-               } else if (strncmp("STREAM_MANAGER_RETURN_OK", dbus_ret, strlen(dbus_ret))) {
+               else if (strncmp("STREAM_MANAGER_RETURN_OK", dbus_ret, strlen(dbus_ret)))
                        ret = MM_ERROR_SOUND_INTERNAL;
-               }
+
                g_variant_unref(result);
        }
        g_object_unref(conn);
        return ret;
 }
 
-int _get_volume_max_level (const char *direction, const char *volume_type, unsigned int *max_level)
+int _get_volume_max_level(const char *direction, const char *volume_type, unsigned int *max_level)
 {
        int ret = MM_ERROR_NONE;
 
@@ -769,16 +767,16 @@ int _get_volume_max_level (const char *direction, const char *volume_type, unsig
        conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
        if (!conn && err) {
                LOGE("g_bus_get_sync() error (%s)", err->message);
-               g_error_free (err);
+               g_error_free(err);
                return MM_ERROR_SOUND_INTERNAL;
        }
 
-       result = g_dbus_connection_call_sync (conn,
+       result = g_dbus_connection_call_sync(conn,
                                                        PA_BUS_NAME,
                                                        PA_STREAM_MANAGER_OBJECT_PATH,
                                                        PA_STREAM_MANAGER_INTERFACE,
                                                        PA_STREAM_MANAGER_METHOD_NAME_GET_VOLUME_MAX_LEVEL,
-                                                       g_variant_new ("(ss)", direction, volume_type),
+                                                       g_variant_new("(ss)", direction, volume_type),
                                                        G_VARIANT_TYPE("(us)"),
                                                        G_DBUS_CALL_FLAGS_NONE,
                                                        2000,
@@ -786,22 +784,22 @@ int _get_volume_max_level (const char *direction, const char *volume_type, unsig
                                                        &err);
        if (!result && err) {
                LOGE("g_dbus_connection_call_sync() for GET_VOLUME_MAX_LEVEL error (%s)", err->message);
-               g_error_free (err);
+               g_error_free(err);
                ret = MM_ERROR_SOUND_INTERNAL;
        } else {
                const gchar *dbus_ret = NULL;
                g_variant_get(result, "(u&s)", max_level, &dbus_ret);
                LOGI("g_dbus_connection_call_sync() success, method return value is (%u, %s)", *max_level, dbus_ret);
-               if (strncmp("STREAM_MANAGER_RETURN_OK", dbus_ret, strlen(dbus_ret))) {
+               if (strncmp("STREAM_MANAGER_RETURN_OK", dbus_ret, strlen(dbus_ret)))
                        ret = MM_ERROR_SOUND_INTERNAL;
-               }
+
                g_variant_unref(result);
        }
        g_object_unref(conn);
        return ret;
 }
 
-int _get_current_volume_type (const char *direction, char **volume_type)
+int _get_current_volume_type(const char *direction, char **volume_type)
 {
        int ret = MM_ERROR_NONE;
 
@@ -815,16 +813,16 @@ int _get_current_volume_type (const char *direction, char **volume_type)
        conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
        if (!conn && err) {
                LOGE("g_bus_get_sync() error (%s)", err->message);
-               g_error_free (err);
+               g_error_free(err);
                return MM_ERROR_SOUND_INTERNAL;
        }
 
-       result = g_dbus_connection_call_sync (conn,
+       result = g_dbus_connection_call_sync(conn,
                                                        PA_BUS_NAME,
                                                        PA_STREAM_MANAGER_OBJECT_PATH,
                                                        PA_STREAM_MANAGER_INTERFACE,
                                                        PA_STREAM_MANAGER_METHOD_NAME_GET_CURRENT_VOLUME_TYPE,
-                                                       g_variant_new ("(s)", direction),
+                                                       g_variant_new("(s)", direction),
                                                        G_VARIANT_TYPE("(ss)"),
                                                        G_DBUS_CALL_FLAGS_NONE,
                                                        2000,
@@ -832,7 +830,7 @@ int _get_current_volume_type (const char *direction, char **volume_type)
                                                        &err);
        if (!result && err) {
                LOGE("g_dbus_connection_call_sync() for GET_CURRENT_VOLUME_TYPE error (%s)", err->message);
-               g_error_free (err);
+               g_error_free(err);
                ret = MM_ERROR_SOUND_INTERNAL;
        } else {
                const gchar *dbus_volume_type = NULL;
@@ -842,18 +840,18 @@ int _get_current_volume_type (const char *direction, char **volume_type)
                if (!strncmp("STREAM_MANAGER_RETURN_OK", dbus_ret, strlen(dbus_ret))) {
                        ret = MM_ERROR_NONE;
                        *volume_type = strdup(dbus_volume_type);
-               } else if (!strncmp("STREAM_MANAGER_RETURN_ERROR_NO_STREAM", dbus_ret, strlen(dbus_ret))) {
+               } else if (!strncmp("STREAM_MANAGER_RETURN_ERROR_NO_STREAM", dbus_ret, strlen(dbus_ret)))
                        ret = MM_ERROR_SOUND_VOLUME_NO_INSTANCE;
-               } else {
+               else
                        ret = MM_ERROR_SOUND_INTERNAL;
-               }
+
                g_variant_unref(result);
        }
        g_object_unref(conn);
        return ret;
 }
 
-void _update_focus_status (unsigned int index, unsigned int acquired_focus_status)
+void _update_focus_status(unsigned int index, unsigned int acquired_focus_status)
 {
        GVariant *result = NULL;
        GDBusConnection *conn = NULL;
@@ -862,16 +860,16 @@ void _update_focus_status (unsigned int index, unsigned int acquired_focus_statu
        conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
        if (!conn && err) {
                LOGE("g_bus_get_sync() error (%s)", err->message);
-               g_error_free (err);
+               g_error_free(err);
                return;
        }
 
-       result = g_dbus_connection_call_sync (conn,
+       result = g_dbus_connection_call_sync(conn,
                                                        PA_BUS_NAME,
                                                        PA_STREAM_MANAGER_OBJECT_PATH,
                                                        PA_STREAM_MANAGER_INTERFACE,
                                                        PA_STREAM_MANAGER_METHOD_NAME_UPDATE_FOCUS_STATUS,
-                                                       g_variant_new ("(uu)", index, acquired_focus_status),
+                                                       g_variant_new("(uu)", index, acquired_focus_status),
                                                        G_VARIANT_TYPE("(s)"),
                                                        G_DBUS_CALL_FLAGS_NONE,
                                                        2000,
@@ -879,36 +877,35 @@ void _update_focus_status (unsigned int index, unsigned int acquired_focus_statu
                                                        &err);
        if (!result && err) {
                LOGE("g_dbus_connection_call_sync() for UPDATE_FOCUS_STATUS error (%s)", err->message);
-               g_error_free (err);
+               g_error_free(err);
        } else {
                const gchar *dbus_ret = NULL;
                g_variant_get(result, "(&s)", &dbus_ret);
                LOGI("g_dbus_connection_call_sync() success, method return value is (%s)", dbus_ret);
-               if (strncmp("STREAM_MANAGER_RETURN_OK", dbus_ret, strlen(dbus_ret))) {
-               }
+               if (strncmp("STREAM_MANAGER_RETURN_OK", dbus_ret, strlen(dbus_ret)))
+                       LOGE("failed to UPDATE_FOCUS_STATUS error (%s)", dbus_ret);
+
                g_variant_unref(result);
        }
        g_object_unref(conn);
        return;
 }
 
-void _focus_session_interrupt_cb (mm_sound_focus_state_e state, const char *reason_for_change, bool is_wcb, void *user_data)
+void _focus_session_interrupt_cb(mm_sound_focus_state_e state, const char *reason_for_change, bool is_wcb, void *user_data)
 {
        sound_session_interrupted_code_e e;
        LOGE("session interrupted by [%s]", reason_for_change);
        if (g_session_interrupt_cb_table.user_cb) {
                if (is_wcb) {
-                       if (state == FOCUS_IS_RELEASED) {
+                       if (state == FOCUS_IS_RELEASED)
                                e = SOUND_SESSION_INTERRUPTED_COMPLETED;
-                       } else {
+                       else
                                _convert_stream_type_to_interrupt_reason(reason_for_change, &e);
-                       }
                } else {
-                       if (state == FOCUS_IS_ACQUIRED) {
+                       if (state == FOCUS_IS_ACQUIRED)
                                e = SOUND_SESSION_INTERRUPTED_COMPLETED;
-                       } else {
+                       else
                                _convert_stream_type_to_interrupt_reason(reason_for_change, &e);
-                       }
                }
                g_session_interrupt_cb_table.user_cb(e, g_session_interrupt_cb_table.user_data);
        }
@@ -917,28 +914,28 @@ void _focus_session_interrupt_cb (mm_sound_focus_state_e state, const char *reas
 void _device_connected_cb(sound_device_h device, bool is_connected, void *user_data)
 {
        mm_sound_device_type_e type;
-       if (mm_sound_get_device_type (device, &type) != MM_ERROR_NONE) {
+       if (mm_sound_get_device_type(device, &type) != MM_ERROR_NONE)
                LOGE("getting device type failed");
-       else {
+       else {
                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) {
-                                       LOGI("sound device unplugged");
-                                       g_session_interrupt_cb_table.user_cb(SOUND_SESSION_INTERRUPTED_BY_EARJACK_UNPLUG, g_session_interrupt_cb_table.user_data);
-                               }
-                               break;
-                       default:
-                               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) {
+                               LOGI("sound device unplugged");
+                               g_session_interrupt_cb_table.user_cb(SOUND_SESSION_INTERRUPTED_BY_EARJACK_UNPLUG, g_session_interrupt_cb_table.user_data);
+                       }
+                       break;
+               default:
+                       break;
                }
        }
 }
 
 /* This is an internal callback for the VOIP SESSION */
-void _voip_focus_state_change_callback (sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data)
+void _voip_focus_state_change_callback(sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data)
 {
        sound_stream_info_s *info = (sound_stream_info_s *)stream_info;
        LOGI(">> enter, stream_info(%p), change_reason(%d), additional_info(%s)", stream_info, reason_for_change, additional_info);
@@ -949,7 +946,7 @@ void _voip_focus_state_change_callback (sound_stream_info_h stream_info, sound_s
        }
 
        if (!(info->acquired_focus & SOUND_STREAM_FOCUS_FOR_PLAYBACK) ||
-               !(info->acquired_focus & SOUND_STREAM_FOCUS_FOR_RECORDING) ) {
+               !(info->acquired_focus & SOUND_STREAM_FOCUS_FOR_RECORDING)) {
                /* stop virtual stream for rintone-voip or voip */
                if (g_voip_vstream_h) {
                        /* stop virtual stream handle */
@@ -966,7 +963,7 @@ void _voip_focus_state_change_callback (sound_stream_info_h stream_info, sound_s
        return;
 }
 
-int _set_session_mode (_session_mode_e mode)
+int _set_session_mode(_session_mode_e mode)
 {
        int ret = MM_ERROR_NONE;
        int w_ret = MM_ERROR_NONE;
@@ -985,17 +982,123 @@ int _set_session_mode (_session_mode_e mode)
        }
 
        switch (mode) {
-               case _SESSION_MODE_RINGTONE:
-                       if (g_voip_vstream_h) {
-                               /* stop vstream and destroy vstream */
-                               _stop_virtual_stream(g_voip_vstream_h);
-                               _destroy_virtual_stream(g_voip_vstream_h);
-                               g_voip_vstream_h = NULL;
-                               /* destroy stream info */
-                               _destroy_pa_connection_and_unregister_focus(g_voip_stream_info);
-                               free(g_voip_stream_info);
-                               g_voip_stream_info = NULL;
+       case _SESSION_MODE_RINGTONE:
+               if (g_voip_vstream_h) {
+                       /* stop vstream and destroy vstream */
+                       _stop_virtual_stream(g_voip_vstream_h);
+                       _destroy_virtual_stream(g_voip_vstream_h);
+                       g_voip_vstream_h = NULL;
+                       /* destroy stream info */
+                       _destroy_pa_connection_and_unregister_focus(g_voip_stream_info);
+                       free(g_voip_stream_info);
+                       g_voip_stream_info = NULL;
+               }
+               if (!g_voip_stream_info) {
+                       g_voip_stream_info = malloc(sizeof(sound_stream_info_s));
+                       if (!g_voip_stream_info) {
+                               ret = MM_ERROR_OUT_OF_MEMORY;
+                               goto ERROR_CASE;
+                       }
+                       memset(g_voip_stream_info, 0, sizeof(sound_stream_info_s));
+               }
+               /* create stream info and acquire focus for rintone-voip stream */
+               g_voip_stream_info->stream_type = "ringtone-voip";
+               ret = _make_pa_connection_and_register_focus(g_voip_stream_info, _voip_focus_state_change_callback, NULL);
+               if (ret != MM_ERROR_NONE) {
+                       free(g_voip_stream_info);
+                       g_voip_stream_info = NULL;
+                       goto ERROR_CASE;
+               } else {
+                       /* acquire focus */
+                       ret = mm_sound_acquire_focus(g_voip_stream_info->index, FOCUS_FOR_BOTH, "for voip session");
+                       if (ret == MM_ERROR_NONE) {
+                               g_voip_stream_info->acquired_focus |= FOCUS_FOR_BOTH;
+                               _update_focus_status(g_voip_stream_info->index, (unsigned int)g_voip_stream_info->acquired_focus);
+                       } else
+                               goto ERROR_CASE;
+
+               }
+               /* create virtual stream for ringtone-voip */
+               i_ret = _create_virtual_stream(g_voip_stream_info, &g_voip_vstream_h);
+               if (i_ret == SOUND_MANAGER_ERROR_NONE) {
+                       i_ret = _start_virtual_stream(g_voip_vstream_h);
+                       if (i_ret != SOUND_MANAGER_ERROR_NONE)
+                               goto ERROR_CASE;
+               } else {
+                       ret = MM_ERROR_SOUND_INTERNAL;
+                       goto ERROR_CASE;
+               }
+               break;
+       case _SESSION_MODE_VOICE_WITH_BUILTIN_RECEIVER: /* Built-in RCV and Built-in MIC */
+       case _SESSION_MODE_VOICE_WITH_BUILTIN_SPEAKER:  /* Built-in SPK and Built-in MIC */
+       case _SESSION_MODE_VOICE_WITH_AUDIO_JACK:       /* Earphone spk & mic */
+       case _SESSION_MODE_VOICE_WITH_BLUETOOTH:        /* Bluetooth spk & mic */
+               /* check if the device is available now */
+               ret = mm_sound_get_current_device_list(MM_SOUND_DEVICE_ALL_FLAG, &device_list);
+               if (ret != MM_ERROR_NONE) {
+                       LOGE("failed to get current device list");
+                       goto ERROR_CASE;
+               } else {
+                       while (!is_found && ((w_ret = mm_sound_get_next_device(device_list, &tmp_device)) == MM_ERROR_NONE)) {
+                               ret = mm_sound_get_device_type(tmp_device, &type);
+                               if (ret != MM_ERROR_NONE)
+                                       goto ERROR_CASE;
+                               ret = mm_sound_get_device_id(tmp_device, &id);
+                               if (ret != MM_ERROR_NONE)
+                                       goto ERROR_CASE;
+                               else {
+                                       if (g_cached_voip_device_id != -1 && g_cached_voip_device_id == id)
+                                               prev_device = tmp_device;
+                               }
+                               switch (mode) {
+                               case _SESSION_MODE_VOICE_WITH_BUILTIN_RECEIVER:
+                                       if (type == MM_SOUND_DEVICE_TYPE_BUILTIN_RECEIVER) {
+                                               is_found = true;
+                                               proper_device = tmp_device;
+                                               break;
+                                       }
+                               case _SESSION_MODE_VOICE_WITH_BUILTIN_SPEAKER:
+                                       if (type == MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER) {
+                                               is_found = true;
+                                               proper_device = tmp_device;
+                                               break;
+                                       }
+                               case _SESSION_MODE_VOICE_WITH_AUDIO_JACK:
+                                       if (type == MM_SOUND_DEVICE_TYPE_AUDIOJACK) {
+                                               is_found = true;
+                                               proper_device = tmp_device;
+                                               break;
+                                       }
+                                       break;
+                               case _SESSION_MODE_VOICE_WITH_BLUETOOTH:
+                                       if (type == MM_SOUND_DEVICE_TYPE_BLUETOOTH) {
+                                               is_found = true;
+                                               proper_device = tmp_device;
+                                               break;
+                                       }
+                               default:
+                                       break;
+                               }
                        }
+                       if (!is_found) {
+                               LOGE("could not found a proper connected device for this mode(%d)", mode);
+                               ret = MM_ERROR_SOUND_INTERNAL;
+                               goto ERROR_CASE_NO_DESTROY;
+                       }
+               }
+               /* if ok for the device, go below */
+               if (g_cached_session_mode == _SESSION_MODE_RINGTONE) {
+                       /* stop vstream and destroy vstream */
+                       _stop_virtual_stream(g_voip_vstream_h);
+                       _destroy_virtual_stream(g_voip_vstream_h);
+                       g_voip_vstream_h = NULL;
+                       /* destroy stream info */
+                       _destroy_pa_connection_and_unregister_focus(g_voip_stream_info);
+                       free(g_voip_stream_info);
+                       g_voip_stream_info = NULL;
+               }
+               /* create stream info and acquire focus for voip stream */
+               if (g_cached_session_mode == -1 || g_cached_session_mode == _SESSION_MODE_RINGTONE) {
                        if (!g_voip_stream_info) {
                                g_voip_stream_info = malloc(sizeof(sound_stream_info_s));
                                if (!g_voip_stream_info) {
@@ -1004,172 +1107,57 @@ int _set_session_mode (_session_mode_e mode)
                                }
                                memset(g_voip_stream_info, 0, sizeof(sound_stream_info_s));
                        }
-                       /* create stream info and acquire focus for rintone-voip stream */
-                       g_voip_stream_info->stream_type = "ringtone-voip";
+                       g_voip_stream_info->stream_type = "voip";
                        ret = _make_pa_connection_and_register_focus(g_voip_stream_info, _voip_focus_state_change_callback, NULL);
                        if (ret != MM_ERROR_NONE) {
                                free(g_voip_stream_info);
                                g_voip_stream_info = NULL;
                                goto ERROR_CASE;
-                       } else {
-                               /* acquire focus */
-                               ret = mm_sound_acquire_focus(g_voip_stream_info->index, FOCUS_FOR_BOTH, "for voip session");
-                               if (ret == MM_ERROR_NONE) {
-                                       g_voip_stream_info->acquired_focus |= FOCUS_FOR_BOTH;
-                                       _update_focus_status(g_voip_stream_info->index, (unsigned int)g_voip_stream_info->acquired_focus);
-                               } else {
-                                       goto ERROR_CASE;
-                               }
                        }
-                       /* create virtual stream for ringtone-voip */
-                       i_ret = _create_virtual_stream (g_voip_stream_info, &g_voip_vstream_h);
+                       /* set device for routing to the device */
+                       i_ret = _add_device_for_stream_routing(g_voip_stream_info, proper_device);
                        if (i_ret == SOUND_MANAGER_ERROR_NONE) {
-                               i_ret = _start_virtual_stream (g_voip_vstream_h);
-                               if (i_ret != SOUND_MANAGER_ERROR_NONE) {
+                               i_ret = _apply_stream_routing(g_voip_stream_info);
+                               if (i_ret != SOUND_MANAGER_ERROR_NONE)
                                        goto ERROR_CASE;
-                               }
-                       } else {
-                               ret = MM_ERROR_SOUND_INTERNAL;
+                       } else
                                goto ERROR_CASE;
-                       }
-                       break;
-               case _SESSION_MODE_VOICE_WITH_BUILTIN_RECEIVER: /* Built-in RCV and Built-in MIC */
-               case _SESSION_MODE_VOICE_WITH_BUILTIN_SPEAKER:  /* Built-in SPK and Built-in MIC */
-               case _SESSION_MODE_VOICE_WITH_AUDIO_JACK:       /* Earphone spk & mic */
-               case _SESSION_MODE_VOICE_WITH_BLUETOOTH:        /* Bluetooth spk & mic */
-                       /* check if the device is available now */
-                       ret = mm_sound_get_current_device_list(MM_SOUND_DEVICE_ALL_FLAG, &device_list);
-                       if (ret != MM_ERROR_NONE) {
-                               LOGE("failed to get current device list");
+
+                       /* acquire focus */
+                       ret = mm_sound_acquire_focus(g_voip_stream_info->index, FOCUS_FOR_BOTH, "for voip session");
+                       if (ret == MM_ERROR_NONE) {
+                               g_voip_stream_info->acquired_focus |= FOCUS_FOR_BOTH;
+                               _update_focus_status(g_voip_stream_info->index, (unsigned int)g_voip_stream_info->acquired_focus);
+                       } else
                                goto ERROR_CASE;
-                       } else {
-                               while (!is_found && ((w_ret = mm_sound_get_next_device(device_list, &tmp_device)) == MM_ERROR_NONE)) {
-                                       ret = mm_sound_get_device_type(tmp_device, &type);
-                                       if (ret != MM_ERROR_NONE) {
-                                               goto ERROR_CASE;
-                                       }
-                                       ret = mm_sound_get_device_id(tmp_device, &id);
-                                       if (ret != MM_ERROR_NONE) {
-                                               goto ERROR_CASE;
-                                       } else {
-                                               if (g_cached_voip_device_id != -1 && g_cached_voip_device_id == id) {
-                                                       prev_device = tmp_device;
-                                               }
-                                       }
-                                       switch (mode) {
-                                               case _SESSION_MODE_VOICE_WITH_BUILTIN_RECEIVER:
-                                                       if (type == MM_SOUND_DEVICE_TYPE_BUILTIN_RECEIVER) {
-                                                               is_found = true;
-                                                               proper_device = tmp_device;
-                                                               break;
-                                                       }
-                                               case _SESSION_MODE_VOICE_WITH_BUILTIN_SPEAKER:
-                                                       if (type == MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER) {
-                                                               is_found = true;
-                                                               proper_device = tmp_device;
-                                                               break;
-                                                       }
-                                               case _SESSION_MODE_VOICE_WITH_AUDIO_JACK:
-                                                       if (type == MM_SOUND_DEVICE_TYPE_AUDIOJACK) {
-                                                               is_found = true;
-                                                               proper_device = tmp_device;
-                                                               break;
-                                                       }
-                                                       break;
-                                               case _SESSION_MODE_VOICE_WITH_BLUETOOTH:
-                                                       if (type == MM_SOUND_DEVICE_TYPE_BLUETOOTH) {
-                                                               is_found = true;
-                                                               proper_device = tmp_device;
-                                                               break;
-                                                       }
-                                               default:
-                                                       break;
-                                       }
-                               }
-                               if (!is_found) {
-                                       LOGE("could not found a proper connected device for this mode(%d)", mode);
-                                       ret = MM_ERROR_SOUND_INTERNAL;
-                                       goto ERROR_CASE_NO_DESTROY;
-                               }
-                       }
-                       /* if ok for the device, go below */
-                       if (g_cached_session_mode == _SESSION_MODE_RINGTONE) {
-                               /* stop vstream and destroy vstream */
-                               _stop_virtual_stream(g_voip_vstream_h);
-                               _destroy_virtual_stream(g_voip_vstream_h);
-                               g_voip_vstream_h = NULL;
-                               /* destroy stream info */
-                               _destroy_pa_connection_and_unregister_focus(g_voip_stream_info);
-                               free(g_voip_stream_info);
-                               g_voip_stream_info = NULL;
-                       }
-                       /* create stream info and acquire focus for voip stream */
-                       if (g_cached_session_mode == -1 || g_cached_session_mode == _SESSION_MODE_RINGTONE) {
-                               if (!g_voip_stream_info) {
-                                       g_voip_stream_info = malloc(sizeof(sound_stream_info_s));
-                                       if (!g_voip_stream_info) {
-                                               ret = MM_ERROR_OUT_OF_MEMORY;
-                                               goto ERROR_CASE;
-                                       }
-                                       memset(g_voip_stream_info, 0, sizeof(sound_stream_info_s));
-                               }
-                               g_voip_stream_info->stream_type = "voip";
-                               ret = _make_pa_connection_and_register_focus(g_voip_stream_info, _voip_focus_state_change_callback, NULL);
-                               if (ret != MM_ERROR_NONE) {
-                                       free(g_voip_stream_info);
-                                       g_voip_stream_info = NULL;
+
+                       /* create virtual stream for voip */
+                       i_ret = _create_virtual_stream(g_voip_stream_info, &g_voip_vstream_h);
+                       if (i_ret == SOUND_MANAGER_ERROR_NONE) {
+                               i_ret = _start_virtual_stream(g_voip_vstream_h);
+                               if (i_ret != SOUND_MANAGER_ERROR_NONE)
+                                       goto ERROR_CASE;
+                       } else
+                               goto ERROR_CASE;
+
+               } else {
+                       if (g_cached_voip_device_id != -1 && prev_device) {
+                               /* remove cached device */
+                               i_ret = _remove_device_for_stream_routing(g_voip_stream_info, prev_device);
+                               if (i_ret != SOUND_MANAGER_ERROR_NONE)
                                        goto ERROR_CASE;
-                               }
                                /* set device for routing to the device */
                                i_ret = _add_device_for_stream_routing(g_voip_stream_info, proper_device);
                                if (i_ret == SOUND_MANAGER_ERROR_NONE) {
                                        i_ret = _apply_stream_routing(g_voip_stream_info);
-                                       if (i_ret != SOUND_MANAGER_ERROR_NONE) {
-                                               goto ERROR_CASE;
-                                       }
-                               } else {
-                                       goto ERROR_CASE;
-                               }
-                               /* acquire focus */
-                               ret = mm_sound_acquire_focus(g_voip_stream_info->index, FOCUS_FOR_BOTH, "for voip session");
-                               if (ret == MM_ERROR_NONE) {
-                                       g_voip_stream_info->acquired_focus |= FOCUS_FOR_BOTH;
-                                       _update_focus_status(g_voip_stream_info->index, (unsigned int)g_voip_stream_info->acquired_focus);
-                               } else {
-                                       goto ERROR_CASE;
-                               }
-                               /* create virtual stream for voip */
-                               i_ret = _create_virtual_stream(g_voip_stream_info, &g_voip_vstream_h);
-                               if (i_ret == SOUND_MANAGER_ERROR_NONE) {
-                                       i_ret = _start_virtual_stream(g_voip_vstream_h);
-                                       if (i_ret != SOUND_MANAGER_ERROR_NONE) {
-                                               goto ERROR_CASE;
-                                       }
-                               } else {
-                                       goto ERROR_CASE;
-                               }
-                       } else {
-                               if (g_cached_voip_device_id != -1 && prev_device) {
-                                       /* remove cached device */
-                                       i_ret = _remove_device_for_stream_routing(g_voip_stream_info, prev_device);
-                                       if (i_ret != SOUND_MANAGER_ERROR_NONE) {
-                                               goto ERROR_CASE;
-                                       }
-                                       /* set device for routing to the device */
-                                       i_ret = _add_device_for_stream_routing(g_voip_stream_info, proper_device);
-                                       if (i_ret == SOUND_MANAGER_ERROR_NONE) {
-                                               i_ret = _apply_stream_routing(g_voip_stream_info);
-                                               if (i_ret != SOUND_MANAGER_ERROR_NONE) {
-                                                       goto ERROR_CASE;
-                                               }
-                                       } else {
+                                       if (i_ret != SOUND_MANAGER_ERROR_NONE)
                                                goto ERROR_CASE;
-                                       }
-                               } else {
+                               } else
                                        goto ERROR_CASE;
-                               }
-                       }
-                       break;
+                       } else
+                               goto ERROR_CASE;
+               }
+               break;
        }
        g_cached_session_mode = mode;
        g_cached_voip_device_id = id;
@@ -1234,11 +1222,10 @@ int _make_pa_connection_and_register_focus(sound_stream_info_s *stream_h, sound_
 
        /* get configuration information of this stream type */
        ret = _get_stream_conf_info(stream_h->stream_type, &stream_h->stream_conf_info);
-       if (ret) {
+       if (ret)
                goto PA_ERROR_WITH_UNLOCK;
-       } else {
+       else
                LOGI("stream_conf_info : priority[%d], route type[%d]", stream_h->stream_conf_info.priority, stream_h->stream_conf_info.route_type);
-       }
 
        pa_threaded_mainloop_unlock(stream_h->pa_mainloop);
 
@@ -1269,25 +1256,22 @@ PA_ERROR_WITH_UNLOCK:
        pa_threaded_mainloop_unlock(stream_h->pa_mainloop);
 PA_ERROR:
        for (i = 0; i < AVAIL_DEVICES_MAX; i++) {
-               if (stream_h->stream_conf_info.avail_in_devices[i]) {
+               if (stream_h->stream_conf_info.avail_in_devices[i])
                        free(stream_h->stream_conf_info.avail_in_devices[i]);
-               } else {
+               else
                        break;
-               }
        }
        for (i = 0; i < AVAIL_DEVICES_MAX; i++) {
-               if (stream_h->stream_conf_info.avail_out_devices[i]) {
+               if (stream_h->stream_conf_info.avail_out_devices[i])
                        free(stream_h->stream_conf_info.avail_out_devices[i]);
-               } else {
+               else
                        break;
-               }
        }
        for (i = 0; i < AVAIL_FRAMEWORKS_MAX; i++) {
-               if (stream_h->stream_conf_info.avail_frameworks[i]) {
+               if (stream_h->stream_conf_info.avail_frameworks[i])
                        free(stream_h->stream_conf_info.avail_frameworks[i]);
-               } else {
+               else
                        break;
-               }
        }
        if (stream_h->pa_context) {
                pa_context_disconnect(stream_h->pa_context);
@@ -1328,17 +1312,14 @@ int _destroy_pa_connection_and_unregister_focus(sound_stream_info_s *stream_h)
                LOGE("failed to unregister focus, ret(0x%x)", ret);
 
        for (i = 0; i < AVAIL_DEVICES_MAX; i++) {
-               if (stream_h->stream_conf_info.avail_in_devices[i]) {
+               if (stream_h->stream_conf_info.avail_in_devices[i])
                        free(stream_h->stream_conf_info.avail_in_devices[i]);
-               }
-               if (stream_h->stream_conf_info.avail_out_devices[i]) {
+               if (stream_h->stream_conf_info.avail_out_devices[i])
                        free(stream_h->stream_conf_info.avail_out_devices[i]);
-               }
        }
        for (i = 0; i < AVAIL_FRAMEWORKS_MAX; i++) {
-               if (stream_h->stream_conf_info.avail_frameworks[i]) {
+               if (stream_h->stream_conf_info.avail_frameworks[i])
                        free(stream_h->stream_conf_info.avail_frameworks[i]);
-               }
        }
 
        for (i = 0; i < SOUND_STREAM_INFO_ARR_MAX; i++) {
@@ -1351,7 +1332,7 @@ int _destroy_pa_connection_and_unregister_focus(sound_stream_info_s *stream_h)
        return ret;
 }
 
-int _add_device_for_stream_routing (sound_stream_info_s *stream_info, sound_device_h device)
+int _add_device_for_stream_routing(sound_stream_info_s *stream_info, sound_device_h device)
 {
        int ret = MM_ERROR_NONE;
        int i = 0;
@@ -1375,29 +1356,25 @@ int _add_device_for_stream_routing (sound_stream_info_s *stream_info, sound_devi
                /* not ready yet. after preparing in libmm-sound, it'll be enabled */
                if (stream_info->stream_conf_info.route_type == STREAM_ROUTE_TYPE_MANUAL_EXT) {
                        ret = mm_sound_get_device_use_internal_codec(device, &use_internal_codec);
-                       if (ret) {
+                       if (ret)
                                return _convert_sound_manager_error_code(__func__, ret);
-                       }
                        if (use_internal_codec)
                                return _convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
                }
 #endif
                ret = mm_sound_get_device_id(device, &device_id);
-               if (ret) {
+               if (ret)
                        return _convert_sound_manager_error_code(__func__, ret);
-               }
                ret = mm_sound_get_device_type(device, &device_type);
-               if (ret) {
+               if (ret)
                        return _convert_sound_manager_error_code(__func__, ret);
-               }
                ret = _convert_device_type(device_type, &device_type_str);
-               if (ret) {
+               if (ret)
                        return _convert_sound_manager_error_code(__func__, ret);
-               }
                ret = mm_sound_get_device_io_direction(device, &device_direction);
-               if (ret) {
+               if (ret)
                        return _convert_sound_manager_error_code(__func__, ret);
-               }
+
                if (device_direction == MM_SOUND_DEVICE_IO_DIRECTION_IN || device_direction == MM_SOUND_DEVICE_IO_DIRECTION_BOTH) {
                        for (i = 0; i < AVAIL_DEVICES_MAX; i++) {
                                if (stream_info->stream_conf_info.avail_in_devices[i]) {
@@ -1442,14 +1419,13 @@ int _add_device_for_stream_routing (sound_stream_info_s *stream_info, sound_devi
                }
        }
 
-       if (!added_successfully) {
+       if (!added_successfully)
                ret = MM_ERROR_POLICY_INTERNAL;
-       }
 
        return ret;
 }
 
-int _remove_device_for_stream_routing (sound_stream_info_s *stream_info, sound_device_h device)
+int _remove_device_for_stream_routing(sound_stream_info_s *stream_info, sound_device_h device)
 {
        int ret = MM_ERROR_NONE;
        int i = 0;
@@ -1466,18 +1442,16 @@ int _remove_device_for_stream_routing (sound_stream_info_s *stream_info, sound_d
        if (stream_info->stream_conf_info.route_type == STREAM_ROUTE_TYPE_MANUAL ||
                        stream_info->stream_conf_info.route_type == STREAM_ROUTE_TYPE_MANUAL_EXT) {
                ret = mm_sound_get_device_id(device, &device_id);
-               if (ret) {
+               if (ret)
                        return _convert_sound_manager_error_code(__func__, ret);
-               }
                ret = mm_sound_get_device_type(device, &device_type);
-               if (ret) {
+               if (ret)
                        return _convert_sound_manager_error_code(__func__, ret);
-               }
                ret = _convert_device_type(device_type, &device_type_str);
                ret = mm_sound_get_device_io_direction(device, &device_direction);
-               if (ret) {
+               if (ret)
                        return _convert_sound_manager_error_code(__func__, ret);
-               }
+
                if (device_direction == MM_SOUND_DEVICE_IO_DIRECTION_IN || device_direction == MM_SOUND_DEVICE_IO_DIRECTION_BOTH) {
                        for (i = 0; i < AVAIL_DEVICES_MAX; i++) {
                                if (stream_info->stream_conf_info.avail_in_devices[i]) {
@@ -1514,14 +1488,13 @@ int _remove_device_for_stream_routing (sound_stream_info_s *stream_info, sound_d
                }
        }
 
-       if (!removed_successfully) {
+       if (!removed_successfully)
                ret = MM_ERROR_INVALID_ARGUMENT;
-       }
 
        return ret;
 }
 
-int _apply_stream_routing (sound_stream_info_s *stream_info)
+int _apply_stream_routing(sound_stream_info_s *stream_info)
 {
        int ret = MM_ERROR_NONE;
        int i = 0;
@@ -1541,19 +1514,18 @@ int _apply_stream_routing (sound_stream_info_s *stream_info)
                                break;
                        }
                }
-               if (need_to_apply) {
+               if (need_to_apply)
                        ret = _set_manual_route_info(stream_info->index, &stream_info->manual_route_info);
-               } else {
+               else
                        _convert_sound_manager_error_code(__func__, MM_ERROR_SOUND_INVALID_STATE);
-               }
-       } else {
+
+       } else
                ret = MM_ERROR_SOUND_INVALID_STATE;
-       }
 
        return ret;
 }
 
-int _create_virtual_stream (sound_stream_info_s *stream_info, virtual_sound_stream_info_s **virtual_stream)
+int _create_virtual_stream(sound_stream_info_s *stream_info, virtual_sound_stream_info_s **virtual_stream)
 {
        int ret = MM_ERROR_NONE;
        bool result = false;
@@ -1574,9 +1546,9 @@ int _create_virtual_stream (sound_stream_info_s *stream_info, virtual_sound_stre
        LOGI("stream_type[%s], native api[%s], is_available[%d]", stream_info->stream_type, name, result);
        if (result == true) {
                (*virtual_stream) = malloc(sizeof(virtual_sound_stream_info_s));
-               if(!(*virtual_stream)) {
+               if (!(*virtual_stream))
                        ret = MM_ERROR_OUT_OF_MEMORY;
-               else {
+               else {
                        memset((*virtual_stream), 0, sizeof(virtual_sound_stream_info_s));
                        (*virtual_stream)->stream_type = stream_info->stream_type;
                        (*virtual_stream)->pa_mainloop = stream_info->pa_mainloop;
@@ -1587,13 +1559,13 @@ int _create_virtual_stream (sound_stream_info_s *stream_info, virtual_sound_stre
                        (*virtual_stream)->state = _VSTREAM_STATE_READY;
                        (*virtual_stream)->stream_info = stream_info;
                }
-       } else {
+       } else
                ret = MM_ERROR_SOUND_NOT_SUPPORTED_OPERATION;
-       }
+
        return ret;
 }
 
-int _destroy_virtual_stream (virtual_sound_stream_info_s *virtual_stream)
+int _destroy_virtual_stream(virtual_sound_stream_info_s *virtual_stream)
 {
        int ret = MM_ERROR_NONE;
 
@@ -1611,7 +1583,7 @@ int _destroy_virtual_stream (virtual_sound_stream_info_s *virtual_stream)
        return ret;
 }
 
-int _start_virtual_stream (virtual_sound_stream_info_s *virtual_stream)
+int _start_virtual_stream(virtual_sound_stream_info_s *virtual_stream)
 {
        int ret = MM_ERROR_NONE;
        int pa_ret = PA_OK;
@@ -1650,7 +1622,7 @@ int _start_virtual_stream (virtual_sound_stream_info_s *virtual_stream)
        for (i = 0; i < SOUND_STREAM_DIRECTION_MAX; i++) {
                if (io_direction & (i + 1)) {
                        virtual_stream->pa_stream[i] = pa_stream_new_with_proplist(virtual_stream->pa_context, "VIRTUAL_STREAM", &ss, &maps, virtual_stream->pa_proplist);
-                       if(virtual_stream->pa_stream[i] == NULL) {
+                       if (virtual_stream->pa_stream[i] == NULL) {
                                LOGE("failed to pa_stream_new_with_proplist()");
                                pa_ret = pa_context_errno(virtual_stream->pa_context);
                                ret = MM_ERROR_SOUND_INTERNAL;
@@ -1680,12 +1652,11 @@ int _start_virtual_stream (virtual_sound_stream_info_s *virtual_stream)
                        for (;;) {
                                pa_stream_state_t state;
                                state = pa_stream_get_state(virtual_stream->pa_stream[i]);
-                               if (state == PA_STREAM_READY) {
+                               if (state == PA_STREAM_READY)
                                        break;
-                               }
-                               if (!PA_STREAM_IS_GOOD(state)) {
+                               if (!PA_STREAM_IS_GOOD(state))
                                        pa_ret = pa_context_errno(virtual_stream->pa_context);
-                               }
+
                                pa_threaded_mainloop_wait(virtual_stream->pa_mainloop);
                        }
                }
@@ -1713,7 +1684,7 @@ ERROR:
        return ret;
 }
 
-int _stop_virtual_stream (virtual_sound_stream_info_s *virtual_stream)
+int _stop_virtual_stream(virtual_sound_stream_info_s *virtual_stream)
 {
        int ret = MM_ERROR_NONE;
        int i = 0;
@@ -1732,9 +1703,8 @@ int _stop_virtual_stream (virtual_sound_stream_info_s *virtual_stream)
                        for (;;) {
                                pa_stream_state_t state;
                                state = pa_stream_get_state(virtual_stream->pa_stream[i]);
-                               if (state == PA_STREAM_TERMINATED) {
+                               if (state == PA_STREAM_TERMINATED)
                                        break;
-                               }
                                pa_threaded_mainloop_wait(virtual_stream->pa_mainloop);
                        }
 
index 7e209f99cbb5d4780a2bbb2e742bc4173dc06a86..336aa5c6a9afddef62b664e3ac7c7b0cfecdb8f7 100644 (file)
 #include <sound_manager_internal.h>
 #include <pthread.h>
 #include <glib.h>
-//#include <dlfcn.h>
 
 #define MAX_STRING_LEN 2048
 
-
-enum
-{
+enum {
        CURRENT_STATUS_MAINMENU,
        CURRENT_STATUS_GET_MAX_VOLUME,
        CURRENT_STATUS_SET_VOLUME,
@@ -85,26 +82,31 @@ sound_device_mask_e g_device_mask = SOUND_DEVICE_ALL_MASK;
 sound_stream_info_h g_stream_info_h = NULL;
 virtual_sound_stream_h g_vstream_h = NULL;
 
-void focus_callback (sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data) {
+void focus_callback(sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data)
+{
        int ret = 0;
        sound_stream_focus_state_e playback_focus_state;
        sound_stream_focus_state_e recording_focus_state;
        g_print("*** FOCUS callback is called, stream_info(%p) ***\n", stream_info);
        g_print(" - reason_for_change(%d), additional_info(%s), user_data(%p)\n", reason_for_change, additional_info, user_data);
-       ret = sound_manager_get_focus_state (stream_info, &playback_focus_state, &recording_focus_state);
+
+       ret = sound_manager_get_focus_state(stream_info, &playback_focus_state, &recording_focus_state);
        if (!ret)
                g_print(" - focus_state(playback_focus:%d, recording_focus:%d)\n", playback_focus_state, recording_focus_state);
-       if (playback_focus_state == SOUND_STREAM_FOCUS_STATE_ACQUIRED) {
+
+       if (playback_focus_state == SOUND_STREAM_FOCUS_STATE_ACQUIRED)
                g_print(" -- PLAYBACK_FOCUS acquired\n");
-       }
-       if (recording_focus_state == SOUND_STREAM_FOCUS_STATE_ACQUIRED) {
+
+       if (recording_focus_state == SOUND_STREAM_FOCUS_STATE_ACQUIRED)
                g_print(" -- FOCUS_RECORDING acquired\n");
-       }
+
        g_print("*** FOCUS callback is ended, stream_info(%p) ****\n", stream_info);
+
        return;
 }
 
-void focus_watch_callback (sound_stream_focus_mask_e  changed_focus_type, sound_stream_focus_state_e changed_focus_state, sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data) {
+void focus_watch_callback(sound_stream_focus_mask_e  changed_focus_type, sound_stream_focus_state_e changed_focus_state, sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data)
+{
        g_print("*** FOCUS WATCH callback is called ***\n");
        g_print(" - changed_focus_type(%d), changed_focus_state(%d), reason_for_change(%d), additional_info(%s), user_data(%p)\n",
                                changed_focus_type, changed_focus_state, reason_for_change, additional_info, user_data);
@@ -118,192 +120,99 @@ void quit_program()
 
 void _interpret_main_menu(char *cmd)
 {
-               if (strncmp(cmd, "gx", 3) == 0)
-               {
-                       g_menu_state = CURRENT_STATUS_GET_MAX_VOLUME;
-               }
-           else if (strncmp(cmd, "sv", 3) == 0)
-               {
-                       g_menu_state = CURRENT_STATUS_SET_VOLUME;
-               }               
-               else if (strncmp(cmd, "gv", 3) == 0)
-               {
-                       g_menu_state = CURRENT_STATUS_GET_VOLUME;
-               }
-               else if (strncmp(cmd, "st", 3) == 0)
-               {
-                       g_menu_state = CURRENT_STATUS_SET_CURRENT_SOUND_TYPE;
-               }
-               else if (strncmp(cmd, "gt", 3) == 0)
-               {
-                       g_menu_state = CURRENT_STATUS_GET_CURRENT_SOUND_TYPE;
-               }
-               else if (strncmp(cmd, "ut", 3) == 0)
-               {
-                       g_menu_state = CURRENT_STATUS_UNSET_CURRENT_SOUND_TYPE;
-               }               
-               else if (strncmp(cmd, "vc", 3) == 0)
-               {
-                       g_menu_state = CURRENT_STATUS_SET_VOLUME_CHANGED_CB;
-               }
-               else if (strncmp(cmd, "uv", 3) == 0)
-               {
-                       g_menu_state = CURRENT_STATUS_UNSET_VOLUME_CHANGED_CB;
-               }
-               else if (strncmp(cmd, "ss", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_SET_SESSION_TYPE;
-               }               
-               else if (strncmp(cmd, "gs", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_GET_SESSION_TYPE;
-               }
-               else if (strncmp(cmd, "sm", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_SET_MEDIA_SESSION_OPTION;
-               }
-               else if (strncmp(cmd, "gm", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_GET_MEDIA_SESSION_OPTION;
-               }
-               else if (strncmp(cmd, "sr", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_SET_MEDIA_SESSION_RESUMPTION_OPTION;
-               }
-               else if (strncmp(cmd, "gr", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_GET_MEDIA_SESSION_RESUMPTION_OPTION;
-               }
-               else if (strncmp(cmd, "so", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_SET_VOIP_SESSION_MODE;
-               }
-               else if (strncmp(cmd, "go", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_GET_VOIP_SESSION_MODE;
-               }
-               else if (strncmp(cmd, "sl", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_SET_CALL_SESSION_MODE;
-               }
-               else if (strncmp(cmd, "gc", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_GET_CALL_SESSION_MODE;
-               }
-               else if (strncmp(cmd, "sc", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_SET_SESSION_INTERRUPTED_CB;
-               }
-               else if (strncmp(cmd, "us", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_UNSET_SESSION_INTERRUPTED_CB;
-               }
-               else if (strncmp(cmd, "sk", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_SET_DEVICE_MASK;
-               }
-               else if (strncmp(cmd, "gk", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_GET_DEVICE_MASK;
-               }
-               else if (strncmp(cmd, "gl", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_GET_DEVICE_LIST;
-               }
-               else if (strncmp(cmd, "gn", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_GET_DEVICE_NEXT;
-               }
-               else if (strncmp(cmd, "gp", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_GET_DEVICE_PREV;
-               }
-               else if (strncmp(cmd, "sd", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_SET_DEVICE_CONNECTED_CB;
-               }
-               else if (strncmp(cmd, "ud", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_UNSET_DEVICE_CONNECTED_CB;
-               }
-               else if (strncmp(cmd, "si", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_SET_DEVICE_INFO_CHANGED_CB;
-               }
-               else if (strncmp(cmd, "ui", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_UNSET_DEVICE_INFO_CHANGED_CB;
-               }
-               else if (strncmp(cmd, "csi", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_CREATE_STREAM_INFO;
-               }
-               else if (strncmp(cmd, "ads", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_ADD_DEVICE_FOR_STREAM_ROUTING;
-               }
-               else if (strncmp(cmd, "rds", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_REMOVE_DEVICE_FOR_STREAM_ROUTING;
-               }
-               else if (strncmp(cmd, "aps", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_APPLY_STREAM_ROUTING;
-               }
-               else if (strncmp(cmd, "sso", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_SET_STREAM_ROUTING_OPTION;
-               }
-               else if (strncmp(cmd, "afc", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_ACQUIRE_FOCUS;
-               }
-               else if (strncmp(cmd, "rfc", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_RELEASE_FOCUS;
-               }
-               else if (strncmp(cmd, "gfs", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_GET_ACQUIRED_FOCUS;
-               }
-               else if (strncmp(cmd, "sfw", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_SET_FOCUS_WATCH_CB;
-               }
-               else if (strncmp(cmd, "ufw", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_UNSET_FOCUS_WATCH_CB;
-               }
-               else if (strncmp(cmd, "dsi", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_DESTROY_STREAM_INFO;
-               }
-               else if (strncmp(cmd, "vcr", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_CREATE_VIRTUAL_STREAM;
-               }
-               else if (strncmp(cmd, "vsr", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_START_VIRTUAL_STREAM;
-               }
-               else if (strncmp(cmd, "vst", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_STOP_VIRTUAL_STREAM;
-               }
-               else if (strncmp(cmd, "vdt", 3) == 0 )
-               {
-                       g_menu_state = CURRENT_STATUS_DESTROY_VIRTUAL_STREAM;
-               }
-               else if (strncmp(cmd, "q", 3) == 0 )
-               {
-                       g_print("closing the test suite\n");
-                       quit_program();
-               }
-               else
-               {
-                       g_print("unknown menu \n");
-               }
-
+       if (strncmp(cmd, "gx", 3) == 0)
+               g_menu_state = CURRENT_STATUS_GET_MAX_VOLUME;
+       else if (strncmp(cmd, "sv", 3) == 0)
+               g_menu_state = CURRENT_STATUS_SET_VOLUME;
+       else if (strncmp(cmd, "gv", 3) == 0)
+               g_menu_state = CURRENT_STATUS_GET_VOLUME;
+       else if (strncmp(cmd, "st", 3) == 0)
+               g_menu_state = CURRENT_STATUS_SET_CURRENT_SOUND_TYPE;
+       else if (strncmp(cmd, "gt", 3) == 0)
+               g_menu_state = CURRENT_STATUS_GET_CURRENT_SOUND_TYPE;
+       else if (strncmp(cmd, "ut", 3) == 0)
+               g_menu_state = CURRENT_STATUS_UNSET_CURRENT_SOUND_TYPE;
+       else if (strncmp(cmd, "vc", 3) == 0)
+               g_menu_state = CURRENT_STATUS_SET_VOLUME_CHANGED_CB;
+       else if (strncmp(cmd, "uv", 3) == 0)
+               g_menu_state = CURRENT_STATUS_UNSET_VOLUME_CHANGED_CB;
+       else if (strncmp(cmd, "ss", 3) == 0)
+               g_menu_state = CURRENT_STATUS_SET_SESSION_TYPE;
+       else if (strncmp(cmd, "gs", 3) == 0)
+               g_menu_state = CURRENT_STATUS_GET_SESSION_TYPE;
+       else if (strncmp(cmd, "sm", 3) == 0)
+               g_menu_state = CURRENT_STATUS_SET_MEDIA_SESSION_OPTION;
+       else if (strncmp(cmd, "gm", 3) == 0)
+               g_menu_state = CURRENT_STATUS_GET_MEDIA_SESSION_OPTION;
+       else if (strncmp(cmd, "sr", 3) == 0)
+               g_menu_state = CURRENT_STATUS_SET_MEDIA_SESSION_RESUMPTION_OPTION;
+       else if (strncmp(cmd, "gr", 3) == 0)
+               g_menu_state = CURRENT_STATUS_GET_MEDIA_SESSION_RESUMPTION_OPTION;
+       else if (strncmp(cmd, "so", 3) == 0)
+               g_menu_state = CURRENT_STATUS_SET_VOIP_SESSION_MODE;
+       else if (strncmp(cmd, "go", 3) == 0)
+               g_menu_state = CURRENT_STATUS_GET_VOIP_SESSION_MODE;
+       else if (strncmp(cmd, "sl", 3) == 0)
+               g_menu_state = CURRENT_STATUS_SET_CALL_SESSION_MODE;
+       else if (strncmp(cmd, "gc", 3) == 0)
+               g_menu_state = CURRENT_STATUS_GET_CALL_SESSION_MODE;
+       else if (strncmp(cmd, "sc", 3) == 0)
+               g_menu_state = CURRENT_STATUS_SET_SESSION_INTERRUPTED_CB;
+       else if (strncmp(cmd, "us", 3) == 0)
+               g_menu_state = CURRENT_STATUS_UNSET_SESSION_INTERRUPTED_CB;
+       else if (strncmp(cmd, "sk", 3) == 0)
+               g_menu_state = CURRENT_STATUS_SET_DEVICE_MASK;
+       else if (strncmp(cmd, "gk", 3) == 0)
+               g_menu_state = CURRENT_STATUS_GET_DEVICE_MASK;
+       else if (strncmp(cmd, "gl", 3) == 0)
+               g_menu_state = CURRENT_STATUS_GET_DEVICE_LIST;
+       else if (strncmp(cmd, "gn", 3) == 0)
+               g_menu_state = CURRENT_STATUS_GET_DEVICE_NEXT;
+       else if (strncmp(cmd, "gp", 3) == 0)
+               g_menu_state = CURRENT_STATUS_GET_DEVICE_PREV;
+       else if (strncmp(cmd, "sd", 3) == 0)
+               g_menu_state = CURRENT_STATUS_SET_DEVICE_CONNECTED_CB;
+       else if (strncmp(cmd, "ud", 3) == 0)
+               g_menu_state = CURRENT_STATUS_UNSET_DEVICE_CONNECTED_CB;
+       else if (strncmp(cmd, "si", 3) == 0)
+               g_menu_state = CURRENT_STATUS_SET_DEVICE_INFO_CHANGED_CB;
+       else if (strncmp(cmd, "ui", 3) == 0)
+               g_menu_state = CURRENT_STATUS_UNSET_DEVICE_INFO_CHANGED_CB;
+       else if (strncmp(cmd, "csi", 3) == 0)
+               g_menu_state = CURRENT_STATUS_CREATE_STREAM_INFO;
+       else if (strncmp(cmd, "ads", 3) == 0)
+               g_menu_state = CURRENT_STATUS_ADD_DEVICE_FOR_STREAM_ROUTING;
+       else if (strncmp(cmd, "rds", 3) == 0)
+               g_menu_state = CURRENT_STATUS_REMOVE_DEVICE_FOR_STREAM_ROUTING;
+       else if (strncmp(cmd, "aps", 3) == 0)
+               g_menu_state = CURRENT_STATUS_APPLY_STREAM_ROUTING;
+       else if (strncmp(cmd, "sso", 3) == 0)
+               g_menu_state = CURRENT_STATUS_SET_STREAM_ROUTING_OPTION;
+       else if (strncmp(cmd, "afc", 3) == 0)
+               g_menu_state = CURRENT_STATUS_ACQUIRE_FOCUS;
+       else if (strncmp(cmd, "rfc", 3) == 0)
+               g_menu_state = CURRENT_STATUS_RELEASE_FOCUS;
+       else if (strncmp(cmd, "gfs", 3) == 0)
+               g_menu_state = CURRENT_STATUS_GET_ACQUIRED_FOCUS;
+       else if (strncmp(cmd, "sfw", 3) == 0)
+               g_menu_state = CURRENT_STATUS_SET_FOCUS_WATCH_CB;
+       else if (strncmp(cmd, "ufw", 3) == 0)
+               g_menu_state = CURRENT_STATUS_UNSET_FOCUS_WATCH_CB;
+       else if (strncmp(cmd, "dsi", 3) == 0)
+               g_menu_state = CURRENT_STATUS_DESTROY_STREAM_INFO;
+       else if (strncmp(cmd, "vcr", 3) == 0)
+               g_menu_state = CURRENT_STATUS_CREATE_VIRTUAL_STREAM;
+       else if (strncmp(cmd, "vsr", 3) == 0)
+               g_menu_state = CURRENT_STATUS_START_VIRTUAL_STREAM;
+       else if (strncmp(cmd, "vst", 3) == 0)
+               g_menu_state = CURRENT_STATUS_STOP_VIRTUAL_STREAM;
+       else if (strncmp(cmd, "vdt", 3) == 0)
+               g_menu_state = CURRENT_STATUS_DESTROY_VIRTUAL_STREAM;
+       else if (strncmp(cmd, "q", 3) == 0) {
+               g_print("closing the test suite\n");
+               quit_program();
+       } else
+               g_print("unknown menu \n");
 }
 
 void display_sub_basic()
@@ -324,7 +233,7 @@ void display_sub_basic()
        g_print("uv. Unset Volume Changed CB \n");
        g_print("-----------------------------------------------------------------------------------------\n");
        g_print("                                    SESSION MODULE \n");
-       g_print("-----------------------------------------------------------------------------------------\n"); 
+       g_print("-----------------------------------------------------------------------------------------\n");
        g_print("ss. Set Session Type\t\t");
        g_print("gs. Get Session Type\n");
        g_print("sm. Set Media Session Option \t");
@@ -372,193 +281,102 @@ void display_sub_basic()
 static void displaymenu()
 {
        static int flag = 0;
-       if (g_menu_state == CURRENT_STATUS_MAINMENU)
-       {
+       if (g_menu_state == CURRENT_STATUS_MAINMENU) {
                display_sub_basic();
                flag = 0;
-       }
-       else if (g_menu_state == CURRENT_STATUS_GET_MAX_VOLUME)
-       {
+       } else if (g_menu_state == CURRENT_STATUS_GET_MAX_VOLUME)
                g_print("*** input sound type(0:SYSTEM 1:NOTIFICATION 2:ALARM 3:RINGTONE 4:MEDIA 5:CALL 6:VOIP 7:VOICE)\n");
-       }
-       else if (g_menu_state == CURRENT_STATUS_SET_VOLUME)
-       {
-               if(flag == 0)
-               g_print("*** input sound type and desired volume level(0:SYSTEM 1:NOTIFICATION 2:ALARM 3:RINGTONE 4:MEDIA 5:CALL 6:VOIP 7:VOICE, (0~max volum).\n");
-               flag =1;
-       }
-       else if (g_menu_state == CURRENT_STATUS_GET_VOLUME)
-       {
+       else if (g_menu_state == CURRENT_STATUS_SET_VOLUME) {
+               if (flag == 0)
+                       g_print("*** input sound type and desired volume level(0:SYSTEM 1:NOTIFICATION 2:ALARM 3:RINGTONE 4:MEDIA 5:CALL 6:VOIP 7:VOICE, (0~max volum).\n");
+               flag = 1;
+       } else if (g_menu_state == CURRENT_STATUS_GET_VOLUME)
                g_print("*** input sound type(0:SYSTEM 1:NOTIFICATION 2:ALARM 3:RINGTONE 4:MEDIA 5:CALL 6:VOIP 7:VOICE)\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_SET_CURRENT_SOUND_TYPE)
-       {
                g_print("*** input sound type.(0:SYSTEM 1:NOTIFICATION 2:ALARM 3:RINGTONE 4:MEDIA 5:CALL 6:VOIP 7:VOICE)\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_GET_CURRENT_SOUND_TYPE)
-       {
                g_print("*** press enter to get current sound type\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_UNSET_CURRENT_SOUND_TYPE)
-       {
                g_print("*** press enter to unset current sound type\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_SET_VOLUME_CHANGED_CB)
-       {
                g_print("*** press enter to set volume changed cb\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_UNSET_VOLUME_CHANGED_CB)
-       {
                g_print("*** press enter to unset volume changed cb\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_SET_SESSION_TYPE)
-       {
                g_print("*** input session type(0:MEDIA, 1:ALARM, 2:NOTIFICATION, 3:EMERGENCY, 4:VOIP)\n");
-       }       
        else if (g_menu_state == CURRENT_STATUS_GET_SESSION_TYPE)
-       {
                g_print("*** press enter to get session type\n");
-       }
-       else if (g_menu_state == CURRENT_STATUS_SET_MEDIA_SESSION_OPTION)
-       {
-               if(flag == 0)
-               g_print("*** input starting option, and ongoing(for starting(0:MIX WITH OTHERS, 1:PAUSE OTHERS), for ongoing(0:INTERRUPTABLE, 1:UNINTERRUPABLE)\n");
+       else if (g_menu_state == CURRENT_STATUS_SET_MEDIA_SESSION_OPTION) {
+               if (flag == 0)
+                       g_print("*** input starting option, and ongoing(for starting(0:MIX WITH OTHERS, 1:PAUSE OTHERS), for ongoing(0:INTERRUPTABLE, 1:UNINTERRUPABLE)\n");
                flag = 1;
-       }
-       else if (g_menu_state == CURRENT_STATUS_GET_MEDIA_SESSION_OPTION)
-       {
+       } else if (g_menu_state == CURRENT_STATUS_GET_MEDIA_SESSION_OPTION)
                g_print("*** press enter to get media session option\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_SET_MEDIA_SESSION_RESUMPTION_OPTION)
-       {
                g_print("*** input media session resumption option(0:BY SYSTEM, 1:OR MEDIA PAUSE)\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_GET_MEDIA_SESSION_RESUMPTION_OPTION)
-       {
                g_print("*** press enter to get media session resumption option\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_SET_VOIP_SESSION_MODE)
-       {
                g_print("*** input voip session mode (0:RINGTONE, 1:VOICE with RCV, 2:VOICE with SPK, 3:VOICE with AudioJack, 4:VOICE with BT)\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_GET_VOIP_SESSION_MODE)
-       {
                g_print("*** press enter to get voip session mode\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_SET_CALL_SESSION_MODE)
-       {
                g_print("*** input call session mode (0:RINGTONE, 1:VOICE with RCV, 2:VOICE with SPK, 3:VOICE with AudioJack, 4:VOICE with BT)\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_GET_CALL_SESSION_MODE)
-       {
                g_print("*** press enter to get call session mode\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_SET_SESSION_INTERRUPTED_CB)
-       {
                g_print("*** press enter to set session interrupted cb\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_UNSET_SESSION_INTERRUPTED_CB)
-       {
                g_print("*** press enter to unset session interrupted cb\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_SET_DEVICE_MASK)
-       {
                g_print("*** input device mask (0:ALL, 1:INTERNAL, 2:EXTERNAL, 3:INPUT, 4:OUTPUT, 5:BOTH, 6:ACTIVATED, 7:DEACTIVATED, b:back to the menu\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_GET_DEVICE_MASK)
-       {
                g_print("*** press enter to get device mask\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_GET_DEVICE_LIST)
-       {
                g_print("*** press enter to get device list\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_GET_DEVICE_NEXT)
-       {
                g_print("*** press enter to get next device from the list\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_GET_DEVICE_PREV)
-       {
                g_print("*** press enter to get previous device from the list\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_SET_DEVICE_CONNECTED_CB)
-       {
                g_print("*** press enter to set device connected cb\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_UNSET_DEVICE_CONNECTED_CB)
-       {
                g_print("*** press enter to unset device connected cb\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_SET_DEVICE_INFO_CHANGED_CB)
-       {
                g_print("*** press enter to set device information changed cb\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_UNSET_DEVICE_INFO_CHANGED_CB)
-       {
                g_print("*** press enter to unset device information changed cb\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_CREATE_STREAM_INFO)
-       {
                g_print("*** input stream type to create stream information (0:media, 1:alarm, 2:notification, 3:ringtone-call, 4:voice-call, 5:voip, 6:media-ext-only)\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_ADD_DEVICE_FOR_STREAM_ROUTING)
-       {
                g_print("*** input device type to add (0:built-in mic, 1:built-in spk, 2:built-in rcv, 3:audio-jack, 4:bt)\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_REMOVE_DEVICE_FOR_STREAM_ROUTING)
-       {
                g_print("*** input device type to remove (0:built-in mic, 1:built-in spk, 2:built-in rcv, 3:audio-jack, 4:bt)\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_APPLY_STREAM_ROUTING)
-       {
                g_print("*** press enter to apply devices for stream routing\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_SET_STREAM_ROUTING_OPTION)
-       {
                g_print("*** input option(name/value) for routing (0:option_1/0, 1:option_1/1, 2:option_2/0, 3:option_2:1)\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_ACQUIRE_FOCUS)
-       {
                g_print("*** input focus type to acquire (0:playback, 1:recording, 2:both)\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_RELEASE_FOCUS)
-       {
                g_print("*** input focus type to release (0:playback, 1:recording, 2:both)\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_GET_ACQUIRED_FOCUS)
-       {
                g_print("*** press enter to get focus state\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_DESTROY_STREAM_INFO)
-       {
                g_print("*** press enter to destroy stream information\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_SET_FOCUS_WATCH_CB)
-       {
                g_print("*** input focus type to watch for (0:playback, 1:recording, 2:both)\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_UNSET_FOCUS_WATCH_CB)
-       {
                g_print("*** press enter to unset focus state watch cb\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_CREATE_VIRTUAL_STREAM)
-       {
                g_print("*** press enter to create virtual stream\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_START_VIRTUAL_STREAM)
-       {
                g_print("*** press enter to start virtual stream\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_STOP_VIRTUAL_STREAM)
-       {
                g_print("*** press enter to stop virtual stream\n");
-       }
        else if (g_menu_state == CURRENT_STATUS_DESTROY_VIRTUAL_STREAM)
-       {
                g_print("*** press enter to destroy virtual stream\n");
-       }
-       else
-       {
+       else {
                g_print("*** unknown status.\n");
                quit_program();
        }
@@ -571,83 +389,68 @@ gboolean timeout_menu_display(void* data)
        return FALSE;
 }
 
-gboolean timeout_quit_program(void* data)
-{
-       //elm_exit();
-       quit_program();
-       return FALSE;
-}
-
 int convert_sound_type(sound_type_e *type, char *cmd)
 {
        int sound_type_n = atoi(cmd);
-               if (SOUND_TYPE_SYSTEM > sound_type_n || sound_type_n > SOUND_TYPE_VOICE)
-               {
-                       g_print("not supported sound type(%d)\n", sound_type_n);
-                       return 0;
-               }
-               else
-               {
-                       switch (sound_type_n)
-                       {
-                               case 0:
-                                       *type = SOUND_TYPE_SYSTEM;
-                                       break;
-                               case 1:
-                                       *type = SOUND_TYPE_NOTIFICATION;
-                                       break;
-                               case 2:
-                                       *type = SOUND_TYPE_ALARM;
-                                       break;
-                               case 3:
-                                       *type = SOUND_TYPE_RINGTONE;
-                                       break;
-                               case 4:
-                                       *type = SOUND_TYPE_MEDIA;
-                                       break;
-                               case 5:
-                                       *type = SOUND_TYPE_CALL;
-                                       break;
-                               case 6:
-                                       *type = SOUND_TYPE_VOIP;
-                                       break;
-                               case 7:
-                                       *type = SOUND_TYPE_VOICE;
-                                       break;
-                       }
+       if (SOUND_TYPE_SYSTEM > sound_type_n || sound_type_n > SOUND_TYPE_VOICE) {
+               g_print("not supported sound type(%d)\n", sound_type_n);
+               return 0;
+       } else {
+               switch (sound_type_n) {
+               case 0:
+                       *type = SOUND_TYPE_SYSTEM;
+                       break;
+               case 1:
+                       *type = SOUND_TYPE_NOTIFICATION;
+                       break;
+               case 2:
+                       *type = SOUND_TYPE_ALARM;
+                       break;
+               case 3:
+                       *type = SOUND_TYPE_RINGTONE;
+                       break;
+               case 4:
+                       *type = SOUND_TYPE_MEDIA;
+                       break;
+               case 5:
+                       *type = SOUND_TYPE_CALL;
+                       break;
+               case 6:
+                       *type = SOUND_TYPE_VOIP;
+                       break;
+               case 7:
+                       *type = SOUND_TYPE_VOICE;
+                       break;
                }
+       }
        return 1;
 }
 
 int convert_session_type(sound_session_type_e *type, char *cmd)
 {
        int session_type_n = atoi(cmd);
-               if (SOUND_SESSION_TYPE_MEDIA > session_type_n || session_type_n > SOUND_SESSION_TYPE_VOIP)
-               {
-                       g_print("not supported session type(%d)\n", session_type_n);
-                       return 0;
-               }
-               else
-               {
-                       switch (session_type_n)
-                       {
-                               case 0:
-                                       *type = SOUND_SESSION_TYPE_MEDIA;
-                                       break;
-                               case 1:
-                                       *type = SOUND_SESSION_TYPE_ALARM;
-                                       break;
-                               case 2:
-                                       *type = SOUND_SESSION_TYPE_NOTIFICATION;
-                                       break;
-                               case 3:
-                                       *type = SOUND_SESSION_TYPE_EMERGENCY;
-                                       break;
-                               case 4:
-                                       *type = SOUND_SESSION_TYPE_VOIP;
-                                       break;
-                       }
+       if (SOUND_SESSION_TYPE_MEDIA > session_type_n || session_type_n > SOUND_SESSION_TYPE_VOIP) {
+               g_print("not supported session type(%d)\n", session_type_n);
+               return 0;
+       } else {
+               switch (session_type_n) {
+               case 0:
+                       *type = SOUND_SESSION_TYPE_MEDIA;
+                       break;
+               case 1:
+                       *type = SOUND_SESSION_TYPE_ALARM;
+                       break;
+               case 2:
+                       *type = SOUND_SESSION_TYPE_NOTIFICATION;
+                       break;
+               case 3:
+                       *type = SOUND_SESSION_TYPE_EMERGENCY;
+                       break;
+               case 4:
+                       *type = SOUND_SESSION_TYPE_VOIP;
+                       break;
                }
+       }
        return 1;
 }
 
@@ -672,15 +475,15 @@ void _set_device_connected_cb(sound_device_h device, bool is_connected, void *us
 
        g_print("***device connected callback is called, is_connected[%d]\n", is_connected);
 
-       if ((ret = sound_manager_get_device_type (device, &type)))
+       if ((ret = sound_manager_get_device_type(device, &type)))
                g_print("failed to get device type, ret[0x%x]\n", ret);
-       if ((ret = sound_manager_get_device_io_direction (device, &io_direction)))
+       if ((ret = sound_manager_get_device_io_direction(device, &io_direction)))
                g_print("failed to get device io direction, ret[0x%x]\n", ret);
-       if ((ret = sound_manager_get_device_id (device, &id)))
+       if ((ret = sound_manager_get_device_id(device, &id)))
                g_print("failed to get device id, ret[0x%x]\n", ret);
-       if ((ret = sound_manager_get_device_name (device, &name)))
+       if ((ret = sound_manager_get_device_name(device, &name)))
                g_print("failed to get device name, ret[0x%x]\n", ret);
-       if ((ret = sound_manager_get_device_state (device, &state)))
+       if ((ret = sound_manager_get_device_state(device, &state)))
                g_print("failed to get device state, ret[0x%x]\n", ret);
        if (!ret)
                g_print(" -- device type[%d], io_direction[%d], id[%d], name[%s], state[%d]\n", type, io_direction, id, name, state);
@@ -697,15 +500,15 @@ void _set_device_info_changed_cb(sound_device_h device, sound_device_changed_inf
 
        g_print("***device information changed callback is called, changed_info[%d](0:STATE 1:IO_DIRECTION)\n", changed_info);
 
-       if ((ret = sound_manager_get_device_type (device, &type)))
+       if ((ret = sound_manager_get_device_type(device, &type)))
                g_print("failed to get device type, ret[0x%x]\n", ret);
-       if ((ret = sound_manager_get_device_io_direction (device, &io_direction)))
+       if ((ret = sound_manager_get_device_io_direction(device, &io_direction)))
                g_print("failed to get device io direction, ret[0x%x]\n", ret);
-       if ((ret = sound_manager_get_device_id (device, &id)))
+       if ((ret = sound_manager_get_device_id(device, &id)))
                g_print("failed to get device id, ret[0x%x]\n", ret);
-       if ((ret = sound_manager_get_device_name (device, &name)))
+       if ((ret = sound_manager_get_device_name(device, &name)))
                g_print("failed to get device name, ret[0x%x]\n", ret);
-       if ((ret = sound_manager_get_device_state (device, &state)))
+       if ((ret = sound_manager_get_device_state(device, &state)))
                g_print("failed to get device state, ret[0x%x]\n", ret);
        if (!ret)
                g_print(" -- device type[%d], io_direction[%d], id[%d], name[%s], state[%d]\n", type, io_direction, id, name, state);
@@ -716,609 +519,558 @@ void reset_menu_state(void)
        g_menu_state = CURRENT_STATUS_MAINMENU;
 }
 
-static void interpret (char *cmd)
+static void interpret(char *cmd)
 {
-       switch (g_menu_state)
-       {
-               case CURRENT_STATUS_MAINMENU:
-               {
-                       _interpret_main_menu(cmd);
-               }
+       switch (g_menu_state) {
+       case CURRENT_STATUS_MAINMENU:
+               _interpret_main_menu(cmd);
                break;
-               case CURRENT_STATUS_GET_MAX_VOLUME:
-               {
-                       static sound_type_e type;
-                       static int max;
-                       if(convert_sound_type(&type,cmd) == 1)
-                       {
-                               if(sound_manager_get_max_volume(type, &max) != 0)
-                                       g_print("failt to get max volume\n");
-                               else
-                                       g_print("the max volume of this type(%d) is %d\n", type, max);
-                       }
-                       reset_menu_state();
+       case CURRENT_STATUS_GET_MAX_VOLUME: {
+               static sound_type_e type;
+               static int max;
+               if (convert_sound_type(&type, cmd) == 1) {
+                       if (sound_manager_get_max_volume(type, &max) != 0)
+                               g_print("failt to get max volume\n");
+                       else
+                               g_print("the max volume of this type(%d) is %d\n", type, max);
                }
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_SET_VOLUME:
-               {
-                       static int cnt =0;
-                       static sound_type_e type;
-                       static int volume;
-                       switch(cnt)
-                       {
-                       case 0:
-                               if(convert_sound_type(&type,cmd) == 1)
-                               cnt ++;
-                               else
-                               reset_menu_state();
-                               break;
-                       case 1:
-                               volume = atoi(cmd);
-                               if(sound_manager_set_volume(type, volume) != 0)
-                                       g_print("fail to set volume(%d) check sound type(%d)'s available volume level\n", volume, type);
-                               else
-                                       g_print("set volume success : sound type(%d), volume(%d)\n",type, volume);
-                               cnt = 0;
+       }
+       case CURRENT_STATUS_SET_VOLUME: {
+               static int cnt = 0;
+               static sound_type_e type;
+               static int volume;
+               switch (cnt) {
+               case 0:
+                       if (convert_sound_type(&type, cmd) == 1)
+                               cnt++;
+                       else
                                reset_menu_state();
-                               break;
-                       default:
-                               break;
-                       }
-               }
-               break;
-               case CURRENT_STATUS_GET_VOLUME:
-               {
-                       static sound_type_e type;
-                       static int volume;
-                       if(convert_sound_type(&type,cmd) == 1)
-                       {
-                               if(sound_manager_get_volume(type, &volume) != 0)
-                                       g_print("fail to get volume\n");
-                               else
-                                       g_print("current volume of this type(%d) is : %d\n", type, volume);
-                       }
-                       reset_menu_state();
-               }
-               break;
-               case CURRENT_STATUS_SET_CURRENT_SOUND_TYPE:
-               {
-                       static sound_type_e type;
-                       if(convert_sound_type(&type,cmd) == 1)
-                       {
-                               if(sound_manager_set_current_sound_type(type) != 0)
-                                       g_print("fail to set sound type(%d)\n", type);
-                               else
-                                       g_print("success to set sound type(%d)\n", type);
-                       }
-                       reset_menu_state();
-               }
-               break;
-               case CURRENT_STATUS_GET_CURRENT_SOUND_TYPE:
-               {
-                       static sound_type_e type;
-                       if(sound_manager_get_current_sound_type(&type) !=0)
-                               g_print("fail to get current sound type\n");
+                       break;
+               case 1:
+                       volume = atoi(cmd);
+                       if (sound_manager_set_volume(type, volume) != 0)
+                               g_print("fail to set volume(%d) check sound type(%d)'s available volume level\n", volume, type);
                        else
-                               g_print("current sound type is (%d)\n", type);
+                               g_print("set volume success : sound type(%d), volume(%d)\n", type, volume);
+                       cnt = 0;
                        reset_menu_state();
+                       break;
+               default:
+                       break;
                }
                break;
-               case CURRENT_STATUS_UNSET_CURRENT_SOUND_TYPE:
-               {
-                       if(sound_manager_unset_current_sound_type() !=0)
-                               g_print("fail to unset current sound type\n");
+       }
+       case CURRENT_STATUS_GET_VOLUME: {
+               static sound_type_e type;
+               static int volume;
+               if (convert_sound_type(&type, cmd) == 1) {
+                       if (sound_manager_get_volume(type, &volume) != 0)
+                               g_print("fail to get volume\n");
                        else
-                               g_print("success to unset current sound type\n");
-                       reset_menu_state();
+                               g_print("current volume of this type(%d) is : %d\n", type, volume);
                }
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_SET_VOLUME_CHANGED_CB:
-               {
-                       if(sound_manager_set_volume_changed_cb(_set_volume_changed_cb, NULL) !=0)
-                               g_print("fail to set volume changed cb\n");
+       }
+       case CURRENT_STATUS_SET_CURRENT_SOUND_TYPE: {
+               static sound_type_e type;
+               if (convert_sound_type(&type, cmd) == 1) {
+                       if (sound_manager_set_current_sound_type(type) != 0)
+                               g_print("fail to set sound type(%d)\n", type);
                        else
-                               g_print("success to set volume changed cb\n");
-                       reset_menu_state();
+                               g_print("success to set sound type(%d)\n", type);
                }
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_UNSET_VOLUME_CHANGED_CB:
-               {
-                       if(sound_manager_unset_volume_changed_cb() !=0)
-                               g_print("fail to unset volume changed cb\n");
-                       else
-                               g_print("success to unset volume changed cb\n");
-                       reset_menu_state();
-               }
+       }
+       case CURRENT_STATUS_GET_CURRENT_SOUND_TYPE: {
+               static sound_type_e type;
+               if (sound_manager_get_current_sound_type(&type) != 0)
+                       g_print("fail to get current sound type\n");
+               else
+                       g_print("current sound type is (%d)\n", type);
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_SET_SESSION_TYPE:
-               {
-                       static sound_session_type_e type;
-                       if(convert_session_type(&type, cmd) == 1)
-                       {
-                               if(sound_manager_set_session_type(type) !=0)
-                                       g_print("fail to set session type\n");
-                               else
-                                       g_print("success to set session type(%d)\n",type);
-                       }
-                       reset_menu_state();
-               }
+       }
+       case CURRENT_STATUS_UNSET_CURRENT_SOUND_TYPE: {
+               if (sound_manager_unset_current_sound_type() != 0)
+                       g_print("fail to unset current sound type\n");
+               else
+                       g_print("success to unset current sound type\n");
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_GET_SESSION_TYPE:
-               {
-                       static sound_session_type_e type;
-                       if(sound_manager_get_session_type(&type) !=0)
-                               g_print("fail to get session type\n");
-                       else
-                               g_print("current session type is : %d (0:MEDIA, 1:ALARM, 2:NOTIFICATION, 3:EMERGENCY, 4:VOIP, 5:CALL)\n", type);
-
-                       reset_menu_state();
-               }
+       }
+       case CURRENT_STATUS_SET_VOLUME_CHANGED_CB: {
+               if (sound_manager_set_volume_changed_cb(_set_volume_changed_cb, NULL) != 0)
+                       g_print("fail to set volume changed cb\n");
+               else
+                       g_print("success to set volume changed cb\n");
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_SET_MEDIA_SESSION_OPTION:
-               {
-                       static sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
-                       static sound_session_option_for_starting_e option_s;
-                       static sound_session_option_for_during_play_e option_d;
-                       static int cnt = 0;
-                       if(sound_manager_set_session_type(type) !=0)
-                       {
-                               g_print("fail to set media session type\n");
-                               reset_menu_state();
-                       }       
-                       else
-                       {
-                               switch(cnt)
-                               {
-                                       case 0:
-                                               option_s = (sound_session_option_for_starting_e)atoi(cmd);
-                                               if(SOUND_SESSION_OPTION_MIX_WITH_OTHERS_WHEN_START > option_s || SOUND_SESSION_OPTION_PAUSE_OTHERS_WHEN_START < option_s)
-                                                       g_print("not supported option type\n");
-                                               else
-                                                       cnt ++;
-                                               break;
-                                       case 1:
-                                               option_d = (sound_session_option_for_during_play_e)atoi(cmd);
-                                               if(SOUND_SESSION_OPTION_INTERRUPTIBLE_DURING_PLAY > option_d || SOUND_SESSION_OPTION_UNINTERRUPTIBLE_DURING_PLAY < option_d)
-                                                       g_print("not supported option type\n");
-                                               else
-                                               {
-                                                       if(sound_manager_set_media_session_option(option_s, option_d) != 0)
-                                                               g_print("fail to set media session option\n");
-                                                       else
-                                                               g_print("success to set media session option\n");
-                                                       cnt = 0;
-                                               }
-                                               reset_menu_state();
-                                               break;
-                                       default:
-                                               break;
-                               }
-                       }
-               }
+       }
+       case CURRENT_STATUS_UNSET_VOLUME_CHANGED_CB: {
+               if (sound_manager_unset_volume_changed_cb() != 0)
+                       g_print("fail to unset volume changed cb\n");
+               else
+                       g_print("success to unset volume changed cb\n");
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_GET_MEDIA_SESSION_OPTION:
-               {
-                       static sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
-                       static sound_session_option_for_starting_e option_s;
-                       static sound_session_option_for_during_play_e option_d;
-                       if(sound_manager_set_session_type(type) != 0)
-                               g_print("fail to set media session type\n");
+       }
+       case CURRENT_STATUS_SET_SESSION_TYPE: {
+               static sound_session_type_e type;
+               if (convert_session_type(&type, cmd) == 1) {
+                       if (sound_manager_set_session_type(type) != 0)
+                               g_print("fail to set session type\n");
                        else
-                       {
-                               if(sound_manager_get_media_session_option(&option_s,&option_d) !=0)
-                                       g_print("fail to get media session option\n");
-                               else
-                                       g_print("current media session options are (%d) for starting, (%d) for ongoing\n", option_s, option_d);
-                       }
-                       reset_menu_state();
+                               g_print("success to set session type(%d)\n", type);
                }
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_SET_MEDIA_SESSION_RESUMPTION_OPTION:
-               {
-                       static sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
-                       static sound_session_option_for_resumption_e option_r;
-                       if(sound_manager_set_session_type(type) != 0)
-                               g_print("fail to set media session type\n");
-                       else
-                       {
-                               option_r = (sound_session_option_for_resumption_e)atoi(cmd);
-                               if(SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM > option_r || SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM_OR_MEDIA_PAUSED < option_r)
+       }
+       case CURRENT_STATUS_GET_SESSION_TYPE: {
+               static sound_session_type_e type;
+               if (sound_manager_get_session_type(&type) != 0)
+                       g_print("fail to get session type\n");
+               else
+                       g_print("current session type is : %d (0:MEDIA, 1:ALARM, 2:NOTIFICATION, 3:EMERGENCY, 4:VOIP, 5:CALL)\n", type);
+               reset_menu_state();
+               break;
+       }
+       case CURRENT_STATUS_SET_MEDIA_SESSION_OPTION: {
+               static sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
+               static sound_session_option_for_starting_e option_s;
+               static sound_session_option_for_during_play_e option_d;
+               static int cnt = 0;
+               if (sound_manager_set_session_type(type) != 0) {
+                       g_print("fail to set media session type\n");
+                       reset_menu_state();
+               } else {
+                       switch (cnt) {
+                       case 0:
+                               option_s = (sound_session_option_for_starting_e)atoi(cmd);
+                               if (SOUND_SESSION_OPTION_MIX_WITH_OTHERS_WHEN_START > option_s || SOUND_SESSION_OPTION_PAUSE_OTHERS_WHEN_START < option_s)
                                        g_print("not supported option type\n");
                                else
-                               {
-                                       if(sound_manager_set_media_session_resumption_option(option_r) !=0)
-                                               g_print("fail to set media session resumption option\n");
+                                       cnt++;
+                               break;
+                       case 1:
+                               option_d = (sound_session_option_for_during_play_e)atoi(cmd);
+                               if (SOUND_SESSION_OPTION_INTERRUPTIBLE_DURING_PLAY > option_d || SOUND_SESSION_OPTION_UNINTERRUPTIBLE_DURING_PLAY < option_d)
+                                       g_print("not supported option type\n");
+                               else {
+                                       if (sound_manager_set_media_session_option(option_s, option_d) != 0)
+                                               g_print("fail to set media session option\n");
                                        else
-                                               g_print("succese to set media session resumption option\n");
+                                               g_print("success to set media session option\n");
+                                       cnt = 0;
                                }
-                       }       
-                       reset_menu_state();
+                               reset_menu_state();
+                               break;
+                       default:
+                               break;
+                       }
                }
                break;
-               case CURRENT_STATUS_GET_MEDIA_SESSION_RESUMPTION_OPTION:
-               {
-                       static sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
-                       static sound_session_option_for_resumption_e option_r;
-                       if(sound_manager_set_session_type(type) != 0)
-                               g_print("fail to set media session type\n");
+       }
+       case CURRENT_STATUS_GET_MEDIA_SESSION_OPTION: {
+               static sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
+               static sound_session_option_for_starting_e option_s;
+               static sound_session_option_for_during_play_e option_d;
+               if (sound_manager_set_session_type(type) != 0)
+                       g_print("fail to set media session type\n");
+               else {
+                       if (sound_manager_get_media_session_option(&option_s, &option_d) != 0)
+                               g_print("fail to get media session option\n");
                        else
-                       {
-                               if(sound_manager_get_media_session_resumption_option(&option_r) != 0)
-                                       g_print("fail to get media session resumption option\n");
-                               else
-                                       g_print("current media session resumption option is : %d\n", option_r);
-                       }
-                       reset_menu_state();
+                               g_print("current media session options are (%d) for starting, (%d) for ongoing\n", option_s, option_d);
                }
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_SET_VOIP_SESSION_MODE:
-               {
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       sound_session_voip_mode_e mode;
-                       mode = (sound_session_voip_mode_e)atoi(cmd);
-                       ret = sound_manager_set_voip_session_mode(mode);
-                       if (ret) {
-                               g_print("failed to set voip session mode(%d), ret[0x%x]\n", mode, ret);
-                       } else {
-                               g_print("success to set voip session mode\n");
+       }
+       case CURRENT_STATUS_SET_MEDIA_SESSION_RESUMPTION_OPTION: {
+               static sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
+               static sound_session_option_for_resumption_e option_r;
+               if (sound_manager_set_session_type(type) != 0)
+                       g_print("fail to set media session type\n");
+               else {
+                       option_r = (sound_session_option_for_resumption_e)atoi(cmd);
+                       if (SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM > option_r || SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM_OR_MEDIA_PAUSED < option_r)
+                               g_print("not supported option type\n");
+                       else {
+                               if (sound_manager_set_media_session_resumption_option(option_r) != 0)
+                                       g_print("fail to set media session resumption option\n");
+                               else
+                                       g_print("succese to set media session resumption option\n");
                        }
-                       reset_menu_state();
                }
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_GET_VOIP_SESSION_MODE:
-               {
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       sound_session_voip_mode_e mode;
-                       ret = sound_manager_get_voip_session_mode(&mode);
-                       if(ret)
-                               g_print("fail to get voip session mode, ret[0x%x]\n", ret);
+       }
+       case CURRENT_STATUS_GET_MEDIA_SESSION_RESUMPTION_OPTION: {
+               static sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
+               static sound_session_option_for_resumption_e option_r;
+               if (sound_manager_set_session_type(type) != 0)
+                       g_print("fail to set media session type\n");
+               else {
+                       if (sound_manager_get_media_session_resumption_option(&option_r) != 0)
+                               g_print("fail to get media session resumption option\n");
                        else
-                               g_print("success to get voip session mode, mode[%d]\n", mode);
-                       reset_menu_state();
+                               g_print("current media session resumption option is : %d\n", option_r);
                }
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_SET_SESSION_INTERRUPTED_CB:
-               {
-                       if(sound_manager_set_session_interrupted_cb(_set_session_interrupted_cb, NULL) != 0)
-                               g_print("fail to set interrupted changed cb\n");
-                       else
-                               g_print("success to set interrupted changed cb\n");
-                       reset_menu_state();
-               }
+       }
+       case CURRENT_STATUS_SET_VOIP_SESSION_MODE: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               sound_session_voip_mode_e mode;
+               mode = (sound_session_voip_mode_e)atoi(cmd);
+               ret = sound_manager_set_voip_session_mode(mode);
+               if (ret)
+                       g_print("failed to set voip session mode(%d), ret[0x%x]\n", mode, ret);
+               else
+                       g_print("success to set voip session mode\n");
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_UNSET_SESSION_INTERRUPTED_CB:
-               {
-                       if(sound_manager_unset_session_interrupted_cb() != 0)
-                               g_print("fail to unset interrupted changed cb\n");
-                       else
-                               g_print("success to unset interrupted changed cb\n");
-                       reset_menu_state();
-               }
+       }
+       case CURRENT_STATUS_GET_VOIP_SESSION_MODE: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               sound_session_voip_mode_e mode;
+               ret = sound_manager_get_voip_session_mode(&mode);
+               if (ret)
+                       g_print("fail to get voip session mode, ret[0x%x]\n", ret);
+               else
+                       g_print("success to get voip session mode, mode[%d]\n", mode);
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_SET_DEVICE_MASK:
-               {
-                       if (strncmp(cmd, "0", 1) == 0) {
-                               g_device_mask = SOUND_DEVICE_ALL_MASK;
-                               reset_menu_state();
-                       } else if (strncmp(cmd, "1", 1) == 0) {
-                               if (g_device_mask == SOUND_DEVICE_ALL_MASK)
-                                       g_device_mask = SOUND_DEVICE_TYPE_INTERNAL_MASK;
-                               else
-                                       g_device_mask |= SOUND_DEVICE_TYPE_INTERNAL_MASK;
-                               g_print("add TYPE_INTERNAL MASK\n");
-                       } else if (strncmp(cmd, "2", 1) == 0) {
-                               if (g_device_mask == SOUND_DEVICE_ALL_MASK)
-                                       g_device_mask = SOUND_DEVICE_TYPE_EXTERNAL_MASK;
-                               else
-                                       g_device_mask |= SOUND_DEVICE_TYPE_EXTERNAL_MASK;
-                               g_print("add TYPE_EXTERNAL MASK\n");
-                       } else if (strncmp(cmd, "3", 1) == 0) {
-                               if (g_device_mask == SOUND_DEVICE_ALL_MASK)
-                                       g_device_mask = SOUND_DEVICE_IO_DIRECTION_IN_MASK;
-                               else
-                                       g_device_mask |= SOUND_DEVICE_IO_DIRECTION_IN_MASK;
-                               g_print("add IO_DIRECTION_IN MASK\n");
-                       } else if (strncmp(cmd, "4", 1) == 0) {
-                               if (g_device_mask == SOUND_DEVICE_ALL_MASK)
-                                       g_device_mask = SOUND_DEVICE_IO_DIRECTION_OUT_MASK;
-                               else
-                                       g_device_mask |= SOUND_DEVICE_IO_DIRECTION_OUT_MASK;
-                               g_print("add IO_DIRECTION_OUT MASK\n");
-                       } else if (strncmp(cmd, "5", 1) == 0) {
-                               if (g_device_mask == SOUND_DEVICE_ALL_MASK)
-                                       g_device_mask = SOUND_DEVICE_IO_DIRECTION_BOTH_MASK;
-                               else
-                                       g_device_mask |= SOUND_DEVICE_IO_DIRECTION_BOTH_MASK;
-                               g_print("add IO_DIRECTION_BOTH MASK\n");
-                       } else if (strncmp(cmd, "6", 1) == 0) {
-                               if (g_device_mask == SOUND_DEVICE_ALL_MASK)
-                                       g_device_mask = SOUND_DEVICE_STATE_ACTIVATED_MASK;
-                               else
-                                       g_device_mask |= SOUND_DEVICE_STATE_ACTIVATED_MASK;
-                               g_print("add STATE_ACTIVATED MASK\n");
-                       } else if (strncmp(cmd, "7", 1) == 0) {
-                               if (g_device_mask == SOUND_DEVICE_ALL_MASK)
-                                       g_device_mask = SOUND_DEVICE_STATE_DEACTIVATED_MASK;
-                               else
-                                       g_device_mask |= SOUND_DEVICE_STATE_DEACTIVATED_MASK;
-                               g_print("add STATE_DEACTIVATED MASK\n");
-                       } else if (strncmp(cmd, "b", 1) == 0) {
-                               g_print("device mask[0x%x]\n", g_device_mask);
-                               reset_menu_state();
-                       } else {
-                               g_print("invalid selection, please select again..\n");
-                       }
-               }
+       }
+       case CURRENT_STATUS_SET_SESSION_INTERRUPTED_CB: {
+               if (sound_manager_set_session_interrupted_cb(_set_session_interrupted_cb, NULL) != 0)
+                       g_print("fail to set interrupted changed cb\n");
+               else
+                       g_print("success to set interrupted changed cb\n");
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_GET_DEVICE_MASK:
-               {
-                       g_print("current device mask[0x%x]\n", g_device_mask);
-                       reset_menu_state();
-               }
+       }
+       case CURRENT_STATUS_UNSET_SESSION_INTERRUPTED_CB: {
+               if (sound_manager_unset_session_interrupted_cb() != 0)
+                       g_print("fail to unset interrupted changed cb\n");
+               else
+                       g_print("success to unset interrupted changed cb\n");
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_GET_DEVICE_LIST:
-               {
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       if (!(ret = sound_manager_get_current_device_list(g_device_mask, &g_device_list)))
-                               g_print("success to get current device list\n");
+       }
+       case CURRENT_STATUS_SET_DEVICE_MASK: {
+               if (strncmp(cmd, "0", 1) == 0) {
+                               g_device_mask = SOUND_DEVICE_ALL_MASK;
+                               reset_menu_state();
+               } else if (strncmp(cmd, "1", 1) == 0) {
+                       if (g_device_mask == SOUND_DEVICE_ALL_MASK)
+                               g_device_mask = SOUND_DEVICE_TYPE_INTERNAL_MASK;
+                       else
+                               g_device_mask |= SOUND_DEVICE_TYPE_INTERNAL_MASK;
+                       g_print("add TYPE_INTERNAL MASK\n");
+               } else if (strncmp(cmd, "2", 1) == 0) {
+                       if (g_device_mask == SOUND_DEVICE_ALL_MASK)
+                               g_device_mask = SOUND_DEVICE_TYPE_EXTERNAL_MASK;
                        else
-                               g_print("fail to get current device list, ret[0x%x]\n", ret);
+                               g_device_mask |= SOUND_DEVICE_TYPE_EXTERNAL_MASK;
+                       g_print("add TYPE_EXTERNAL MASK\n");
+               } else if (strncmp(cmd, "3", 1) == 0) {
+                       if (g_device_mask == SOUND_DEVICE_ALL_MASK)
+                               g_device_mask = SOUND_DEVICE_IO_DIRECTION_IN_MASK;
+                       else
+                               g_device_mask |= SOUND_DEVICE_IO_DIRECTION_IN_MASK;
+                       g_print("add IO_DIRECTION_IN MASK\n");
+               } else if (strncmp(cmd, "4", 1) == 0) {
+                       if (g_device_mask == SOUND_DEVICE_ALL_MASK)
+                               g_device_mask = SOUND_DEVICE_IO_DIRECTION_OUT_MASK;
+                       else
+                               g_device_mask |= SOUND_DEVICE_IO_DIRECTION_OUT_MASK;
+                       g_print("add IO_DIRECTION_OUT MASK\n");
+               } else if (strncmp(cmd, "5", 1) == 0) {
+                       if (g_device_mask == SOUND_DEVICE_ALL_MASK)
+                               g_device_mask = SOUND_DEVICE_IO_DIRECTION_BOTH_MASK;
+                       else
+                               g_device_mask |= SOUND_DEVICE_IO_DIRECTION_BOTH_MASK;
+                       g_print("add IO_DIRECTION_BOTH MASK\n");
+               } else if (strncmp(cmd, "6", 1) == 0) {
+                       if (g_device_mask == SOUND_DEVICE_ALL_MASK)
+                               g_device_mask = SOUND_DEVICE_STATE_ACTIVATED_MASK;
+                       else
+                               g_device_mask |= SOUND_DEVICE_STATE_ACTIVATED_MASK;
+                       g_print("add STATE_ACTIVATED MASK\n");
+               } else if (strncmp(cmd, "7", 1) == 0) {
+                       if (g_device_mask == SOUND_DEVICE_ALL_MASK)
+                               g_device_mask = SOUND_DEVICE_STATE_DEACTIVATED_MASK;
+                       else
+                               g_device_mask |= SOUND_DEVICE_STATE_DEACTIVATED_MASK;
+                       g_print("add STATE_DEACTIVATED MASK\n");
+               } else if (strncmp(cmd, "b", 1) == 0) {
+                       g_print("device mask[0x%x]\n", g_device_mask);
                        reset_menu_state();
+               } else {
+                       g_print("invalid selection, please select again..\n");
                }
                break;
-               case CURRENT_STATUS_GET_DEVICE_NEXT:
-               {
-                       sound_device_h device;
-                       sound_device_type_e type;
-                       sound_device_io_direction_e io_direction;
-                       sound_device_state_e state;
-                       int id;
-                       char *name;
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       if (!(ret = sound_manager_get_next_device(g_device_list, &device))) {
-                               g_print("success to get next device\n");
-                               if ((ret = sound_manager_get_device_type (device, &type)))
-                                       g_print("failed to get device type, ret[0x%x]\n", ret);
-                               if ((ret = sound_manager_get_device_io_direction (device, &io_direction)))
-                                       g_print("failed to get device io direction, ret[0x%x]\n", ret);
-                               if ((ret = sound_manager_get_device_id (device, &id)))
-                                       g_print("failed to get device id, ret[0x%x]\n", ret);
-                               if ((ret = sound_manager_get_device_name (device, &name)))
-                                       g_print("failed to get device name, ret[0x%x]\n", ret);
-                               if ((ret = sound_manager_get_device_state (device, &state)))
-                                       g_print("failed to get device state, ret[0x%x]\n", ret);
-                               if (!ret)
-                                       g_print("-- NEXT device type[%d], io_direction[%d], id[%d], name[%s], state[%d]\n", type, io_direction, id, name, state);
-                       } else {
-                               g_print("failed to get next device, ret[0x%x]\n", ret);
-                       }
-                       reset_menu_state();
-               }
+       }
+       case CURRENT_STATUS_GET_DEVICE_MASK: {
+               g_print("current device mask[0x%x]\n", g_device_mask);
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_GET_DEVICE_PREV:
-               {
-                       sound_device_h device;
-                       sound_device_type_e type;
-                       sound_device_io_direction_e io_direction;
-                       sound_device_state_e state;
-                       int id;
-                       char *name;
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       if (!(ret = sound_manager_get_prev_device(g_device_list, &device))) {
-                               g_print("success to get previous device\n");
-                               if ((ret = sound_manager_get_device_type (device, &type)))
-                                       g_print("failed to get device type, ret[0x%x]\n", ret);
-                               if ((ret = sound_manager_get_device_io_direction (device, &io_direction)))
-                                       g_print("failed to get device io direction, ret[0x%x]\n", ret);
-                               if ((ret = sound_manager_get_device_id (device, &id)))
-                                       g_print("failed to get device id, ret[0x%x]\n", ret);
-                               if ((ret = sound_manager_get_device_name (device, &name)))
-                                       g_print("failed to get device name, ret[0x%x]\n", ret);
-                               if ((ret = sound_manager_get_device_state (device, &state)))
-                                       g_print("failed to get device state, ret[0x%x]\n", ret);
-                               if (!ret)
-                                       g_print("-- PREV device type[%d], io_direction[%d], id[%d], name[%s], state[%d]\n", type, io_direction, id, name, state);
-                       } else {
-                               g_print("failed to get previous device, ret[0x%x]\n", ret);
-                       }
-                       reset_menu_state();
-               }
+       }
+       case CURRENT_STATUS_GET_DEVICE_LIST: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               if (!(ret = sound_manager_get_current_device_list(g_device_mask, &g_device_list)))
+                       g_print("success to get current device list\n");
+               else
+                       g_print("fail to get current device list, ret[0x%x]\n", ret);
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_SET_DEVICE_CONNECTED_CB:
-               {
-                       if (sound_manager_set_device_connected_cb(g_device_mask, _set_device_connected_cb, NULL))
-                               g_print("fail to set device connected cb\n");
-                       else
-                               g_print("success to set device connected cb\n");
-                       reset_menu_state();
-               }
+       }
+       case CURRENT_STATUS_GET_DEVICE_NEXT: {
+               sound_device_h device;
+               sound_device_type_e type;
+               sound_device_io_direction_e io_direction;
+               sound_device_state_e state;
+               int id;
+               char *name;
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               if (!(ret = sound_manager_get_next_device(g_device_list, &device))) {
+                       g_print("success to get next device\n");
+                       if ((ret = sound_manager_get_device_type(device, &type)))
+                               g_print("failed to get device type, ret[0x%x]\n", ret);
+                       if ((ret = sound_manager_get_device_io_direction(device, &io_direction)))
+                               g_print("failed to get device io direction, ret[0x%x]\n", ret);
+                       if ((ret = sound_manager_get_device_id(device, &id)))
+                               g_print("failed to get device id, ret[0x%x]\n", ret);
+                       if ((ret = sound_manager_get_device_name(device, &name)))
+                               g_print("failed to get device name, ret[0x%x]\n", ret);
+                       if ((ret = sound_manager_get_device_state(device, &state)))
+                               g_print("failed to get device state, ret[0x%x]\n", ret);
+                       if (!ret)
+                               g_print("-- NEXT device type[%d], io_direction[%d], id[%d], name[%s], state[%d]\n", type, io_direction, id, name, state);
+               } else {
+                       g_print("failed to get next device, ret[0x%x]\n", ret);
+               }
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_UNSET_DEVICE_CONNECTED_CB:
-               {
-                       if (sound_manager_unset_device_connected_cb())
-                               g_print("fail to unset device connected cb\n");
-                       else
-                               g_print("success to unset device connected cb\n");
-                       reset_menu_state();
-               }
+       }
+       case CURRENT_STATUS_GET_DEVICE_PREV: {
+               sound_device_h device;
+               sound_device_type_e type;
+               sound_device_io_direction_e io_direction;
+               sound_device_state_e state;
+               int id;
+               char *name;
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               if (!(ret = sound_manager_get_prev_device(g_device_list, &device))) {
+                       g_print("success to get previous device\n");
+                       if ((ret = sound_manager_get_device_type(device, &type)))
+                               g_print("failed to get device type, ret[0x%x]\n", ret);
+                       if ((ret = sound_manager_get_device_io_direction(device, &io_direction)))
+                               g_print("failed to get device io direction, ret[0x%x]\n", ret);
+                       if ((ret = sound_manager_get_device_id(device, &id)))
+                               g_print("failed to get device id, ret[0x%x]\n", ret);
+                       if ((ret = sound_manager_get_device_name(device, &name)))
+                               g_print("failed to get device name, ret[0x%x]\n", ret);
+                       if ((ret = sound_manager_get_device_state(device, &state)))
+                               g_print("failed to get device state, ret[0x%x]\n", ret);
+                       if (!ret)
+                               g_print("-- PREV device type[%d], io_direction[%d], id[%d], name[%s], state[%d]\n", type, io_direction, id, name, state);
+               } else {
+                       g_print("failed to get previous device, ret[0x%x]\n", ret);
+               }
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_SET_DEVICE_INFO_CHANGED_CB:
-               {
-                       if (sound_manager_set_device_information_changed_cb(g_device_mask, _set_device_info_changed_cb, NULL))
-                               g_print("fail to set device information changed cb\n");
-                       else
-                               g_print("success to set device information changed cb\n");
-                       reset_menu_state();
-               }
+       }
+       case CURRENT_STATUS_SET_DEVICE_CONNECTED_CB: {
+               if (sound_manager_set_device_connected_cb(g_device_mask, _set_device_connected_cb, NULL))
+                       g_print("fail to set device connected cb\n");
+               else
+                       g_print("success to set device connected cb\n");
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_UNSET_DEVICE_INFO_CHANGED_CB:
-               {
-                       if (sound_manager_unset_device_information_changed_cb())
-                               g_print("fail to unset device information changed cb\n");
-                       else
-                               g_print("success to unset device information changed cb\n");
-                       reset_menu_state();
-               }
+       }
+       case CURRENT_STATUS_UNSET_DEVICE_CONNECTED_CB: {
+               if (sound_manager_unset_device_connected_cb())
+                       g_print("fail to unset device connected cb\n");
+               else
+                       g_print("success to unset device connected cb\n");
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_CREATE_STREAM_INFO:
-               {
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       int stream_type = 0;
-                       sound_stream_type_e type = SOUND_STREAM_TYPE_MEDIA;
-                       if (g_stream_info_h) {
-                               g_print("fail to create stream information, g_stream_info_h(%p) is already set\n", g_stream_info_h);
-                               reset_menu_state();
-                               break;
-                       }
-                       stream_type = atoi(cmd);
-                       switch(stream_type) {
-                       case 0: /* media */
-                               type = SOUND_STREAM_TYPE_MEDIA;
-                               break;
-                       case 1: /* alarm */
-                               type = SOUND_STREAM_TYPE_ALARM;
-                               break;
-                       case 2: /* notification */
-                               type = SOUND_STREAM_TYPE_NOTIFICATION;
-                               break;
-                       case 3: /* ringtone for call*/
-                               type = SOUND_STREAM_TYPE_RINGTONE_CALL;
-                               break;
-                       case 4: /* voice call */
-                               type = SOUND_STREAM_TYPE_VOICE_CALL;
-                               break;
-                       case 5: /* voip */
-                               type = SOUND_STREAM_TYPE_VOIP;
-                               break;
-                       case 6: /* media only for external devices */
-                               type = SOUND_STREAM_TYPE_MEDIA_EXTERNAL_ONLY;
-                               break;
-                       default:
-                               type = SOUND_STREAM_TYPE_MEDIA;
-                               break;
-                       }
-                       if (type == (int)SOUND_STREAM_TYPE_RINGTONE_CALL || type == (int)SOUND_STREAM_TYPE_VOICE_CALL) {
-                               ret = sound_manager_create_stream_information_internal(type, focus_callback, NULL, &g_stream_info_h);
-                       } else {
-                               ret = sound_manager_create_stream_information(type, focus_callback, NULL, &g_stream_info_h);
-                       }
-                       if (ret) {
-                               g_print("fail to sound_manager_create_stream_information(), ret(0x%x)\n", ret);
-                       }
+       }
+       case CURRENT_STATUS_SET_DEVICE_INFO_CHANGED_CB: {
+               if (sound_manager_set_device_information_changed_cb(g_device_mask, _set_device_info_changed_cb, NULL))
+                       g_print("fail to set device information changed cb\n");
+               else
+                       g_print("success to set device information changed cb\n");
+               reset_menu_state();
+               break;
+       }
+       case CURRENT_STATUS_UNSET_DEVICE_INFO_CHANGED_CB: {
+               if (sound_manager_unset_device_information_changed_cb())
+                       g_print("fail to unset device information changed cb\n");
+               else
+                       g_print("success to unset device information changed cb\n");
+               reset_menu_state();
+               break;
+       }
+       case CURRENT_STATUS_CREATE_STREAM_INFO: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               int stream_type = 0;
+               sound_stream_type_e type = SOUND_STREAM_TYPE_MEDIA;
+               if (g_stream_info_h) {
+                       g_print("fail to create stream information, g_stream_info_h(%p) is already set\n", g_stream_info_h);
                        reset_menu_state();
-               }
+                       break;
+               }
+               stream_type = atoi(cmd);
+               switch (stream_type) {
+               case 0: /* media */
+                       type = SOUND_STREAM_TYPE_MEDIA;
+                       break;
+               case 1: /* alarm */
+                       type = SOUND_STREAM_TYPE_ALARM;
+                       break;
+               case 2: /* notification */
+                       type = SOUND_STREAM_TYPE_NOTIFICATION;
+                       break;
+               case 3: /* ringtone for call*/
+                       type = SOUND_STREAM_TYPE_RINGTONE_CALL;
+                       break;
+               case 4: /* voice call */
+                       type = SOUND_STREAM_TYPE_VOICE_CALL;
+                       break;
+               case 5: /* voip */
+                       type = SOUND_STREAM_TYPE_VOIP;
+                       break;
+               case 6: /* media only for external devices */
+                       type = SOUND_STREAM_TYPE_MEDIA_EXTERNAL_ONLY;
+                       break;
+               default:
+                       type = SOUND_STREAM_TYPE_MEDIA;
+                       break;
+               }
+               if (type == (int)SOUND_STREAM_TYPE_RINGTONE_CALL || type == (int)SOUND_STREAM_TYPE_VOICE_CALL)
+                       ret = sound_manager_create_stream_information_internal(type, focus_callback, NULL, &g_stream_info_h);
+               else
+                       ret = sound_manager_create_stream_information(type, focus_callback, NULL, &g_stream_info_h);
+
+               if (ret)
+                       g_print("fail to sound_manager_create_stream_information(), ret(0x%x)\n", ret);
+
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_ADD_DEVICE_FOR_STREAM_ROUTING:
-               {
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       int device_type = 0;
-                       sound_device_h device = NULL;
-                       sound_device_type_e selected_type = SOUND_DEVICE_BUILTIN_SPEAKER;
-                       sound_device_type_e type = SOUND_DEVICE_BUILTIN_SPEAKER;
-                       bool need_to_go = false;
-                       device_type = atoi(cmd);
-                       switch(device_type) {
-                       case 0: /* built-in mic */
-                               selected_type = SOUND_DEVICE_BUILTIN_MIC;
-                               break;
-                       case 1: /* built-in spk */
-                               selected_type = SOUND_DEVICE_BUILTIN_SPEAKER;
-                               break;
-                       case 2: /* built-in rcv */
-                               selected_type = SOUND_DEVICE_BUILTIN_RECEIVER;
-                               break;
-                       case 3: /* audio-jack */
-                               selected_type = SOUND_DEVICE_AUDIO_JACK;
-                               break;
-                       case 4: /* bt */
-                               selected_type = SOUND_DEVICE_BLUETOOTH;
-                               break;
-                       default:
-                               g_print("invalid argument, device_type(%d) is not valid for this feature\n", device_type);
-                               reset_menu_state();
-                               break;
-                       }
-                       if (!(ret = sound_manager_get_current_device_list(SOUND_DEVICE_ALL_MASK, &g_device_list))) {
-                               g_print("success to get current device list\n");
-                               while (!sound_manager_get_next_device(g_device_list, &device)) {
-                                       if (!(ret = sound_manager_get_device_type (device, &type))) {
-                                               if (selected_type == type) {
-                                                       need_to_go = true;
-                                                       break;
-                                               }
-                                       } else {
-                                               g_print("fail to get type of device, ret(0x%x)\n", ret);
-                                               reset_menu_state();
+       }
+       case CURRENT_STATUS_ADD_DEVICE_FOR_STREAM_ROUTING: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               int device_type = 0;
+               sound_device_h device = NULL;
+               sound_device_type_e selected_type = SOUND_DEVICE_BUILTIN_SPEAKER;
+               sound_device_type_e type = SOUND_DEVICE_BUILTIN_SPEAKER;
+               bool need_to_go = false;
+
+               device_type = atoi(cmd);
+               switch (device_type) {
+               case 0: /* built-in mic */
+                       selected_type = SOUND_DEVICE_BUILTIN_MIC;
+                       break;
+               case 1: /* built-in spk */
+                       selected_type = SOUND_DEVICE_BUILTIN_SPEAKER;
+                       break;
+               case 2: /* built-in rcv */
+                       selected_type = SOUND_DEVICE_BUILTIN_RECEIVER;
+                       break;
+               case 3: /* audio-jack */
+                       selected_type = SOUND_DEVICE_AUDIO_JACK;
+                       break;
+               case 4: /* bt */
+                       selected_type = SOUND_DEVICE_BLUETOOTH;
+                       break;
+               default:
+                       g_print("invalid argument, device_type(%d) is not valid for this feature\n", device_type);
+                       reset_menu_state();
+                       break;
+               }
+               if (!(ret = sound_manager_get_current_device_list(SOUND_DEVICE_ALL_MASK, &g_device_list))) {
+                       g_print("success to get current device list\n");
+                       while (!sound_manager_get_next_device(g_device_list, &device)) {
+                               if (!(ret = sound_manager_get_device_type(device, &type))) {
+                                       if (selected_type == type) {
+                                               need_to_go = true;
                                                break;
                                        }
-                               }
-                               if (need_to_go) {
-                                       ret = sound_manager_add_device_for_stream_routing (g_stream_info_h, device);
-                                       if (ret) {
-                                               g_print("failed to sound_manager_add_device_for_stream_routing(), ret(0x%x)\n", ret);
-                                       }
                                } else {
-                                       g_print("the device is not available now\n");
+                                       g_print("fail to get type of device, ret(0x%x)\n", ret);
+                                       reset_menu_state();
+                                       break;
                                }
-                               reset_menu_state();
-                       } else {
-                               g_print("fail to get current device list, ret(0x%x)\n", ret);
-                               reset_menu_state();
                        }
+                       if (need_to_go) {
+                               ret = sound_manager_add_device_for_stream_routing(g_stream_info_h, device);
+                               if (ret)
+                                       g_print("failed to sound_manager_add_device_for_stream_routing(), ret(0x%x)\n", ret);
+                       } else
+                               g_print("the device is not available now\n");
+                       reset_menu_state();
+               } else {
+                       g_print("fail to get current device list, ret(0x%x)\n", ret);
+                       reset_menu_state();
                }
                break;
-               case CURRENT_STATUS_REMOVE_DEVICE_FOR_STREAM_ROUTING:
-               {
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       int device_type = 0;
-                       sound_device_h device = NULL;
-                       sound_device_type_e selected_type = SOUND_DEVICE_BUILTIN_SPEAKER;
-                       sound_device_type_e type = SOUND_DEVICE_BUILTIN_SPEAKER;
-                       bool need_to_go = false;
-                       device_type = atoi(cmd);
-                       switch(device_type) {
-                       case 0: /* built-in mic */
-                               selected_type = SOUND_DEVICE_BUILTIN_MIC;
-                               break;
-                       case 1: /* built-in spk */
-                               selected_type = SOUND_DEVICE_BUILTIN_SPEAKER;
-                               break;
-                       case 2: /* built-in rcv */
-                               selected_type = SOUND_DEVICE_BUILTIN_RECEIVER;
-                               break;
-                       case 3: /* audio-jack */
-                               selected_type = SOUND_DEVICE_AUDIO_JACK;
-                               break;
-                       case 4: /* bt */
-                               selected_type = SOUND_DEVICE_BLUETOOTH;
-                               break;
-                       default:
-                               g_print("invalid argument, device_type(%d) is not valid for this feature\n", device_type);
-                               reset_menu_state();
-                               break;
-                       }
-                       if (!(ret = sound_manager_get_current_device_list(SOUND_DEVICE_ALL_MASK, &g_device_list))) {
-                               g_print("success to get current device list\n");
-                               while (!sound_manager_get_next_device(g_device_list, &device)) {
-                                       if (!(ret = sound_manager_get_device_type (device, &type))) {
-                                               if (selected_type == type) {
-                                                       need_to_go = true;
-                                                       break;
-                                               }
-                                       } else {
-                                               g_print("fail to get type of device, ret(0x%x)\n", ret);
-                                               reset_menu_state();
+       }
+       case CURRENT_STATUS_REMOVE_DEVICE_FOR_STREAM_ROUTING: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               int device_type = 0;
+               sound_device_h device = NULL;
+               sound_device_type_e selected_type = SOUND_DEVICE_BUILTIN_SPEAKER;
+               sound_device_type_e type = SOUND_DEVICE_BUILTIN_SPEAKER;
+               bool need_to_go = false;
+
+               device_type = atoi(cmd);
+               switch (device_type) {
+               case 0: /* built-in mic */
+                       selected_type = SOUND_DEVICE_BUILTIN_MIC;
+                       break;
+               case 1: /* built-in spk */
+                       selected_type = SOUND_DEVICE_BUILTIN_SPEAKER;
+                       break;
+               case 2: /* built-in rcv */
+                       selected_type = SOUND_DEVICE_BUILTIN_RECEIVER;
+                       break;
+               case 3: /* audio-jack */
+                       selected_type = SOUND_DEVICE_AUDIO_JACK;
+                       break;
+               case 4: /* bt */
+                       selected_type = SOUND_DEVICE_BLUETOOTH;
+                       break;
+               default:
+                       g_print("invalid argument, device_type(%d) is not valid for this feature\n", device_type);
+                       reset_menu_state();
+                       break;
+               }
+               if (!(ret = sound_manager_get_current_device_list(SOUND_DEVICE_ALL_MASK, &g_device_list))) {
+                       g_print("success to get current device list\n");
+                       while (!sound_manager_get_next_device(g_device_list, &device)) {
+                               if (!(ret = sound_manager_get_device_type(device, &type))) {
+                                       if (selected_type == type) {
+                                               need_to_go = true;
                                                break;
                                        }
-                               }
-                               if (need_to_go) {
-                                       ret = sound_manager_remove_device_for_stream_routing (g_stream_info_h, device);
-                                       if (ret) {
-                                               g_print("failed to sound_manager_remove_device_for_stream_routing(), ret(0x%x)\n", ret);
-                                       }
                                } else {
-                                       g_print("the device is not available now\n");
+                                       g_print("fail to get type of device, ret(0x%x)\n", ret);
+                                       reset_menu_state();
+                                       break;
                                }
+                       }
+                       if (need_to_go) {
+                               ret = sound_manager_remove_device_for_stream_routing(g_stream_info_h, device);
+                               if (ret)
+                                       g_print("failed to sound_manager_remove_device_for_stream_routing(), ret(0x%x)\n", ret);
+                               else
+                                       g_print("the device is not available now\n");
                                reset_menu_state();
                        } else {
                                g_print("fail to get current device list, ret(0x%x)\n", ret);
@@ -1326,261 +1078,250 @@ static void interpret (char *cmd)
                        }
                }
                break;
-               case CURRENT_STATUS_APPLY_STREAM_ROUTING:
-               {
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       ret = sound_manager_apply_stream_routing (g_stream_info_h);
-                       if (ret) {
-                               g_print("failed to sound_manager_apply_stream_routing(), ret(0x%x)\n", ret);
-                       }
-                       reset_menu_state();
-               }
+       }
+       case CURRENT_STATUS_APPLY_STREAM_ROUTING: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               ret = sound_manager_apply_stream_routing(g_stream_info_h);
+               if (ret)
+                       g_print("failed to sound_manager_apply_stream_routing(), ret(0x%x)\n", ret);
+
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_SET_STREAM_ROUTING_OPTION:
-               {
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       int selection = 0;
-                       char *name = NULL;
-                       int value = -1;
-                       selection = atoi(cmd);
-                       switch(selection) {
-                       case 0:
-                               name = "option_1";
-                               value = 0;
-                               break;
-                       case 1:
-                               name = "option_1";
-                               value = 1;
-                               break;
-                       case 2:
-                               name = "option_2";
-                               value = 0;
-                               break;
-                       case 3:
-                               name = "option_2";
-                               value = 1;
-                               break;
-                       default:
-                               g_print("invalid argument, try again..\n");
-                               reset_menu_state();
-                               break;
-                       }
-                       ret = sound_manager_set_stream_routing_option (g_stream_info_h, name, value);
-                       if (ret) {
-                               g_print("failed to sound_manager_set_stream_routing_option(), ret(0x%x)\n", ret);
-                       }
+       }
+       case CURRENT_STATUS_SET_STREAM_ROUTING_OPTION: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               int selection = 0;
+               char *name = NULL;
+               int value = -1;
+
+               selection = atoi(cmd);
+               switch (selection) {
+               case 0:
+                       name = "option_1";
+                       value = 0;
+                       break;
+               case 1:
+                       name = "option_1";
+                       value = 1;
+                       break;
+               case 2:
+                       name = "option_2";
+                       value = 0;
+                       break;
+               case 3:
+                       name = "option_2";
+                       value = 1;
+                       break;
+               default:
+                       g_print("invalid argument, try again..\n");
                        reset_menu_state();
+                       break;
                }
+               ret = sound_manager_set_stream_routing_option(g_stream_info_h, name, value);
+               if (ret)
+                       g_print("failed to sound_manager_set_stream_routing_option(), ret(0x%x)\n", ret);
+
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_ACQUIRE_FOCUS:
-               {
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       int focus_type = 0;
-                       sound_stream_focus_mask_e focus_mask;
-                       focus_type = atoi(cmd);
-                       switch(focus_type) {
-                       case 0: /* playback */
-                               focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK;
-                               break;
-                       case 1: /* recording */
-                               focus_mask = SOUND_STREAM_FOCUS_FOR_RECORDING;
-                               break;
-                       case 2: /* all */
-                               focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK | SOUND_STREAM_FOCUS_FOR_RECORDING;
-                               break;
-                       default:
-                               focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK;
-                               break;
-                       }
-                       ret = sound_manager_acquire_focus(g_stream_info_h, focus_mask, NULL);
-                       if (ret) {
-                               g_print("fail to sound_manager_acquire_focus(), ret(0x%x)\n", ret);
-                       }
-                       reset_menu_state();
-               }
+       }
+       case CURRENT_STATUS_ACQUIRE_FOCUS: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               int focus_type = 0;
+               sound_stream_focus_mask_e focus_mask;
+
+               focus_type = atoi(cmd);
+               switch (focus_type) {
+               case 0: /* playback */
+                       focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK;
+                       break;
+               case 1: /* recording */
+                       focus_mask = SOUND_STREAM_FOCUS_FOR_RECORDING;
+                       break;
+               case 2: /* all */
+                       focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK | SOUND_STREAM_FOCUS_FOR_RECORDING;
+                       break;
+               default:
+                       focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK;
+                       break;
+               }
+               ret = sound_manager_acquire_focus(g_stream_info_h, focus_mask, NULL);
+               if (ret)
+                       g_print("fail to sound_manager_acquire_focus(), ret(0x%x)\n", ret);
+
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_RELEASE_FOCUS:
-               {
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       int focus_type = 0;
-                       sound_stream_focus_mask_e focus_mask;
-                       focus_type = atoi(cmd);
-                       switch(focus_type) {
-                       case 0: /* playback */
-                               focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK;
-                               break;
-                       case 1: /* recording */
-                               focus_mask = SOUND_STREAM_FOCUS_FOR_RECORDING;
-                               break;
-                       case 2: /* both */
-                               focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK | SOUND_STREAM_FOCUS_FOR_RECORDING;
-                               break;
-                       default:
-                               focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK;
-                               break;
-                       }
-                       ret = sound_manager_release_focus(g_stream_info_h, focus_mask, NULL);
-                       if (ret) {
+       }
+       case CURRENT_STATUS_RELEASE_FOCUS: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               int focus_type = 0;
+               sound_stream_focus_mask_e focus_mask;
+
+               focus_type = atoi(cmd);
+               switch (focus_type) {
+               case 0: /* playback */
+                       focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK;
+                       break;
+               case 1: /* recording */
+                       focus_mask = SOUND_STREAM_FOCUS_FOR_RECORDING;
+                       break;
+               case 2: /* both */
+                       focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK | SOUND_STREAM_FOCUS_FOR_RECORDING;
+                       break;
+               default:
+                       focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK;
+                       break;
+               }
+               ret = sound_manager_release_focus(g_stream_info_h, focus_mask, NULL);
+               if (ret)
                                g_print("fail to sound_manager_acquire_focus(), ret(0x%x)\n", ret);
-                       }
-                       reset_menu_state();
-               }
+
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_GET_ACQUIRED_FOCUS:
-               {
-                       sound_stream_focus_state_e for_playback;
-                       sound_stream_focus_state_e for_recording;
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       if(g_stream_info_h) {
-                               ret = sound_manager_get_focus_state(g_stream_info_h, &for_playback, &for_recording);
-                               if (ret) {
-                                       g_print("fail to sound_manager_get_focus_state(), ret(0x%x)\n", ret);
-                               } else {
-                                       g_print("focus_state(playback:%d, capture:%d)\n", for_playback, for_recording);
-                               }
-                       } else {
-                               g_print("please create stream info. first\n");
-                       }
-                       reset_menu_state();
-               }
+       }
+       case CURRENT_STATUS_GET_ACQUIRED_FOCUS: {
+               sound_stream_focus_state_e for_playback;
+               sound_stream_focus_state_e for_recording;
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               if (g_stream_info_h) {
+                       ret = sound_manager_get_focus_state(g_stream_info_h, &for_playback, &for_recording);
+                       if (ret)
+                               g_print("fail to sound_manager_get_focus_state(), ret(0x%x)\n", ret);
+                       else
+                               g_print("focus_state(playback:%d, capture:%d)\n", for_playback, for_recording);
+
+               } else
+                       g_print("please create stream info. first\n");
+
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_DESTROY_STREAM_INFO:
-               {
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       ret = sound_manager_destroy_stream_information(g_stream_info_h);
-                       if (ret) {
-                               g_print("fail to sound_manager_destroy_stream_information(), ret(0x%x)\n", ret);
-                       } else {
-                               g_stream_info_h = NULL;
-                       }
-                       reset_menu_state();
-               }
+       }
+       case CURRENT_STATUS_DESTROY_STREAM_INFO: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               ret = sound_manager_destroy_stream_information(g_stream_info_h);
+               if (ret)
+                       g_print("fail to sound_manager_destroy_stream_information(), ret(0x%x)\n", ret);
+               else
+                       g_stream_info_h = NULL;
+
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_SET_FOCUS_WATCH_CB:
-               {
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       int focus_type = 0;
-                       sound_stream_focus_mask_e focus_mask;
-                       focus_type = atoi(cmd);
-                       switch(focus_type) {
-                       case 0: /* playback */
-                               focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK;
-                               break;
-                       case 1: /* recording */
-                               focus_mask = SOUND_STREAM_FOCUS_FOR_RECORDING;
-                               break;
-                       case 2: /* both */
-                               focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK | SOUND_STREAM_FOCUS_FOR_RECORDING;
-                               break;
-                       default:
-                               focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK;
-                               break;
-                       }
-                       ret = sound_manager_set_focus_state_watch_cb(focus_mask, focus_watch_callback, NULL);
-                       if (ret) {
-                               g_print("fail to sound_manager_set_focus_state_watch_cb(), ret(0x%x)\n", ret);
-                       }
-                       reset_menu_state();
-               }
+       }
+       case CURRENT_STATUS_SET_FOCUS_WATCH_CB: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               int focus_type = 0;
+               sound_stream_focus_mask_e focus_mask;
+
+               focus_type = atoi(cmd);
+               switch (focus_type) {
+               case 0: /* playback */
+                       focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK;
+                       break;
+               case 1: /* recording */
+                       focus_mask = SOUND_STREAM_FOCUS_FOR_RECORDING;
+                       break;
+               case 2: /* both */
+                       focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK | SOUND_STREAM_FOCUS_FOR_RECORDING;
+                       break;
+               default:
+                       focus_mask = SOUND_STREAM_FOCUS_FOR_PLAYBACK;
+                       break;
+               }
+               ret = sound_manager_set_focus_state_watch_cb(focus_mask, focus_watch_callback, NULL);
+               if (ret)
+                       g_print("fail to sound_manager_set_focus_state_watch_cb(), ret(0x%x)\n", ret);
+
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_UNSET_FOCUS_WATCH_CB:
-               {
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       ret = sound_manager_unset_focus_state_watch_cb();
-                       if (ret) {
-                               g_print("fail to sound_manager_unset_focus_state_watch_cb(), ret(0x%x)\n", ret);
-                       }
-                       reset_menu_state();
-               }
+       }
+       case CURRENT_STATUS_UNSET_FOCUS_WATCH_CB: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               ret = sound_manager_unset_focus_state_watch_cb();
+               if (ret)
+                       g_print("fail to sound_manager_unset_focus_state_watch_cb(), ret(0x%x)\n", ret);
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_CREATE_VIRTUAL_STREAM:
-               {
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       if (!g_stream_info_h || g_vstream_h) {
-                               g_print("fail to create virtual stream, g_stream_info_h(%p)/g_vstream_h(%p)\n", g_stream_info_h, g_vstream_h);
-                               reset_menu_state();
-                               break;
-                       }
-                       ret = sound_manager_create_virtual_stream(g_stream_info_h, &g_vstream_h);
-                       if (ret) {
-                               g_print("fail to sound_manager_create_virtual_stream(), ret(0x%x)\n", ret);
-                       } else {
-                               g_print("success to sound_manager_create_virtual_stream(), ret(0x%x)\n", ret);
-                       }
+       }
+       case CURRENT_STATUS_CREATE_VIRTUAL_STREAM: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               if (!g_stream_info_h || g_vstream_h) {
+                       g_print("fail to create virtual stream, g_stream_info_h(%p)/g_vstream_h(%p)\n", g_stream_info_h, g_vstream_h);
                        reset_menu_state();
+                       break;
                }
+               ret = sound_manager_create_virtual_stream(g_stream_info_h, &g_vstream_h);
+               if (ret)
+                       g_print("fail to sound_manager_create_virtual_stream(), ret(0x%x)\n", ret);
+               else
+                       g_print("success to sound_manager_create_virtual_stream(), ret(0x%x)\n", ret);
+
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_START_VIRTUAL_STREAM:
-               {
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       if (g_vstream_h) {
-                               ret = sound_manager_start_virtual_stream(g_vstream_h);
-                               if (ret) {
-                                       g_print("fail to sound_manager_start_virtual_stream(), ret(0x%x)\n", ret);
-                               } else {
-                                       g_print("success to sound_manager_start_virtual_stream(), ret(0x%x)\n", ret);
-                               }
-                       }
-                       reset_menu_state();
+       }
+       case CURRENT_STATUS_START_VIRTUAL_STREAM: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               if (g_vstream_h) {
+                       ret = sound_manager_start_virtual_stream(g_vstream_h);
+                       if (ret)
+                               g_print("fail to sound_manager_start_virtual_stream(), ret(0x%x)\n", ret);
+                       else
+                               g_print("success to sound_manager_start_virtual_stream(), ret(0x%x)\n", ret);
                }
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_STOP_VIRTUAL_STREAM:
-               {
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       if (g_vstream_h) {
-                               ret = sound_manager_stop_virtual_stream(g_vstream_h);
-                               if (ret) {
-                                       g_print("fail to sound_manager_stop_virtual_stream(), ret(0x%x)\n", ret);
-                               } else {
-                                       g_print("success to sound_manager_stop_virtual_stream(), ret(0x%x)\n", ret);
-                               }
-                       }
-                       reset_menu_state();
+       }
+       case CURRENT_STATUS_STOP_VIRTUAL_STREAM: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               if (g_vstream_h) {
+                       ret = sound_manager_stop_virtual_stream(g_vstream_h);
+                       if (ret)
+                               g_print("fail to sound_manager_stop_virtual_stream(), ret(0x%x)\n", ret);
+                       else
+                               g_print("success to sound_manager_stop_virtual_stream(), ret(0x%x)\n", ret);
                }
+               reset_menu_state();
                break;
-               case CURRENT_STATUS_DESTROY_VIRTUAL_STREAM:
-               {
-                       int ret = SOUND_MANAGER_ERROR_NONE;
-                       if (g_vstream_h) {
-                               ret = sound_manager_destroy_virtual_stream(g_vstream_h);
-                               if (ret) {
-                                       g_print("fail to sound_manager_destroy_virtual_stream(), ret(0x%x)\n", ret);
-                               } else {
-                                       g_print("success to sound_manager_destroy_virtual_stream(), ret(0x%x)\n", ret);
-                               }
-                               g_vstream_h = NULL;
-                       }
-                       reset_menu_state();
+       }
+       case CURRENT_STATUS_DESTROY_VIRTUAL_STREAM: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               if (g_vstream_h) {
+                       ret = sound_manager_destroy_virtual_stream(g_vstream_h);
+                       if (ret)
+                               g_print("fail to sound_manager_destroy_virtual_stream(), ret(0x%x)\n", ret);
+                       else
+                               g_print("success to sound_manager_destroy_virtual_stream(), ret(0x%x)\n", ret);
+                       g_vstream_h = NULL;
                }
+               reset_menu_state();
                break;
        }
+       }
        g_timeout_add(100, timeout_menu_display, 0);
 }
 
-gboolean input (GIOChannel *channel)
+gboolean input(GIOChannel *channel)
 {
-    gchar buf[MAX_STRING_LEN];
-    gsize read;
-    GError *error = NULL;
+       gchar buf[MAX_STRING_LEN];
+       gsize read;
+       GError *error = NULL;
 
-    g_io_channel_read_chars(channel, buf, MAX_STRING_LEN, &read, &error);
-    buf[read] = '\0';
-    g_strstrip(buf);
-    interpret (buf);
+       g_io_channel_read_chars(channel, buf, MAX_STRING_LEN, &read, &error);
+       buf[read] = '\0';
+       g_strstrip(buf);
+       interpret(buf);
 
-    return TRUE;
+       return TRUE;
 }
 
 int main(int argc, char *argv[])
 {
        GIOChannel *stdin_channel;
        stdin_channel = g_io_channel_unix_new(0);
-       g_io_channel_set_flags (stdin_channel, G_IO_FLAG_NONBLOCK, NULL);
+       g_io_channel_set_flags(stdin_channel, G_IO_FLAG_NONBLOCK, NULL);
        g_io_add_watch(stdin_channel, G_IO_IN, (GIOFunc)input, NULL);
-       g_loop = g_main_loop_new (NULL, 1);
+       g_loop = g_main_loop_new(NULL, 1);
 
        displaymenu();
-       g_main_loop_run (g_loop);
+       g_main_loop_run(g_loop);
 
        return 0;
 }