Fixed Sound Manager API Change 44/101444/4 submit/tizen_3.0/20161202.035416
authorbhutani.92 <bhutani.92@samsung.com>
Thu, 1 Dec 2016 07:42:59 +0000 (13:12 +0530)
committerAkhil Bhutani <bhutani.92@samsung.com>
Fri, 2 Dec 2016 09:33:00 +0000 (01:33 -0800)
Change-Id: I4fb7c837c584d8657a776b0c957078c68219eea7
Signed-off-by: bhutani.92 <bhutani.92@samsung.com>
src/core/mp-player-mgr.c

index 1ccd98e..f1a8f1c 100644 (file)
@@ -778,8 +778,7 @@ mp_player_mgr_play(void *data)
 
        PLAYER_ENTER_LOG("start");
        if (ad->stream_info) {
-               const char *str = "music_playing";
-               error = sound_manager_acquire_focus(ad->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, str);
+               error = sound_manager_acquire_focus(ad->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, SOUND_BEHAVIOR_NONE, NULL);
                if (error != SOUND_MANAGER_ERROR_NONE) {
                        ERROR_TRACE("failed to acquire focus [%x]", error);
                }
@@ -823,7 +822,7 @@ mp_player_mgr_stop(void *data)
        PLAYER_ENTER_LOG("stop");
        int res = g_player_apis.stop(_player);
        if (ad->stream_info) {
-               int error = sound_manager_release_focus(ad->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL);
+               int error = sound_manager_release_focus(ad->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, SOUND_BEHAVIOR_NONE, NULL);
                if (error != SOUND_MANAGER_ERROR_NONE) {
                        ERROR_TRACE("failed to release focus error[%x]", error);
                }
@@ -875,8 +874,7 @@ mp_player_mgr_resume(void *data)
                        ERROR_TRACE("failed in sound_manager_get_focus_state");
                }
                if (state_for_playback != SOUND_STREAM_FOCUS_STATE_ACQUIRED) {
-                       const char *str = "music_playing";
-                       error = sound_manager_acquire_focus(ad->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, str);
+                       error = sound_manager_acquire_focus(ad->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, SOUND_BEHAVIOR_NONE, NULL);
                        if (error != SOUND_MANAGER_ERROR_NONE) {
                                ERROR_TRACE("failed to acquire focus [%x]", error);
                                return error;
@@ -927,7 +925,7 @@ mp_player_mgr_pause(void *data)
        PLAYER_ENTER_LOG("pause");
        err = g_player_apis.pause(_player);
        if (ad->stream_info) {
-               error = sound_manager_release_focus(ad->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL);
+               error = sound_manager_release_focus(ad->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, SOUND_BEHAVIOR_NONE, NULL);
                if (error != SOUND_MANAGER_ERROR_NONE) {
                        ERROR_TRACE("failed to release focus error[%x]", error);
                }
@@ -1133,8 +1131,9 @@ mp_player_mgr_safety_volume_set(int foreground)
        return 0;
 }
 
-void mp_player_focus_callback(sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change,
-                                       const char *additional_info, void *user_data)
+void mp_player_focus_callback(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_behaviors, const char *extra_info, void *user_data)
 {
        startfunc;
        struct appdata *ad = user_data;
@@ -1148,9 +1147,6 @@ void mp_player_focus_callback(sound_stream_info_h stream_info, sound_stream_focu
                ERROR_TRACE("failed in sound_manager_get_focus_state");
        }
 
-       int req_flag = SOUND_BEHAVIOR_NONE;
-       sound_manager_focus_get_requested_behavior(ad->stream_info, &req_flag);
-
        if (state_for_playback == SOUND_STREAM_FOCUS_STATE_RELEASED) {
                mp_player_mgr_pause(ad);
 
@@ -1163,12 +1159,10 @@ void mp_player_focus_callback(sound_stream_info_h stream_info, sound_stream_focu
                        sound_manager_set_focus_reacquisition(ad->stream_info, EINA_TRUE);
                } else if (reason_for_change != SOUND_STREAM_FOCUS_CHANGED_BY_ALARM &&
                                reason_for_change != SOUND_STREAM_FOCUS_CHANGED_BY_NOTIFICATION) {
-                       if (!g_strcmp0(additional_info, "music_playing")) {
-                               sound_manager_set_focus_reacquisition(ad->stream_info, EINA_FALSE);
-                       } else if (reacquire_state == EINA_TRUE) {
+                       if (reacquire_state == EINA_TRUE) {
                                sound_manager_set_focus_reacquisition(ad->stream_info, EINA_FALSE);
                        }
-               } else if (req_flag & SOUND_BEHAVIOR_NO_RESUME) {
+               } else if (sound_behaviors & SOUND_BEHAVIOR_NO_RESUME) {
                        sound_manager_set_focus_reacquisition(ad->stream_info, EINA_FALSE);
                }
        } else {
@@ -1202,7 +1196,7 @@ mp_player_mgr_session_init(void)
                ret = sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, mp_player_focus_callback, ad, &ad->stream_info);
 
                if (ret != SOUND_MANAGER_ERROR_NONE) {
-                       EVENT_TRACE("failed to create_stream_information %x", ret);
+                       EVENT_TRACE("failed to create_stream_information [%x]", ret);
                        return FALSE;
                }
        }