[0.6.33] unregister internal focus when sound stream info is set 20/117020/2
authorEunhae Choi <eunhae1.choi@samsung.com>
Thu, 2 Mar 2017 10:08:21 +0000 (19:08 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Fri, 3 Mar 2017 02:18:28 +0000 (11:18 +0900)
Change-Id: I759bf0c6981d39bf1e73348095176c90360e8852

packaging/libmm-player.spec
src/include/mm_player.h
src/mm_player.c
src/mm_player_sound_focus.c

index 28b8448..97a8295 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.32
+Version:    0.6.33
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 90b890e..a35b5ef 100644 (file)
@@ -2333,6 +2333,11 @@ int mm_player_release_video_stream_bo(MMHandleType player, void* bo);
 int mm_player_set_file_buffering_path(MMHandleType player, const char *file_path);
 
 /**
+ * This function is to set sound stream info
+ */
+int mm_player_set_sound_stream_info(MMHandleType player, char *stream_type, int stream_index);
+
+/**
        @}
  */
 
index 341c859..0ef1b83 100644 (file)
@@ -35,6 +35,7 @@
 #include "mm_player_capture.h"
 #include "mm_player_tracks.h"
 #include "mm_player_es.h"
+#include "mm_player_sound_focus.h"
 
 int mm_player_create(MMHandleType *player)
 {
@@ -1305,3 +1306,20 @@ int mm_player_set_file_buffering_path(MMHandleType player, const char *file_path
 
        return result;
 }
+
+int mm_player_set_sound_stream_info(MMHandleType player, char *stream_type, int stream_index)
+{
+       int result = MM_ERROR_NONE;
+
+       MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
+       MMPLAYER_RETURN_VAL_IF_FAIL((stream_type && (stream_index >= 0)), MM_ERROR_INVALID_ARGUMENT);
+
+       MMPLAYER_CMD_LOCK( player );
+
+       _mmplayer_sound_unregister(&((mm_player_t*)player)->sound_focus);
+       result = mm_player_set_attribute(player, NULL, "sound_stream_type", stream_type, strlen(stream_type), "sound_stream_index", stream_index, NULL);
+
+       MMPLAYER_CMD_UNLOCK( player );
+
+       return result;
+}
index 63f24ff..a36fb13 100644 (file)
@@ -41,42 +41,12 @@ do { \
 void __mmplayer_sound_signal_callback(mm_sound_signal_name_t signal, int value, void *user_data)
 {
        MMPlayerSoundFocus *sound_focus = (MMPlayerSoundFocus*)user_data;
-       int ret = MM_ERROR_NONE;
+       MMPLAYER_RETURN_IF_FAIL(sound_focus);
 
        LOGD("sound signal callback %d / %d", signal, value);
 
-       if (signal == MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS) {
-               if (value == 1) {
-                       /* unregister watch callback */
-                       if (sound_focus->watch_id > 0) {
-                               LOGD("unset the focus watch cb %d", sound_focus->watch_id);
-
-                               ret = mm_sound_unset_focus_watch_callback(sound_focus->watch_id);
-                               sound_focus->watch_id = 0;
-                               if (ret != MM_ERROR_NONE)
-                                       LOGE("failed to mm_sound_unset_focus_watch_callback()");
-                               /*
-                               if (sound_focus->subscribe_id > 0)
-                                       mm_sound_unsubscribe_signal(sound_focus->subscribe_id);
-                               */
-                       }
-                       /* unregister focus callback */
-                       if (sound_focus->focus_id > 0) {
-                               ret = mm_sound_unregister_focus(sound_focus->focus_id);
-                               sound_focus->focus_id = 0;
-                               if (ret != MM_ERROR_NONE)
-                                       LOGE("failed to mm_sound_unregister_focus() %d", sound_focus->focus_id);
-                       }
-                       /* unregister device connected callback */
-                       if (sound_focus->connected_id > 0) {
-                               LOGD("unset the device connected cb %d", sound_focus->connected_id);
-                               ret = mm_sound_remove_device_connected_callback(sound_focus->connected_id);
-                               sound_focus->connected_id = 0;
-                               if (ret != MM_ERROR_NONE)
-                                       LOGE("failed to mm_sound_remove_device_connected_callback()");
-                       }
-               }
-       }
+       if (signal == MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS && value == 1)
+               _mmplayer_sound_unregister(sound_focus);
 }
 
 static void