sound-manager API changed 07/101707/1 accepted/tizen/common/20161202.233206 accepted/tizen/ivi/20161207.025421 accepted/tizen/mobile/20161207.025312 accepted/tizen/tv/20161207.025340 accepted/tizen/wearable/20161207.025357 submit/tizen/20161202.035430
authoraravind.gara <aravind.gara@samsung.com>
Tue, 22 Nov 2016 12:59:07 +0000 (21:59 +0900)
committerKwangyoun Kim <ky85.kim@samsung.com>
Fri, 2 Dec 2016 04:50:30 +0000 (20:50 -0800)
Change-Id: I79c39cb073eb8741f24638408a5a2a6fbea4b667
Signed-off-by: aravind.gara <aravind.gara@samsung.com>
(cherry picked from commit e39fe363502ddd9e6093c999bbb11390683639a3)

server/ttsd_player.c

index 86fb8b4..11b5158 100644 (file)
@@ -94,7 +94,8 @@ player_s* __player_get_item(int uid)
        return NULL;
 }
 
-void __player_focus_state_cb(sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *extra_info, void *user_data)
+void __player_focus_state_cb(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_e focus_state,
+                                                       sound_stream_focus_change_reason_e reason_for_change, int sound_behavior, const char *extra_info, void *user_data)
 {
        SLOG(LOG_DEBUG, tts_tag(), "===== Focus state changed cb");
 
@@ -102,18 +103,9 @@ void __player_focus_state_cb(sound_stream_info_h stream_info, sound_stream_focus
                SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] Invalid stream info handle");
                return;
        }
+       SLOG(LOG_WARN, tts_tag(), "[Player] focus state changed to (%d) with reason(%d)", (int)focus_state, (int)reason_for_change);
 
-       int ret;
-       sound_stream_focus_state_e state_for_playback ;
-       ret = sound_manager_get_focus_state(g_stream_info_h, &state_for_playback, NULL);
-       if (SOUND_MANAGER_ERROR_NONE != ret) {
-               SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] Fail to get focus state");
-               return;
-       }
-
-       SLOG(LOG_WARN, tts_tag(), "[Player] focus state changed to (%d) with reason(%d)", (int)state_for_playback, (int)reason_for_change);
-
-       if (AUDIO_STATE_PLAY == g_audio_state && SOUND_STREAM_FOCUS_STATE_RELEASED == state_for_playback) {
+       if (AUDIO_STATE_PLAY == g_audio_state && focus_mask == SOUND_STREAM_FOCUS_FOR_PLAYBACK && SOUND_STREAM_FOCUS_STATE_RELEASED == focus_state) {
                if (TTSD_MODE_DEFAULT == ttsd_get_mode()) {
                        g_audio_state = AUDIO_STATE_READY;
        
@@ -207,7 +199,7 @@ static void __set_policy_for_playing(int volume)
        /* Set stream info */
        int ret;
        if (TTSD_MODE_DEFAULT == ttsd_get_mode()) {
-               ret = sound_manager_acquire_focus(g_stream_info_h, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL);
+               ret = sound_manager_acquire_focus(g_stream_info_h, SOUND_STREAM_FOCUS_FOR_PLAYBACK, SOUND_BEHAVIOR_NONE, NULL);
                if (SOUND_MANAGER_ERROR_NONE != ret) {
                        SLOG(LOG_WARN, tts_tag(), "[Player WARNING] Fail to acquire focus");
                }
@@ -225,7 +217,7 @@ static void __unset_policy_for_playing()
        int ret;
        /* Unset stream info */
        if (TTSD_MODE_DEFAULT == ttsd_get_mode()) {
-               ret = sound_manager_release_focus(g_stream_info_h, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL);
+               ret = sound_manager_release_focus(g_stream_info_h, SOUND_STREAM_FOCUS_FOR_PLAYBACK, SOUND_BEHAVIOR_NONE, NULL);
                if (SOUND_MANAGER_ERROR_NONE != ret) {
                        SLOG(LOG_WARN, tts_tag(), "[Player WARNING] Fail to release focus");
                }