diff options
author | Eunhae Choi <eunhae1.choi@samsung.com> | 2017-03-02 19:08:21 +0900 |
---|---|---|
committer | Eunhae Choi <eunhae1.choi@samsung.com> | 2017-03-03 12:20:08 +0900 |
commit | 7e017354e2824e47fd61aae8400d4defb752ed02 (patch) | |
tree | 2182a0ce35cee1762cca19a26b8e55f7aa89b2d6 | |
parent | 6dd243d2418834df392ececc7a85c18cdecbf261 (diff) | |
download | libmm-player-7e017354e2824e47fd61aae8400d4defb752ed02.tar.gz libmm-player-7e017354e2824e47fd61aae8400d4defb752ed02.tar.bz2 libmm-player-7e017354e2824e47fd61aae8400d4defb752ed02.zip |
[0.6.33] unregister internal focus when sound stream info is set
Change-Id: I759bf0c6981d39bf1e73348095176c90360e8852
-rw-r--r-- | packaging/libmm-player.spec | 2 | ||||
-rw-r--r-- | src/include/mm_player.h | 5 | ||||
-rw-r--r-- | src/mm_player.c | 18 | ||||
-rw-r--r-- | src/mm_player_sound_focus.c | 36 |
4 files changed, 27 insertions, 34 deletions
diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec index 5301f10..6e0f23b 100644 --- a/packaging/libmm-player.spec +++ b/packaging/libmm-player.spec @@ -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 diff --git a/src/include/mm_player.h b/src/include/mm_player.h index 90b890e..a35b5ef 100644 --- a/src/include/mm_player.h +++ b/src/include/mm_player.h @@ -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); + +/** @} */ diff --git a/src/mm_player.c b/src/mm_player.c index 341c859..0ef1b83 100644 --- a/src/mm_player.c +++ b/src/mm_player.c @@ -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; +} diff --git a/src/mm_player_sound_focus.c b/src/mm_player_sound_focus.c index 63f24ff..a36fb13 100644 --- a/src/mm_player_sound_focus.c +++ b/src/mm_player_sound_focus.c @@ -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 |