From 6280c0d553cd027bb9b087ade02a5ba1a1525320 Mon Sep 17 00:00:00 2001 From: NAMJEONGYOON Date: Wed, 6 Jan 2016 15:50:33 +0900 Subject: [PATCH] if stream info exists, error will be returned Change-Id: I1b0ca2cdf8f7dca73222d78d723c9f24c6d8f73c --- include/mobile/player.h | 3 +++ include/wearable/player.h | 3 +++ src/player.c | 7 +++++++ test/legacy_player_test.c | 8 ++------ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/include/mobile/player.h b/include/mobile/player.h index 6335133..e1a9715 100644 --- a/include/mobile/player.h +++ b/include/mobile/player.h @@ -597,6 +597,8 @@ int player_get_volume(player_h player, float *left, float *right); * @since_tizen 2.3 * @remarks The default sound type of the player is #SOUND_TYPE_MEDIA. * To get the current sound type, use sound_manager_get_current_sound_type(). + * @remarks If stream_info already exists by calling sound_manager_create_stream_info(), + * It will return error since 3.0. * * @param[in] player The handle to the media player * @param[in] type The sound type @@ -604,6 +606,7 @@ int player_get_volume(player_h player, float *left, float *right); * otherwise a negative error value * @retval #PLAYER_ERROR_NONE Successful * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #PLAYER_ERROR_SOUND_POLICY Sound policy error * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create(). * @see sound_manager_get_current_sound_type() */ diff --git a/include/wearable/player.h b/include/wearable/player.h index 46e0a2d..c6f804d 100644 --- a/include/wearable/player.h +++ b/include/wearable/player.h @@ -596,6 +596,8 @@ int player_get_volume(player_h player, float *left, float *right); * @since_tizen 2.3.1 * @remarks The default sound type of the player is #SOUND_TYPE_MEDIA. * To get the current sound type, use sound_manager_get_current_sound_type(). + * @remarks If stream_info already exists by calling player_set_audio_policy_info(), + * It will return error. * * @param[in] player The handle to the media player * @param[in] type The sound type @@ -603,6 +605,7 @@ int player_get_volume(player_h player, float *left, float *right); * otherwise a negative error value * @retval #PLAYER_ERROR_NONE Successful * @retval #PLAYER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #PLAYER_ERROR_SOUND_POLICY Sound policy error * @pre The player state must be set to #PLAYER_STATE_IDLE by calling player_create(). * @see sound_manager_get_current_sound_type() */ diff --git a/src/player.c b/src/player.c index a3b92ce..c6bcb71 100644 --- a/src/player.c +++ b/src/player.c @@ -1409,6 +1409,13 @@ int player_set_sound_type(player_h player, sound_type_e type) PLAYER_STATE_CHECK(handle, PLAYER_STATE_IDLE); + bool sig_value = false; + + /* check if focus is released */ + mm_sound_get_signal_value(MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, &sig_value); + if(sig_value) + return PLAYER_ERROR_SOUND_POLICY; + LOGI("[%s] sound type = %d", __FUNCTION__, type); int ret = mm_player_set_attribute(handle->mm_handle, NULL, "sound_volume_type", type, (char *)NULL); diff --git a/test/legacy_player_test.c b/test/legacy_player_test.c index bae17b9..100c2f0 100644 --- a/test/legacy_player_test.c +++ b/test/legacy_player_test.c @@ -28,10 +28,6 @@ #include #include #endif -/* #define _USE_X_DIRECT_ */ -#ifdef _USE_X_DIRECT_ -#include -#endif #define PACKAGE "player_test" #define MAX_STRING_LEN 2048 #define MMTS_SAMPLELIST_INI_DEFAULT_PATH "/opt/etc/mmts_filelist.ini" @@ -131,7 +127,7 @@ static Evas_Object *create_win(const char *name) int w = 0; int h = 0; - printf("[%s][%d] name=%s\n", __func__, __LINE__, name); + g_print("[%s][%d] name=%s\n", __func__, __LINE__, name); eo = elm_win_add(NULL, name, ELM_WIN_BASIC); if (eo) { @@ -139,7 +135,7 @@ static Evas_Object *create_win(const char *name) elm_win_borderless_set(eo, EINA_TRUE); evas_object_smart_callback_add(eo, "delete,request", win_del, NULL); elm_win_screen_size_get(eo, NULL, NULL, &w, &h); - printf("window size :%d,%d", w, h); + g_print("window size :%d,%d", w, h); evas_object_resize(eo, w, h); elm_win_autodel_set(eo, EINA_TRUE); #ifdef HAVE_WAYLAND -- 2.7.4