From 950ff68e6d53a92f969c2e922b2552f939962945 Mon Sep 17 00:00:00 2001 From: Seungbae Shin Date: Wed, 15 Nov 2017 17:15:40 +0900 Subject: [PATCH] Remove 3.0 deprecated API Please refer following deprecation policy. https://developer.tizen.org/development/training/native-application/understanding-tizen-programming/api-versioning-and-deprecation-policy-tizen-platform [Version] 0.2.0 [Issue Type] Deprecation Change-Id: I6efbb32ea1210b8aada5104d1a6de738f95a6824 --- CMakeLists.txt | 2 +- doc/tone_player_doc.h | 2 +- include/tone_player.h | 28 +-------------------------- packaging/capi-media-tone-player.spec | 2 +- src/tone_player.c | 23 ---------------------- test/CMakeLists.txt | 3 --- test/multimedia_tone_player_test.c | 18 ++++++++++++++++- 7 files changed, 21 insertions(+), 57 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c37f5e..fdfff13 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,7 +87,7 @@ CONFIGURE_FILE( ) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) -#ADD_SUBDIRECTORY(test) +ADD_SUBDIRECTORY(test) IF(UNIX) diff --git a/doc/tone_player_doc.h b/doc/tone_player_doc.h index 2655858..291ece9 100755 --- a/doc/tone_player_doc.h +++ b/doc/tone_player_doc.h @@ -38,7 +38,7 @@ * \#include * * @section CAPI_MEDIA_TONE_PLAYER_OVERVIEW Overview - * The @ref CAPI_MEDIA_TONE_PLAYER_MODULE API allows you to play and stop playing the tone. To play a particular type of tone(#tone_type_e), use tone_player_start(). To stop playing the tone, call tone_player_stop(). + * The @ref CAPI_MEDIA_TONE_PLAYER_MODULE API allows you to play and stop playing the tone. To play a particular type of tone(#tone_type_e), use tone_player_start_new(). To stop playing the tone, call tone_player_stop(). */ #endif /* __TIZEN_MEDIA_TONE_PLAYER_DOC_H__ */ diff --git a/include/tone_player.h b/include/tone_player.h index 1e8aff5..465a678 100755 --- a/include/tone_player.h +++ b/include/tone_player.h @@ -180,32 +180,6 @@ typedef enum { * @{ */ - -/** - * @deprecated Deprecated since 3.0. Use tone_player_start_new() instead. - * @brief Plays a tone. - * - * @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_SOUND_MANAGER_MODULE. - * - * @param[in] tone The tone type to play - * @param[in] type The sound type - * @param[in] duration_ms The tone duration in milliseconds \n - * @c -1 indicates an infinite duration. - * @param[out] id The tone player ID ( can be set to @c NULL ) - * - * @return @c 0 on success, - * otherwise a negative error value - * @retval #TONE_PLAYER_ERROR_NONE Successful - * @retval #TONE_PLAYER_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #TONE_PLAYER_ERROR_INVALID_OPERATION Invalid operation - * - * @see tone_player_stop() - */ -int tone_player_start(tone_type_e tone, sound_type_e type, int duration_ms, int *id) TIZEN_DEPRECATED_API; - /** * @brief Plays a tone with stream information of sound-manager. * @@ -244,7 +218,7 @@ int tone_player_start_new(tone_type_e tone, sound_stream_info_h stream_info, int * @retval #TONE_PLAYER_ERROR_INVALID_PARAMETER Invalid parameter * @retval #TONE_PLAYER_ERROR_INVALID_OPERATION Invalid operation * - * @see tone_player_start() + * @see tone_player_start_new() */ int tone_player_stop(int id); diff --git a/packaging/capi-media-tone-player.spec b/packaging/capi-media-tone-player.spec index 0e68f97..0780885 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.15 +Version: 0.2.0 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/tone_player.c b/src/tone_player.c index f1c21ef..17b7ab7 100755 --- a/src/tone_player.c +++ b/src/tone_player.c @@ -30,11 +30,6 @@ #include #include - -#define DEPRECATED_WARN_INSTEAD(msg) do { \ - LOGW("DEPRECATION WARNING: %s() is deprecated and will be removed from next release. Use %s() instead.", __func__, msg); \ -} while (0) - static int __convert_tone_player_error_code(const char *func, int code) { int ret = TONE_PLAYER_ERROR_NONE; @@ -59,24 +54,6 @@ static int __convert_tone_player_error_code(const char *func, int code) return ret; } -int tone_player_start(tone_type_e tone, sound_type_e type, int duration_ms, int *id) -{ - int ret; - int player; - - DEPRECATED_WARN_INSTEAD("tone_player_start_new"); - - 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_ms, &player); - - if (ret == 0 && id != NULL) - *id = player; - - return __convert_tone_player_error_code(__func__, ret); -} - int tone_player_start_new(tone_type_e tone, sound_stream_info_h stream_info, int duration_ms, int *id) { int ret; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 74802de..07a6abf 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,9 +9,6 @@ ENDFOREACH() SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -pie") -#ADD_EXECUTABLE("system-sensor" system-sensor.c) -#TARGET_LINK_LIBRARIES("system-sensor" ${fw_name} ${${fw_test}_LDFLAGS}) - aux_source_directory(. sources) FOREACH(src ${sources}) GET_FILENAME_COMPONENT(src_name ${src} NAME_WE) diff --git a/test/multimedia_tone_player_test.c b/test/multimedia_tone_player_test.c index 044e913..7aa38dd 100755 --- a/test/multimedia_tone_player_test.c +++ b/test/multimedia_tone_player_test.c @@ -21,6 +21,7 @@ #include #include #include +#include #define TONE_FIRST TONE_TYPE_DTMF_0 #define TONE_LAST TONE_TYPE_USER_DEFINED_HIGH_FRE @@ -47,9 +48,17 @@ void help() " -h, --help help\n"); } +static void stream_focus_cb(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_e focus_state, + sound_stream_focus_change_reason_e reason, int sound_behavior, const char *extra_info, void *user_data) +{ + return; +} + + void tone_play_test(int from, int to, int duration, int sleep_time) { int i; + sound_stream_info_h stream_info; printf("From : %2d, To : %2d, Duration : %4d, sleep_time : %4d\n", from, to, duration, sleep_time); @@ -57,12 +66,19 @@ void tone_play_test(int from, int to, int duration, int sleep_time) printf("Wrong Parameter\n"); return; } + + if (sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, stream_focus_cb, NULL, &stream_info)) { + printf("failed to create stream info\n"); + return; + } for (i = from; i <= to; i++) { printf("Play Tone : %d\n", i); - tone_player_start(i, SOUND_TYPE_MEDIA, duration, NULL); + tone_player_start_new(i, stream_info, duration, NULL); usleep(sleep_time * 1000); } + + sound_manager_destroy_stream_information(stream_info); } int main(int argc, char **argv) -- 2.34.1