From: Sangchul Lee Date: Thu, 17 Dec 2015 06:44:07 +0000 (+0900) Subject: Add error case returning SOUND_MANAGER_ERROR_NO_DATA for sound_manager_get_sound_type API X-Git-Tag: submit/tizen/20151218.084826^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F82%2F54682%2F5;p=platform%2Fcore%2Fapi%2Fsound-manager.git Add error case returning SOUND_MANAGER_ERROR_NO_DATA for sound_manager_get_sound_type API In case of the stream_info made with SOUND_STREAM_TYPE_EMERGENCY, it'll return SOUND_MANAGER_ERROR_NO_DATA. Because there is no sound_type_e matched to this stream_info. [Version] Release 0.3.36 [profile] Common [Issue Type] modification Change-Id: I1eead535cfe934a3d0b5a533a27b498db6857bc7 Signed-off-by: Sangchul Lee --- diff --git a/include/sound_manager.h b/include/sound_manager.h index 7cc7a1b..406f241 100644 --- a/include/sound_manager.h +++ b/include/sound_manager.h @@ -785,11 +785,15 @@ int sound_manager_get_focus_reacquisition(sound_stream_info_h stream_info, bool * @since_tizen 3.0 * @param[in] stream_info The handle of stream information * @param[out] sound_type The sound type - * + * + * @remarks In case of the stream_info made with #SOUND_STREAM_TYPE_EMERGENCY, it'll return #SOUND_MANAGER_ERROR_NO_DATA.\n + * Because there is no sound_type_e matched to this stream_info. + * * @return @c 0 on success, * otherwise a negative error value * @retval #SOUND_MANAGER_ERROR_NONE Success * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #SOUND_MANAGER_ERROR_NO_DATA No data * @pre Call sound_manager_create_stream_information() before calling this function. * @see sound_manager_create_stream_information() * @see sound_manager_destroy_stream_information() diff --git a/packaging/capi-media-sound-manager.spec b/packaging/capi-media-sound-manager.spec index d5ae2be..1825eb0 100755 --- a/packaging/capi-media-sound-manager.spec +++ b/packaging/capi-media-sound-manager.spec @@ -1,6 +1,6 @@ Name: capi-media-sound-manager Summary: Sound Manager library -Version: 0.3.35 +Version: 0.3.36 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/sound_manager.c b/src/sound_manager.c index 2e808dc..2beb770 100644 --- a/src/sound_manager.c +++ b/src/sound_manager.c @@ -382,7 +382,12 @@ int sound_manager_get_sound_type(sound_stream_info_h stream_info, sound_type_e * SM_INSTANCE_CHECK(stream_h); SM_NULL_ARG_CHECK(sound_type); - ret = _convert_sound_type_to_enum(stream_h->stream_conf_info.volume_type, sound_type); + if (stream_h->stream_conf_info.volume_type == NULL) + ret = MM_ERROR_SOUND_NO_DATA; + else { + ret = _convert_sound_type_to_enum(stream_h->stream_conf_info.volume_type, sound_type); + LOGI("sound type(%d)", *sound_type); + } LOGI("<< leave : sound type(%d)", *sound_type); diff --git a/test/sound_manager_test.c b/test/sound_manager_test.c index 3af3e53..301627c 100644 --- a/test/sound_manager_test.c +++ b/test/sound_manager_test.c @@ -381,7 +381,7 @@ static void displaymenu() 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"); + g_print("*** input stream type to create stream information\n(0:media, 1:system, 2:alarm, 3:notification, 4:emergency, 5:ringtone-call, 6:voice-call, 7:voip, 8: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) @@ -989,22 +989,28 @@ static void interpret(char *cmd) case 0: /* media */ type = SOUND_STREAM_TYPE_MEDIA; break; - case 1: /* alarm */ + case 1: /* system */ + type = SOUND_STREAM_TYPE_SYSTEM; + break; + case 2: /* alarm */ type = SOUND_STREAM_TYPE_ALARM; break; - case 2: /* notification */ + case 3: /* notification */ type = SOUND_STREAM_TYPE_NOTIFICATION; break; - case 3: /* ringtone for call*/ + case 4: /* emergency */ + type = SOUND_STREAM_TYPE_EMERGENCY; + break; + case 5: /* ringtone for call*/ type = SOUND_STREAM_TYPE_RINGTONE_CALL; break; - case 4: /* voice call */ + case 6: /* voice call */ type = SOUND_STREAM_TYPE_VOICE_CALL; break; - case 5: /* voip */ + case 7: /* voip */ type = SOUND_STREAM_TYPE_VOIP; break; - case 6: /* media only for external devices */ + case 8: /* media only for external devices */ type = SOUND_STREAM_TYPE_MEDIA_EXTERNAL_ONLY; break; default: