if (bAppToFW) {
switch (nCode) {
- case PLAYER_INTERRUPTED_COMPLETED:
- return VP_MM_PLAYER_INTERRUPTED_COMPLETED;
- case PLAYER_INTERRUPTED_BY_MEDIA:
- return VP_MM_PLAYER_INTERRUPTED_BY_MEDIA;
- case PLAYER_INTERRUPTED_BY_CALL:
- return VP_MM_PLAYER_INTERRUPTED_BY_CALL;
- case PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG:
- return VP_MM_PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG;
- case PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT:
+ case PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT:
return VP_MM_PLAYER_INTERRUPTED_BY_RESOURCE_CONFLICT;
- case PLAYER_INTERRUPTED_BY_ALARM:
- return VP_MM_PLAYER_INTERRUPTED_BY_ALARM;
- case PLAYER_INTERRUPTED_BY_EMERGENCY:
- return VP_MM_PLAYER_INTERRUPTED_BY_EMERGENCY;
- //case PLAYER_INTERRUPTED_BY_RESUMABLE_MEDIA: return VP_MM_PLAYER_INTERRUPTED_RESUMABLE_MEDIA;
- case PLAYER_INTERRUPTED_BY_NOTIFICATION:
- return VP_MM_PLAYER_INTERRUPTED_NOTIFICATION;
}
} else {
switch (nCode) {
{
MMPlayer *pMMPlayer = NULL;
pMMPlayer = calloc(1, sizeof(MMPlayer));
-
if (pMMPlayer == NULL) {
VideoLogError("MMPlayer alloc fail");
return NULL;
vp_mm_player_destroy((mm_player_handle) pMMPlayer);
return NULL;
}
-
-
- nRet = player_set_sound_type(pMMPlayer->pPlayer, SOUND_TYPE_MEDIA);
- if (nRet != PLAYER_ERROR_NONE) {
- _vp_mm_player_print_err(nRet);
- }
// nRet = player_set_rich_audio(pMMPlayer->pPlayer);
// if (nRet != PLAYER_ERROR_NONE) {
// _vp_mm_player_print_err(nRet);
#include <sound_manager.h>
#include "vp-play-macro-define.h"
#include "vp-play-normal-view.h"
+#include "vp-play-view.h"
#include "vp-sound.h"
/* check temp */
/* internal functions */
/* external functions */
-bool vp_sound_init_session()
+
+void vp_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)
+{
+ PlayView *pPlayView = (PlayView *)user_data;
+
+ sound_stream_focus_state_e state_for_playback;
+ sound_stream_focus_state_e state_for_recording;
+ int ret = -1;
+ ret = sound_manager_get_focus_state(pPlayView->stream_info, &state_for_playback,
+ &state_for_recording);
+ if (state_for_playback == SOUND_STREAM_FOCUS_STATE_RELEASED) {
+ vp_play_view_unrealize(pPlayView);
+
+ if (reason_for_change != SOUND_STREAM_FOCUS_CHANGED_BY_ALARM &&
+ reason_for_change != SOUND_STREAM_FOCUS_CHANGED_BY_NOTIFICATION) {
+ sound_manager_get_focus_reacquisition(pPlayView->stream_info, &pPlayView->reacquire_state);
+ if (pPlayView->reacquire_state == EINA_TRUE) {
+ sound_manager_set_focus_reacquisition(pPlayView->stream_info, EINA_FALSE);
+ }
+ }
+ } else {
+ ret = vp_play_view_realize(pPlayView);
+ }
+}
+
+bool vp_sound_init_session(play_view_handle pViewHandle)
{
VideoLogInfo(">> Sound Session : Init");
+ PlayView *pPlayView = (PlayView *)pViewHandle;
int nRet = SOUND_MANAGER_ERROR_NONE;
- nRet = sound_manager_set_session_type(SOUND_SESSION_TYPE_MEDIA);
- if (nRet != SOUND_MANAGER_ERROR_NONE) {
- VideoLogError("sound_manager_set_session_type fail");
- return FALSE;
- }
+ if (!pPlayView->stream_info) {
+ nRet = sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, vp_player_focus_callback, pPlayView, &pPlayView->stream_info);
- nRet =
- sound_manager_set_media_session_option
- (SOUND_SESSION_OPTION_PAUSE_OTHERS_WHEN_START,
- SOUND_SESSION_OPTION_INTERRUPTIBLE_DURING_PLAY);
- if (nRet != SOUND_MANAGER_ERROR_NONE) {
- VideoLogError("sound_manager_set_media_session_option fail");
- return FALSE;
+ if (nRet != SOUND_MANAGER_ERROR_NONE) {
+ VideoLogError("failed to create_stream_information %x", nRet);
+ return FALSE;
+ }
}
nRet = sound_manager_set_current_sound_type(SOUND_TYPE_MEDIA);
return TRUE;
}
-bool vp_sound_deinit_session()
+bool vp_sound_deinit_session(play_view_handle pViewHandle)
{
int nRet = SOUND_MANAGER_ERROR_NONE;
-
+ PlayView *pPlayView = (PlayView *)pViewHandle;
// nRet = sound_manager_unset_safety_volume();
// if (nRet != SOUND_MANAGER_ERROR_NONE) {
// VideoLogError("sound_manager_unset_safety_volume fail");
// return FALSE;
// }
- nRet = sound_manager_unset_current_sound_type();
+ nRet = sound_manager_destroy_stream_information(pPlayView->stream_info);
if (nRet != SOUND_MANAGER_ERROR_NONE) {
VideoLogError("sound_manager_unset_current_sound_type fail");
return FALSE;
#include <stdbool.h>
#include <Elementary.h>
#include <net_connection.h>
+#include <sound_manager.h>
#include "vp-play-view.h"
#include "vp-play-type-define.h"
video_play_rotate_t nRotate;
video_sound_alive_t nSoundAlive;
video_play_list_type_t nListType;
+ sound_stream_info_h stream_info;
+ bool reacquire_state;
bool bPopupMode;
bool bTrimExit;
bool bRelaunchCaller;
#include <math.h>
+#include <sound_manager.h>
#include "vp-play-type-define.h"
#include "vp-play-string-define.h"
#include "vp-play-value-define.h"
VideoLogError("vp_mm_player_create fail");
return FALSE;
}
+ int nRet;
+ nRet = player_set_audio_policy_info(pNormalView->pPlayerHandle, pNormalView->pPlayView->stream_info);
+ if (nRet != PLAYER_ERROR_NONE) {
+ VideoLogError("unable to set sound policy [%x]", nRet);
+ }
if (!vp_mm_player_set_user_param(pNormalView->pPlayerHandle, (void *) pNormalView)) {
VideoLogError("vp_mm_player_set_user_param fail");
bool vp_play_view_realize(play_view_handle pViewHandle)
{
+ int error = SOUND_MANAGER_ERROR_NONE;
if (!pViewHandle) {
VideoLogError("PlayView handle is NULL");
return FALSE;
pPlayView->bVisible = TRUE;
vp_play_normal_view_key_create(pPlayView, pPlayView->pNormalView);
vp_play_normal_view_set_share_panel_state(pPlayView->pNormalView);
+ error = sound_manager_acquire_focus(pPlayView->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL);
+ if (error != SOUND_MANAGER_ERROR_NONE) {
+ VideoLogError("failed to acquire focus [%x]", error);
+ }
+
+ sound_manager_get_focus_reacquisition(pPlayView->stream_info, &pPlayView->reacquire_state);
+ if (pPlayView->reacquire_state == EINA_FALSE) {
+ sound_manager_set_focus_reacquisition(pPlayView->stream_info, EINA_TRUE);
+ }
if (pPlayView->bRealized == TRUE) {
VideoLogWarning("Already Realize state");
return TRUE;
#ifdef OLD_SENSOR_API
vp_sensor_realize(pPlayView->pSensorHandle);
#endif
- vp_sound_init_session();
+ vp_sound_init_session(pViewHandle);
vp_sound_set_route_change_cb(__vp_play_sound_route_change_cb, (void *)pPlayView);
vp_sound_set_volume_change_cb(__vp_play_sound_volume_change_cb, (void *)pPlayView);
bool vp_play_view_unrealize(play_view_handle pViewHandle)
{
+ int error = SOUND_MANAGER_ERROR_NONE;
if (!pViewHandle) {
VideoLogError("PlayView handle is NULL");
return FALSE;
vp_play_util_key_ungrab(pPlayView->pWin, VP_VOLUME_MUTE);
vp_play_util_key_ungrab(pPlayView->pWin, VP_HOME_KEY);
sound_manager_unset_current_sound_type();
+ error = sound_manager_release_focus(pPlayView->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL);
+ if (error != SOUND_MANAGER_ERROR_NONE) {
+ VideoLogError("failed to release focus error[%x]", error);
+ }
media_key_release();
int nDuration = 0;
if (vp_play_normal_view_get_video_duration(pPlayView->pNormalView, &nDuration)) {
// vp_device_display_deinit();
#endif
- vp_sound_deinit_session();
+ vp_sound_deinit_session(pPlayView);
if (pPlayView->bAVRCP) {
vp_avrcp_noti_player_state(VP_MM_PLAYER_STATE_STOP);