From: Jeongho Mok Date: Thu, 7 May 2015 02:25:39 +0000 (+0900) Subject: Revert device-type X-Git-Tag: submit/tizen/20150715.092047~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a9b0cdc4457eb14f981a5ee1cc087a332702b51c;p=platform%2Fcore%2Fapi%2Fsound-manager.git Revert device-type Change-Id: Ia9e729c8e964df61f3abd2df4b6f046ab6543ccb Signed-off-by: Jeongho Mok --- diff --git a/src/sound_manager.c b/src/sound_manager.c index dfb5223..1159b67 100644 --- a/src/sound_manager.c +++ b/src/sound_manager.c @@ -193,6 +193,7 @@ int sound_manager_add_device_for_stream_routing (sound_stream_info_h stream_info bool added_successfully = false; char *device_type_str = NULL; int device_id = 0; + mm_sound_device_type_e device_type; mm_sound_device_io_direction_e device_direction; sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info; @@ -206,7 +207,11 @@ int sound_manager_add_device_for_stream_routing (sound_stream_info_h stream_info if (ret) { return __convert_sound_manager_error_code(__func__, ret); } - ret = mm_sound_get_device_type(device, &device_type_str); + ret = mm_sound_get_device_type(device, &device_type); + if (ret) { + return __convert_sound_manager_error_code(__func__, ret); + } + ret = __convert_device_type(device_type, &device_type_str); if (ret) { return __convert_sound_manager_error_code(__func__, ret); } @@ -275,6 +280,7 @@ int sound_manager_remove_device_for_stream_routing (sound_stream_info_h stream_i bool removed_successfully = false; char *device_type_str = NULL; int device_id = 0; + mm_sound_device_type_e device_type; mm_sound_device_io_direction_e device_direction; sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info; @@ -288,10 +294,11 @@ int sound_manager_remove_device_for_stream_routing (sound_stream_info_h stream_i if (ret) { return __convert_sound_manager_error_code(__func__, ret); } - ret = mm_sound_get_device_type(device, &device_type_str); + ret = mm_sound_get_device_type(device, &device_type); 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) { return __convert_sound_manager_error_code(__func__, ret); @@ -933,11 +940,7 @@ int sound_manager_get_prev_device (sound_device_list_h device_list, sound_device int sound_manager_get_device_type (sound_device_h device, sound_device_type_e *type) { int ret = MM_ERROR_NONE; - char *device_type = NULL; - ret = mm_sound_get_device_type(device, &device_type); - if (ret == MM_ERROR_NONE) { - ret = __convert_device_type_to_enum(device_type, type); - } + ret = mm_sound_get_device_type(device, (mm_sound_device_type_e*)type); return __convert_sound_manager_error_code(__func__, ret); } diff --git a/src/sound_manager_private.c b/src/sound_manager_private.c index e241926..1e62a84 100644 --- a/src/sound_manager_private.c +++ b/src/sound_manager_private.c @@ -834,18 +834,14 @@ int __set_session_mode (_session_mode_e mode) goto ERROR_CASE; } else { while ((w_ret = mm_sound_get_next_device(device_list, &device)) == MM_ERROR_NONE) { - char *type = NULL; - sound_device_type_e type_e; + mm_sound_device_type_e type; ret = mm_sound_get_device_type(device, &type); - if (ret != MM_ERROR_NONE) - goto ERROR_CASE; - ret = __convert_device_type_to_enum(type, &type_e); if (ret != MM_ERROR_NONE) goto ERROR_CASE; switch (mode) { case _SESSION_MODE_VOICE_WITH_AUDIO_JACK: - if (type_e == SOUND_DEVICE_AUDIO_JACK) { + if (type == MM_SOUND_DEVICE_TYPE_AUDIOJACK) { mm_sound_device_io_direction_e io_direction; ret = mm_sound_get_device_io_direction(device, &io_direction); if (ret != MM_ERROR_NONE) @@ -856,7 +852,7 @@ int __set_session_mode (_session_mode_e mode) } break; case _SESSION_MODE_VOICE_WITH_BLUETOOTH: - if (type_e == SOUND_DEVICE_BLUETOOTH) { + if (type == MM_SOUND_DEVICE_TYPE_BLUETOOTH) { mm_sound_device_io_direction_e io_direction; ret = mm_sound_get_device_io_direction(device, &io_direction); if (ret != MM_ERROR_NONE) @@ -918,28 +914,24 @@ int __get_session_mode (_session_mode_e *mode) goto ERROR_CASE; } else { while ((w_ret = mm_sound_get_next_device(device_list, &device)) == MM_ERROR_NONE) { - char *type = NULL; - sound_device_type_e type_e; + mm_sound_device_type_e type; ret = mm_sound_get_device_type(device, &type); if (ret != MM_ERROR_NONE) goto ERROR_CASE; - ret = __convert_device_type_to_enum(type, &type_e); - if (ret != MM_ERROR_NONE) - goto ERROR_CASE; - switch (type_e) { - case SOUND_DEVICE_BUILTIN_SPEAKER: + switch (type) { + case MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER: *mode = _SESSION_MODE_VOICE_WITH_BUILTIN_SPEAKER; need_to_out = true; break; - case SOUND_DEVICE_BUILTIN_RECEIVER: + case MM_SOUND_DEVICE_TYPE_BUILTIN_RECEIVER: *mode = _SESSION_MODE_VOICE_WITH_BUILTIN_RECEIVER; need_to_out = true; break; - case SOUND_DEVICE_AUDIO_JACK: + case MM_SOUND_DEVICE_TYPE_AUDIOJACK: *mode = _SESSION_MODE_VOICE_WITH_AUDIO_JACK; need_to_out = true; break; - case SOUND_DEVICE_BLUETOOTH: + case MM_SOUND_DEVICE_TYPE_BLUETOOTH: *mode = _SESSION_MODE_VOICE_WITH_BLUETOOTH; need_to_out = true; break;