[ACR-857/MPR-916] Change audio_policy API name for consistency with other pkgs 39/103139/1 accepted/tizen/common/20161208.135505 accepted/tizen/ivi/20161209.005417 accepted/tizen/mobile/20161209.005320 accepted/tizen/tv/20161209.005334 accepted/tizen/wearable/20161209.005358 submit/tizen/20161208.052043
authorEunhae Choi <eunhae1.choi@samsung.com>
Fri, 2 Dec 2016 04:39:14 +0000 (13:39 +0900)
committereunhae choi <eunhae1.choi@samsung.com>
Wed, 7 Dec 2016 10:26:43 +0000 (02:26 -0800)
Change-Id: Ib007b4be1e4a2423a13d377243c782e96d1a9b2f

include/common/player.h
include/wearable/player.h
src/player.c

index 77f9e135237dd2efe5d75d8222641d943af0c876..d5ce899313c46f92ca35ce6ec6ee8dddde359272 100644 (file)
@@ -622,6 +622,28 @@ int player_get_volume(player_h player, float *left, float *right);
  */
 int player_set_sound_type(player_h player, sound_type_e type) TIZEN_DEPRECATED_API;
 
+/**
+ * @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_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
index 33074d5506d1c2763c2fc52b61672c0f6f12ec06..483638d28552a75e294a77121b3acd8b1ee69e3b 100644 (file)
@@ -623,6 +623,28 @@ int player_get_volume(player_h player, float *left, float *right);
  */
 int player_set_sound_type(player_h player, sound_type_e type) TIZEN_DEPRECATED_API;
 
+/**
+ * @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_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
index 41f09464c3f86a28ff23c9981654cb29bd818c63..785b6d4751b538f14e6bc5120348766542d4af0c 100644 (file)
@@ -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);