From 3dd41e09fc74d8d1c425d3014060e80937429d54 Mon Sep 17 00:00:00 2001 From: Ismo Puustinen Date: Fri, 12 Oct 2012 16:46:31 +0300 Subject: [PATCH] Make ASM handling external. --- server/mm_sound_mgr_codec.c | 18 ++++++++++++++++++ server/mm_sound_mgr_session.c | 16 ++++++++++++++++ server/mm_sound_server.c | 2 ++ 3 files changed, 36 insertions(+) diff --git a/server/mm_sound_mgr_codec.c b/server/mm_sound_mgr_codec.c index 849de31..6860d42 100644 --- a/server/mm_sound_mgr_codec.c +++ b/server/mm_sound_mgr_codec.c @@ -241,8 +241,13 @@ int MMSoundMgrCodecPlay(int *slotid, const mmsound_mgr_codec_param_t *param) */ if(param->session_type != ASM_EVENT_CALL && param->session_type != ASM_EVENT_VIDEOCALL) { +#ifdef MURPHY + if(!ASM_register_sound((int)param->param, ¶m->session_handle, param->session_type, ASM_STATE_PLAYING, + sound_codec_asm_callback, (void*)*slotid, ASM_RESOURCE_NONE, &errorcode)) { +#else if(!ASM_register_sound_ex((int)param->param, ¶m->session_handle, param->session_type, ASM_STATE_PLAYING, sound_codec_asm_callback, (void*)*slotid, ASM_RESOURCE_NONE, &errorcode, __asm_process_message)) { +#endif debug_critical("ASM_register_sound() failed %d\n", errorcode); pthread_mutex_unlock(&g_slot_mutex); return MM_ERROR_POLICY_INTERNAL; @@ -286,7 +291,11 @@ int MMSoundMgrCodecPlay(int *slotid, const mmsound_mgr_codec_param_t *param) cleanup: if(param->session_type != ASM_EVENT_CALL && param->session_type != ASM_EVENT_VIDEOCALL && need_asm_unregister == 1) { +#ifdef MURPHY + if(!ASM_unregister_sound(param->session_handle, param->session_type, &errorcode)) { +#else if(!ASM_unregister_sound_ex(param->session_handle, param->session_type, &errorcode,__asm_process_message)) { +#endif debug_error("Unregister sound failed 0x%X\n", errorcode); return MM_ERROR_POLICY_INTERNAL; } @@ -358,8 +367,13 @@ int MMSoundMgrCodecPlayDtmf(int *slotid, const mmsound_mgr_codec_param_t *param) int need_asm_unregister = 0; if(param->session_type != ASM_EVENT_CALL && param->session_type != ASM_EVENT_VIDEOCALL) { +#ifdef MURPHY + if(!ASM_register_sound((int)param->param, ¶m->session_handle, param->session_type, ASM_STATE_PLAYING, + sound_codec_asm_callback, (void*)*slotid, ASM_RESOURCE_NONE, &errorcode)) { +#else if(!ASM_register_sound_ex((int)param->param, ¶m->session_handle, param->session_type, ASM_STATE_PLAYING, sound_codec_asm_callback, (void*)*slotid, ASM_RESOURCE_NONE, &errorcode, __asm_process_message)) { +#endif debug_critical("ASM_register_sound() failed %d\n", errorcode); pthread_mutex_unlock(&g_slot_mutex); return MM_ERROR_POLICY_INTERNAL; @@ -454,7 +468,11 @@ static int _MMSoundMgrCodecStopCallback(int param) if(g_slots[param].session_type != ASM_EVENT_CALL && g_slots[param].session_type != ASM_EVENT_VIDEOCALL) { debug_msg("[CODEC MGR] ASM unregister\n"); +#ifdef MURPHY + if(!ASM_unregister_sound(g_slots[param].session_handle, g_slots[param].session_type, &errorcode)) { +#else if(!ASM_unregister_sound_ex(g_slots[param].session_handle, g_slots[param].session_type, &errorcode, __asm_process_message)) { +#endif debug_error("[CODEC MGR] Unregister sound failed 0x%X\n", errorcode); } } diff --git a/server/mm_sound_mgr_session.c b/server/mm_sound_mgr_session.c index b0c743d..4318c4e 100644 --- a/server/mm_sound_mgr_session.c +++ b/server/mm_sound_mgr_session.c @@ -187,6 +187,7 @@ static void dump_info () /* ------------------------- ASM ------------------------------------*/ static pthread_mutex_t _asm_mutex = PTHREAD_MUTEX_INITIALIZER; +#ifndef MURPHY static bool _asm_register_for_headset (int * handle) { int asm_error = 0; @@ -252,6 +253,7 @@ static bool _asm_unregister_for_headset (int *handle) return true; } +#endif /* ------------------------- INTERNAL FUNCTIONS ------------------------------------*/ @@ -734,9 +736,11 @@ static void __handle_bt_a2dp_off (void) return; } +#ifndef MURPHY /* if bt was active, then do asm pause */ debug_msg("Do pause here"); _asm_pause_process (g_info.asm_handle); +#endif /* set bt device to none */ debug_msg("Deactivate BT_A2DP device\n"); @@ -808,9 +812,11 @@ static void __handle_headset_off (void) return; } +#ifndef MURPHY /* if bt was active, then do asm pause */ debug_msg("Do pause here"); _asm_pause_process (g_info.asm_handle); +#endif /* set bt device to none */ debug_msg("Deactivate WIRED IN/OUT device\n"); @@ -896,9 +902,11 @@ static void __handle_hdmi_off (void) return; } +#ifndef MURPHY /* if HDMI was active, then do asm pause */ debug_msg("Do pause here"); _asm_pause_process (g_info.asm_handle); +#endif /* set DOCK device to none */ debug_msg("Deactivate HDMIdevice\n"); @@ -937,9 +945,11 @@ static void __handle_wfd_off (void) return; } +#ifndef MURPHY /* if WFD was active, then do asm pause */ debug_msg("Do pause here"); _asm_pause_process (g_info.asm_handle); +#endif /* set WFD device to none */ debug_msg("Deactivate WFD device\n"); @@ -982,9 +992,11 @@ static void __handle_usb_audio_off (void) return; } +#ifndef MURPHY /* if device was active, then do asm pause */ debug_msg("Do pause here"); _asm_pause_process (g_info.asm_handle); +#endif /* set bt device to none */ debug_msg("Deactivate USB Audio device\n"); @@ -1470,10 +1482,12 @@ int MMSoundMgrSessionInit(void) /* FIXME: Initial status should be updated */ __set_initial_active_device (); +#ifndef MURPHY /* Register for headset unplug */ if (_asm_register_for_headset (&g_info.asm_handle) == false) { debug_error ("Failed to register ASM for headset\n"); } +#endif debug_fleave(); @@ -1487,8 +1501,10 @@ int MMSoundMgrSessionFini(void) debug_fenter(); +#ifndef MURPHY /* Unregister for headset unplug */ _asm_unregister_for_headset (&g_info.asm_handle); +#endif debug_fleave(); diff --git a/server/mm_sound_server.c b/server/mm_sound_server.c index c738b3b..11d3700 100644 --- a/server/mm_sound_server.c +++ b/server/mm_sound_server.c @@ -253,9 +253,11 @@ int main(int argc, char **argv) MMSoundMgrIpcInit(); pulse_handle = MMSoundMgrPulseInit(); +#ifndef MURPHY MMSoundMgrASMInit(); /* Wait for ASM Ready */ __wait_for_asm_ready(); +#endif _mm_sound_mgr_device_init(); MMSoundMgrHeadsetInit(); MMSoundMgrDockInit(); -- 2.7.4