From fc9a914c952d13f5f8b2fb1b70cc16f49a5f7077 Mon Sep 17 00:00:00 2001 From: Mok Jeongho Date: Fri, 30 Oct 2015 16:45:49 +0900 Subject: [PATCH] modify codes for complying tizen coding rule [Version] Release 0.1.5 [Profile] Common [Issue Type] Coding Rule Change-Id: Icb47300d861b39dd73683c93fdb9826ec1a8d215 Signed-off-by: Mok Jeongho --- include/tone_player.h | 18 +++---- packaging/capi-media-tone-player.spec | 2 +- src/tone_player.c | 71 ++++++++++++++------------- 3 files changed, 46 insertions(+), 45 deletions(-) diff --git a/include/tone_player.h b/include/tone_player.h index 3620440..75a4ed9 100755 --- a/include/tone_player.h +++ b/include/tone_player.h @@ -44,23 +44,21 @@ extern "C" * @brief Enumeration of error codes for wav player. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ - TONE_PLAYER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ - TONE_PLAYER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ - TONE_PLAYER_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */ - TONE_PLAYER_ERROR_NOT_SUPPORTED_TYPE = TIZEN_ERROR_TONE_PLAYER | 0x01 /**< Not supported (Since 3.0) */ +typedef enum { + TONE_PLAYER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ + TONE_PLAYER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ + TONE_PLAYER_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */ + TONE_PLAYER_ERROR_NOT_SUPPORTED_TYPE = TIZEN_ERROR_TONE_PLAYER | 0x01 /**< Not supported (Since 3.0) */ } tone_player_error_e; /** * @brief Enumeration of tone. * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif */ -typedef enum -{ +typedef enum { TONE_TYPE_DEFAULT = 0, /**< The default tone */ TONE_TYPE_DTMF_0 = 0, /**< Predefined DTMF 0 */ - TONE_TYPE_DTMF_1, /**< Predefined DTMF 1 */ + TONE_TYPE_DTMF_1, /**< Predefined DTMF 1 */ TONE_TYPE_DTMF_2, /**< Predefined DTMF 2 */ TONE_TYPE_DTMF_3, /**< Predefined DTMF 3 */ TONE_TYPE_DTMF_4, /**< Predefined DTMF 4 */ @@ -190,7 +188,7 @@ typedef enum * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif * * @remarks Sound can be mixed with other sounds if you don't control the sound session in sound-manager module since 3.0.\n - * You can refer to @ref CAPI_MEDIA_SUOND_MANAGER_MODULE. + * You can refer to @ref CAPI_MEDIA_SUOND_MANAGER_MODULE. * * @param[in] tone The tone type to play * @param[in] type The sound type diff --git a/packaging/capi-media-tone-player.spec b/packaging/capi-media-tone-player.spec index bc16cb4..4428176 100755 --- a/packaging/capi-media-tone-player.spec +++ b/packaging/capi-media-tone-player.spec @@ -1,6 +1,6 @@ Name: capi-media-tone-player Summary: A tone player library in Tizen C API -Version: 0.1.4 +Version: 0.1.5 Release: 18 Group: Multimedia/API License: Apache-2.0 diff --git a/src/tone_player.c b/src/tone_player.c index 99d3bd6..5caee54 100755 --- a/src/tone_player.c +++ b/src/tone_player.c @@ -31,44 +31,46 @@ #include -static int __convert_tone_player_error_code(const char *func, int code){ +static int __convert_tone_player_error_code(const char *func, int code) +{ int ret = TONE_PLAYER_ERROR_NONE; char *errorstr = NULL; - switch(code) - { - case MM_ERROR_NONE: - ret = TONE_PLAYER_ERROR_NONE; - errorstr = "ERROR_NONE"; - break; - case TONE_PLAYER_ERROR_INVALID_PARAMETER: - case MM_ERROR_INVALID_ARGUMENT: - case MM_ERROR_SOUND_INVALID_POINTER: - ret = TONE_PLAYER_ERROR_INVALID_PARAMETER; - errorstr = "INVALID_PARAMETER"; - break; - case MM_ERROR_SOUND_INTERNAL: - ret = TONE_PLAYER_ERROR_INVALID_OPERATION; - errorstr = "INVALID_OPERATION"; - break; + switch (code) { + case MM_ERROR_NONE: + ret = TONE_PLAYER_ERROR_NONE; + errorstr = "ERROR_NONE"; + break; + case TONE_PLAYER_ERROR_INVALID_PARAMETER: + case MM_ERROR_INVALID_ARGUMENT: + case MM_ERROR_SOUND_INVALID_POINTER: + ret = TONE_PLAYER_ERROR_INVALID_PARAMETER; + errorstr = "INVALID_PARAMETER"; + break; + case MM_ERROR_SOUND_INTERNAL: + ret = TONE_PLAYER_ERROR_INVALID_OPERATION; + errorstr = "INVALID_OPERATION"; + break; } - LOGE( "[%s] %s(0x%08x) : core frameworks error code(0x%08x)",func, errorstr, ret, code); + LOGE("[%s] %s(0x%08x) : core frameworks error code(0x%08x)", func, errorstr, ret, code); return ret; } -int tone_player_start(tone_type_e tone, sound_type_e type, int duration, int *id){ - int ret; - int player; - if( tone < TONE_TYPE_DEFAULT || tone > TONE_TYPE_USER_DEFINED_HIGH_FRE ) - return __convert_tone_player_error_code(__func__, TONE_PLAYER_ERROR_INVALID_PARAMETER); +int tone_player_start(tone_type_e tone, sound_type_e type, int duration, int *id) +{ + int ret; + int player; + if (tone < TONE_TYPE_DEFAULT || tone > TONE_TYPE_USER_DEFINED_HIGH_FRE) + return __convert_tone_player_error_code(__func__, TONE_PLAYER_ERROR_INVALID_PARAMETER); - ret = mm_sound_play_tone(tone, type , 1, duration, &player); + ret = mm_sound_play_tone(tone, type , 1, duration, &player); - if( ret == 0 && id != NULL) - *id = player; - return __convert_tone_player_error_code(__func__, ret); + if (ret == 0 && id != NULL) + *id = player; + return __convert_tone_player_error_code(__func__, ret); } -int tone_player_start_with_stream_info(tone_type_e tone, sound_stream_info_h stream_info, int duration, int * id){ +int tone_player_start_with_stream_info(tone_type_e tone, sound_stream_info_h stream_info, int duration, int * id) +{ int ret; int player; double vol = 1.0; @@ -76,23 +78,23 @@ int tone_player_start_with_stream_info(tone_type_e tone, sound_stream_info_h str int stream_id; bool result = false; - if( tone < TONE_TYPE_DEFAULT || tone > TONE_TYPE_USER_DEFINED_HIGH_FRE || stream_info == NULL) + if (tone < TONE_TYPE_DEFAULT || tone > TONE_TYPE_USER_DEFINED_HIGH_FRE || stream_info == NULL) return __convert_tone_player_error_code(__func__, TONE_PLAYER_ERROR_INVALID_PARAMETER); ret = sound_manager_is_available_stream_information(stream_info, NATIVE_API_TONE_PLAYER, &result); - if ( !result ) + if (!result) return __convert_tone_player_error_code(__func__, TONE_PLAYER_ERROR_NOT_SUPPORTED_TYPE); ret = sound_manager_get_type_from_stream_information(stream_info, &stream_type); - if( ret ) + if (ret) return __convert_tone_player_error_code(__func__, ret); ret = sound_manager_get_index_from_stream_information(stream_info, &stream_id); - if( ret ) + if (ret) return __convert_tone_player_error_code(__func__, ret); ret = mm_sound_play_tone_with_stream_info(tone, stream_type, stream_id, vol, duration, &player); - if( ret == 0 && id != NULL) + if (ret == 0 && id != NULL) *id = player; return __convert_tone_player_error_code(__func__, ret); @@ -100,7 +102,8 @@ int tone_player_start_with_stream_info(tone_type_e tone, sound_stream_info_h str } -int tone_player_stop(int id){ +int tone_player_stop(int id) +{ return __convert_tone_player_error_code(__func__, mm_sound_stop_sound(id)); } -- 2.34.1