From: Eunhae Choi Date: Fri, 2 Dec 2016 04:39:14 +0000 (+0900) Subject: [ACR-857/MPR-916] Change audio_policy API name for consistency with other pkgs X-Git-Tag: accepted/tizen/common/20161208.135505^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=78e34517a63d3ff84d70251e881c2de6f30ed09c;p=platform%2Fcore%2Fapi%2Fplayer.git [ACR-857/MPR-916] Change audio_policy API name for consistency with other pkgs Change-Id: Ib007b4be1e4a2423a13d377243c782e96d1a9b2f --- diff --git a/include/common/player.h b/include/common/player.h index 77f9e13..d5ce899 100644 --- a/include/common/player.h +++ b/include/common/player.h @@ -642,6 +642,28 @@ int player_set_sound_type(player_h player, sound_type_e type) TIZEN_DEPRECATED_A * @see sound_manager_create_stream_information() * @see sound_manager_destroy_stream_information() */ +int player_set_sound_stream_info(player_h player, sound_stream_info_h stream_info); + +/** + * @brief Sets the player's sound manager stream information. + * @since_tizen 3.0 + * @remarks You can set sound stream information including audio routing and volume type. + * For more details, please refer to sound_manager.h + * + * @param[in] player The handle to the media player + * @param[in] stream_info The sound manager info type + * @return @c 0 on success, + * otherwise a negative error value + * @retval #PLAYER_ERROR_NONE Successful + * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation + * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state + * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature + * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create(). + * @see #sound_stream_info_h + * @see sound_manager_create_stream_information() + * @see sound_manager_destroy_stream_information() + */ int player_set_audio_policy_info(player_h player, sound_stream_info_h stream_info); /** diff --git a/include/wearable/player.h b/include/wearable/player.h index 33074d5..483638d 100644 --- a/include/wearable/player.h +++ b/include/wearable/player.h @@ -643,6 +643,28 @@ int player_set_sound_type(player_h player, sound_type_e type) TIZEN_DEPRECATED_A * @see sound_manager_create_stream_information() * @see sound_manager_destroy_stream_information() */ +int player_set_sound_stream_info(player_h player, sound_stream_info_h stream_info); + +/** + * @brief Sets the player's sound manager stream information. + * @since_tizen 3.0 + * @remarks You can set sound stream information including audio routing and volume type. + * For more details, please refer to sound_manager.h + * + * @param[in] player The handle to the media player + * @param[in] stream_info The sound manager info type + * @return @c 0 on success, + * otherwise a negative error value + * @retval #PLAYER_ERROR_NONE Successful + * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation + * @retval #PLAYER_ERROR_INVALID_STATE Invalid player state + * @retval #PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE Unsupported feature + * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create(). + * @see #sound_stream_info_h + * @see sound_manager_create_stream_information() + * @see sound_manager_destroy_stream_information() + */ int player_set_audio_policy_info(player_h player, sound_stream_info_h stream_info); /** diff --git a/src/player.c b/src/player.c index 41f0946..785b6d4 100644 --- a/src/player.c +++ b/src/player.c @@ -2094,6 +2094,43 @@ int player_set_audio_policy_info(player_h player, sound_stream_info_h stream_inf } +int player_set_sound_stream_info(player_h player, sound_stream_info_h stream_info) +{ + PLAYER_INSTANCE_CHECK(player); + + muse_player_api_e api = MUSE_PLAYER_API_SET_AUDIO_POLICY_INFO; + player_cli_s *pc = (player_cli_s *) player; + char *ret_buf = NULL; + + LOGD("ENTER"); + + bool is_available = false; + + /* check if stream_info is valid */ + int ret = __player_convert_error_code( + sound_manager_is_available_stream_information( + stream_info, NATIVE_API_PLAYER, &is_available), (char *)__FUNCTION__); + + if (ret == PLAYER_ERROR_NONE) { + if (is_available == false) + ret = PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE; + else { + char *stream_type = NULL; + int stream_index = 0; + ret = sound_manager_get_type_from_stream_information(stream_info, &stream_type); + ret = sound_manager_get_index_from_stream_information(stream_info, &stream_index); + if (ret == SOUND_MANAGER_ERROR_NONE) + player_msg_send2(api, pc, ret_buf, ret, STRING, stream_type, INT, stream_index); + else + ret = PLAYER_ERROR_INVALID_OPERATION; + } + } + + g_free(ret_buf); + return ret; + +} + int player_set_audio_latency_mode(player_h player, audio_latency_mode_e latency_mode) { PLAYER_INSTANCE_CHECK(player);