* <td>This function must be called after player_create()</td>
* </tr>
* <tr>
+ * <td>player_set_audio_policy_info()</td>
+ * <td>IDLE</td>
+ * <td>This function must be called after player_create()</td>
+ * </tr>
+ * <tr>
* <td>player_set_sound_type()</td>
* <td>IDLE</td>
* <td>This function must be called after player_create()</td>
*/
typedef enum
{
- PLAYER_INTERRUPTED_COMPLETED = 0, /**< Interrupt completed */
- PLAYER_INTERRUPTED_BY_MEDIA, /**< Interrupted by a non-resumable media application */
- PLAYER_INTERRUPTED_BY_CALL, /**< Interrupted by an incoming call */
- PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG, /**< Interrupted by unplugging headphones */
+ PLAYER_INTERRUPTED_COMPLETED = 0, /**< Interrupt completed (Deprecated since 3.0)*/
+ PLAYER_INTERRUPTED_BY_MEDIA, /**< Interrupted by a non-resumable media application (Deprecated since 3.0)*/
+ PLAYER_INTERRUPTED_BY_CALL, /**< Interrupted by an incoming call (Deprecated since 3.0)*/
+ PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG, /**< Interrupted by unplugging headphones (Deprecated since 3.0)*/
PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT, /**< Interrupted by a resource conflict */
- PLAYER_INTERRUPTED_BY_ALARM, /**< Interrupted by an alarm */
- PLAYER_INTERRUPTED_BY_EMERGENCY, /**< Interrupted by an emergency */
- PLAYER_INTERRUPTED_BY_NOTIFICATION, /**< Interrupted by a notification */
+ PLAYER_INTERRUPTED_BY_ALARM, /**< Interrupted by an alarm (Deprecated since 3.0)*/
+ PLAYER_INTERRUPTED_BY_EMERGENCY, /**< Interrupted by an emergency (Deprecated since 3.0)*/
+ PLAYER_INTERRUPTED_BY_NOTIFICATION, /**< Interrupted by a notification (Deprecated since 3.0)*/
} player_interrupted_code_e;
/**
int player_get_volume(player_h player, float *left, float *right);
/**
+ * @deprecated Deprecated since 3.0. Use player_set_audio_policy_info() instead.
* @brief Sets the player's volume type.
* @since_tizen 2.3
* @remarks The default sound type of the player is #SOUND_TYPE_MEDIA.
int player_set_sound_type(player_h player, sound_type_e type);
/**
+ * @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);
+
+/**
* @brief Sets the audio latency mode.
* @since_tizen 2.3
* @remarks The default audio latency mode of the player is #AUDIO_LATENCY_MODE_MID.
/**
* @brief Starts or resumes playback.
* @since_tizen 2.3
+ * @remarks Sound can be mixed with other sounds if you don't control the stream focus in sound-manager module since 3.0.\n
+ * You can refer to @ref CAPI_MEDIA_SUOND_MANAGER_MODULE.
* @details Plays current media content, or resumes play if paused.
*
* @param[in] player The handle to the media player
* @return @c 0 on success,
- * otherwise a negative error value
+ * otherwise a negative error value
* @retval #PLAYER_ERROR_NONE Successful
* @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #PLAYER_ERROR_INVALID_OPERATION Invalid operation
*/
typedef enum
{
- PLAYER_INTERRUPTED_COMPLETED = 0, /**< Interrupt completed */
- PLAYER_INTERRUPTED_BY_MEDIA, /**< Interrupted by a non-resumable media application */
- PLAYER_INTERRUPTED_BY_CALL, /**< Interrupted by an incoming call */
- PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG, /**< Interrupted by unplugging headphones */
+ PLAYER_INTERRUPTED_COMPLETED = 0, /**< Interrupt completed (Deprecated since 3.0)*/
+ PLAYER_INTERRUPTED_BY_MEDIA, /**< Interrupted by a non-resumable media application (Deprecated since 3.0) */
+ PLAYER_INTERRUPTED_BY_CALL, /**< Interrupted by an incoming call (Deprecated since 3.0)*/
+ PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG, /**< Interrupted by unplugging headphones (Deprecated since 3.0)*/
PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT, /**< Interrupted by a resource conflict */
- PLAYER_INTERRUPTED_BY_ALARM, /**< Interrupted by an alarm */
- PLAYER_INTERRUPTED_BY_EMERGENCY, /**< Interrupted by an emergency */
- PLAYER_INTERRUPTED_BY_NOTIFICATION, /**< Interrupted by a notification */
+ PLAYER_INTERRUPTED_BY_ALARM, /**< Interrupted by an alarm (Deprecated since 3.0) */
+ PLAYER_INTERRUPTED_BY_EMERGENCY, /**< Interrupted by an emergency (Deprecated since 3.0)*/
+ PLAYER_INTERRUPTED_BY_NOTIFICATION, /**< Interrupted by a notification (Deprecated since 3.0)*/
} player_interrupted_code_e;
/**
int player_get_volume(player_h player, float *left, float *right);
/**
+ * @deprecated Deprecated since 3.0. Use player_set_audio_policy_info() instead.
* @brief Sets the player's volume type.
* @since_tizen 2.3.1
* @remarks The default sound type of the player is #SOUND_TYPE_MEDIA.
int player_set_sound_type(player_h player, sound_type_e type);
/**
+ * @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);
+
+/**
* @brief Sets the audio latency mode.
* @since_tizen 2.3.1
* @remarks The default audio latency mode of the player is #AUDIO_LATENCY_MODE_MID.
/**
* @brief Starts or resumes playback.
* @since_tizen 2.3.1
+ * @remarks Sound can be mixed with other sounds if you don't control the stream focus in sound-manager module since 3.0.\n
+ * You can refer to @ref CAPI_MEDIA_SUOND_MANAGER_MODULE.
* @details Plays current media content, or resumes play if paused.
*
* @param[in] player The handle to the media player
return PLAYER_ERROR_NONE;
}
+int player_set_audio_policy_info(player_h player, sound_stream_info_h stream_info)
+{
+ PLAYER_INSTANCE_CHECK(player);
+ player_s * handle = (player_s *) player;
+ PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE);
+
+ bool is_available = false;
+
+ /* check if stream_info is valid */
+ int ret = sound_manager_is_available_stream_information(stream_info, NATIVE_API_PLAYER, &is_available);
+
+ if(ret != MM_ERROR_NONE)
+ {
+ return __player_convert_error_code(ret,(char*)__FUNCTION__);
+ }
+ else
+ {
+ if(is_available == false)
+ ret = MM_ERROR_NOT_SUPPORT_API;
+ 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)
+ ret = mm_player_set_attribute(handle->mm_handle, NULL,"sound_stream_type", stream_type, strlen(stream_type), "sound_stream_index", stream_index, (char*)NULL);
+ else
+ ret = MM_ERROR_PLAYER_INTERNAL;
+ }
+ }
+
+ if(ret != MM_ERROR_NONE)
+ return __player_convert_error_code(ret,(char*)__FUNCTION__);
+ else
+ return PLAYER_ERROR_NONE;
+}
+
int player_set_audio_latency_mode(player_h player, audio_latency_mode_e latency_mode)
{
PLAYER_INSTANCE_CHECK(player);
CURRENT_STATUS_FILENAME,
CURRENT_STATUS_VOLUME,
CURRENT_STATUS_SOUND_TYPE,
+ CURRENT_STATUS_SOUND_STREAM_INFO,
CURRENT_STATUS_MUTE,
CURRENT_STATUS_POSITION_TIME,
CURRENT_STATUS_LOOPING,
int g_menu_state = CURRENT_STATUS_MAINMENU;
char g_file_list[9][256];
gboolean quit_pushing;
+sound_stream_info_h g_stream_info_h = NULL;
static void prepared_cb(void *user_data)
{
}
}
+ if (g_stream_info_h)
+ {
+ sound_manager_destroy_stream_information(g_stream_info_h);
+ g_stream_info_h = NULL;
+ }
+
if (g_video_pkt)
media_packet_destroy(g_video_pkt);
g_print("set sound type(%d) success", type);
}
+void focus_callback (sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data)
+{
+ g_print("FOCUS callback is called, reason_for_change(%d), additional_info(%s), userdata(%p)", reason_for_change, additional_info, user_data);
+ return;
+}
+
+static void set_sound_stream_info(int type)
+{
+ if (g_stream_info_h)
+ {
+ g_print("stream information is already set, please destory handle and try again\n");
+ return;
+ }
+ if (sound_manager_create_stream_information( type, focus_callback, g_player[0], &g_stream_info_h))
+ {
+ g_print("failed to create stream_information()\n");
+ return;
+ }
+ if ( player_set_audio_policy_info(g_player[0], g_stream_info_h) != PLAYER_ERROR_NONE )
+ {
+ g_print("failed to set sound stream information(%p)\n", g_stream_info_h);
+ }
+ else
+ g_print("set stream information(%p) success", g_stream_info_h);
+}
+
static void get_position()
{
int position = 0;
{
g_menu_state = CURRENT_STATUS_SOUND_TYPE;
}
+ else if (strncmp(cmd, "k", 1) == 0)
+ {
+ g_menu_state = CURRENT_STATUS_SOUND_STREAM_INFO;
+ }
else if (strncmp(cmd, "h", 1) == 0 )
{
g_menu_state = CURRENT_STATUS_MUTE;
{
g_print("*** input sound type.(0:SYSTEM 1:NOTIFICATION 2:ALARM 3:RINGTONE 4:MEDIA 5:CALL 6:VOIP 7:FIXED)\n");
}
+ else if (g_menu_state == CURRENT_STATUS_SOUND_STREAM_INFO)
+ {
+ g_print("*** input sound stream type.(0:MEDIA 1:SYSTEM 2:ALARM 3:NOTIFICATION 4:RINGTONE 5:CALL 6:VOIP)\n");
+ }
else if (g_menu_state == CURRENT_STATUS_MUTE)
{
g_print("*** input mute value.(0: Not Mute, 1: Mute) \n");
reset_menu_state();
}
break;
+ case CURRENT_STATUS_SOUND_STREAM_INFO:
+ {
+ int type = atoi(cmd);
+ set_sound_stream_info(type);
+ reset_menu_state();
+ }
+ break;
case CURRENT_STATUS_MUTE:
{
int mute = atoi(cmd);