From 65de74753c064bc740cb77f3f1d044335bf2b2cc Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Mon, 19 Sep 2016 15:11:01 +0900 Subject: [PATCH] [common][v0.3.20] apply API deprecation policy Change-Id: I1add6a9c4213501dcce89fe4beb44e0df38cf853 --- include/common/player.h | 2 +- include/wearable/player.h | 2 +- packaging/capi-media-player.spec | 2 +- src/player.c | 36 +++++++++++++++++++++++++++++++++++- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/include/common/player.h b/include/common/player.h index 8726c5f..ea10af7 100644 --- a/include/common/player.h +++ b/include/common/player.h @@ -617,7 +617,7 @@ int player_get_volume(player_h player, float *left, float *right); * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create(). * @see sound_manager_get_current_sound_type() */ -int player_set_sound_type(player_h player, sound_type_e type); +int player_set_sound_type(player_h player, sound_type_e type) TIZEN_DEPRECATED_API; /** * @brief Sets the player's sound manager stream information. diff --git a/include/wearable/player.h b/include/wearable/player.h index cdafc2b..bf7951e 100755 --- a/include/wearable/player.h +++ b/include/wearable/player.h @@ -615,7 +615,7 @@ int player_get_volume(player_h player, float *left, float *right); * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create(). * @see sound_manager_get_current_sound_type() */ -int player_set_sound_type(player_h player, sound_type_e type); +int player_set_sound_type(player_h player, sound_type_e type) TIZEN_DEPRECATED_API; /** * @brief Sets the player's sound manager stream information. diff --git a/packaging/capi-media-player.spec b/packaging/capi-media-player.spec index 73b003b..2e5f216 100644 --- a/packaging/capi-media-player.spec +++ b/packaging/capi-media-player.spec @@ -1,6 +1,6 @@ Name: capi-media-player Summary: A Media Player API -Version: 0.3.19 +Version: 0.3.20 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/player.c b/src/player.c index cf77518..961f881 100644 --- a/src/player.c +++ b/src/player.c @@ -419,13 +419,46 @@ static void __complete_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) ((player_completed_cb) cb_info->user_cb[ev]) (cb_info->user_data[ev]); } +static char* _convert_code_to_str(int code) +{ + switch (code) { + case PLAYER_INTERRUPTED_COMPLETED: /* Deprecated since 3.0 */ + return "PLAYER_INTERRUPTED_COMPLETED"; + case PLAYER_INTERRUPTED_BY_MEDIA: /* Deprecated since 3.0 */ + return "PLAYER_INTERRUPTED_BY_MEDIA"; + case PLAYER_INTERRUPTED_BY_CALL: /* Deprecated since 3.0 */ + return "PLAYER_INTERRUPTED_BY_CALL"; + case PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG: /* Deprecated since 3.0 */ + return "PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG"; + case PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT: + return "PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT"; + case PLAYER_INTERRUPTED_BY_ALARM: /* Deprecated since 3.0 */ + return "PLAYER_INTERRUPTED_BY_ALARM"; + case PLAYER_INTERRUPTED_BY_EMERGENCY: /* Deprecated since 3.0 */ + return "PLAYER_INTERRUPTED_BY_EMERGENCY"; + case PLAYER_INTERRUPTED_BY_NOTIFICATION: /* Deprecated since 3.0 */ + return "PLAYER_INTERRUPTED_BY_NOTIFICATION"; + default: + LOGE("Invalid interrupted code %d (Never enter here)", code); + return NULL; + } +} + static void __interrupt_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) { int code; muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_INTERRUPT; - if (player_msg_get(code, recvMsg)) + if (player_msg_get(code, recvMsg)) { + + if (code >= PLAYER_INTERRUPTED_COMPLETED && + code <= PLAYER_INTERRUPTED_BY_NOTIFICATION && + code != PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT) { + LOGW("DEPRECATION WARNING: %s is deprecated and will be removed from next release.", _convert_code_to_str(code)); + } + ((player_interrupted_cb) cb_info->user_cb[ev]) (code, cb_info->user_data[ev]); + } } static void __error_cb_handler(callback_cb_info_s * cb_info, char *recvMsg) @@ -1758,6 +1791,7 @@ int player_set_sound_type(player_h player, sound_type_e type) char *ret_buf = NULL; LOGD("ENTER"); + LOGW("DEPRECATION WARNING: player_set_sound_type() is deprecated and will be removed from next release. Use player_set_audio_policy_info() instead."); player_msg_send1(api, pc, ret_buf, ret, INT, type); g_free(ret_buf); -- 2.7.4