📄 ui_manager.c
字号:
/* **************************************************************************************
* Copyright (c) 2005 ZORAN Corporation, All Rights Reserved
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
* File: UI_Manager.c
*
* Description:
* ============
* UI Event Handler
* UIOP Mapping
* UIOP Menu Verifier
* UIOP Pre-Processing
* UIOP Translate
* UIOP Handler
*
****************************************************************************************/
#include "Config.h"
#ifdef DEBUG_UI_TRACE
#undef IFTRACE
#define IFTRACE if (gTraceUI)
#include "Debug\DbgMain.h"
#endif //DEBUG_UI_TRACE
#include "Include\SysDefs.h"
#include "Kernel\ker_api.h"
#include "Playcore\Coremain\coremain.h"
#include "Playcore\Coremain\coregdef.h"
#include "Kernel\eventdef.h"
#include "UI_Manager\UI_Input\ui_input.h"
#include "UI_Manager\UIOP_Lib\uiop_lib.h"
#include "menu\menu_operation_def.h"
#include "Setup\Setup_Menu.h"
#include "Screen\screenprocessing.h"
#include "GUI\menu_system\ms_operation_def.h"
#include "GUI\menu_system\ms_send_op.h"
#include "Playcore\Nav_DVD\Header\nav_err.h"
#ifndef D_GINGER_I96
#include "Playcore\Nav_CDDA\Cdnav_err.h"
#endif //D_GINGER_I96
#include "CoreAPI\CoreAPI.h"
#include "Playcore\Nav_DVD\Header\nav_err.h"
#include "Playcore\Nav_SVCD\nav_svcd.h"
#ifdef D_VDAC_MUTE_WHEN_HD_MODE
#include "Decoder\low_level\DEC_LL_VideoOut.h" //ZJS_HN_0011G [112905] : Video dac mute when HD mode.
#endif
#ifndef DEBUG_UI_TRACE
#undef dbg_printf(sMsg)
#define dbg_printf(sMsg)
#undef dbgm_printf(sMsg, mode)
#define dbgm_printf(sMsg, mode)
#endif
#ifdef USE_AUX_SUBTITLES
#ifdef D_GINGER_I96
#include "Playcore\Nav_Clips\AuxSubtitles\AuxSubtitles.h"
#else //D_GINGER_I96
#include "Playcore\Nav_Clips\AuxSubtitles.h"
#endif //D_GINGER_I96
#endif //USE_AUX_SUBTITLES
// Private Service Routines for UI Manager
static void _ui_core_error_handler(WORD wParam);
#ifdef D_VIDOUT_CONTROL_BY_HOTPLUG_ON_UI //<<< ZJS_HN_0009G [112805] : Video out is controlled by hot plug on the ui side.
BOOL HotPlugDetect = 0;
extern UINT16 Default_ScanMode;
#endif //D_VIDOUT_CONTROL_BY_HOTPLUG_ON_UI //>>> ZJS_HN_0009G [112805] : Video out is controlled by hot plug on the ui side.
#ifdef D_AUTO_POWER_OFF_AFTER_POWER_DOWN
static UINT16 wAutoPowerOffTimeOut;
#endif
/**********************************************************************************
* Name :
*
* Purpose :
*
* Input :
*
* Return Value :
*
* Description :
*
* Comments :
*
**********************************************************************************/
int UI_EventHandler(HDLR_OP op, EVENT event, void *param)
{
UINT16 wUIOP;
UINT32 lParam = 0;
if ((op == HDLR_ENTER) && IS_POWER_ON )
{
/* only get this message once at first call */
SETUP_M_OSDMenuLanguageInit();
SCREENPROC_OpenScreen();
return NULL;
}
event = UI_Input_Handler(event, (UINT32*)¶m);
switch ( event )
{
case IE_UI_STATE_CHANGE:
// Need to be more specific for each status change, with differnt event type
break;
// <<< Ram.wang_1125_05: modify I86_AV_RECEIVER FUNCTION LIKE AS THOMSON
#ifdef D_I86_AV_RECEIVER
case IE_CHANGE_WORKMODE:
UI_Change_Workmode(((BYTE)param));
break;
#endif
// >>> Ram.wang_1125_05
case IE_UI_INPUT:
wUIOP = (UINT16)param;
if ( UIOP_NONE == wUIOP )
break;
if(gcst.mKeyHold)
lParam |= MS_PARAM_OP_KEYHOLD;
// <<< Ram.wang_1125_05: modify I86_AV_RECEIVER FUNCTION LIKE AS THOMSON
#ifdef D_I86_AV_RECEIVER
if(UI_ProcessSourceKey(wUIOP))
break;
#ifdef D_TUNER_ENABLE
// If the subroute return TRUE, need *break*, mean some key
// use as radio function key in radio work mode.
if(UI_ProcessRadioKey(wUIOP))
break;
#endif //D_TUNER_ENABLE
#endif //D_I86_AV_RECEIVER
// >>> Ram.wang_1125_05
wUIOP = MS_SEND_OP(wUIOP, lParam);
if (( MS_OP_NONE == wUIOP ||!MS_IS_USER_OP(wUIOP))
&& MS_OP_POWER != wUIOP)
return 0;
//Translate special UIOPs
wUIOP = UI_UIOPInterpreter(wUIOP);
//When no media is ready, we handle here.
if (UI_FindInUIOPTable(wUIOP, (UINT16*)wUIOPTableProhibitIfMediaNotReady) && !CoreAPI_IsMediaReady())
{
PROHIBIT(MSG_PROHIBIT_DISC_NOT_READY);
return 0;
}
if (UI_FindInUIOPTable(wUIOP, (UINT16*)wUIOPTableSecretIfMediaNotReady) && !CoreAPI_IsMediaReady())
{
return 0;
}
// Finally, we call the UIOP Function in the UIOP Lib
if( NULL != oUIOPFunctionMapTbl[wUIOP & OPERATION_MASK])
(*oUIOPFunctionMapTbl[wUIOP & OPERATION_MASK])();
else
dbg_printf(("WARNING: NULL UIOP function.\n"));
break;
case IE_UI_TICK_100:
MS_SEND_OP(MS_OP_TICK, 0);
break;
case IE_UI_TRAY_PUSHED_IN:
MS_SEND_OP(MS_OP_EJECT, NULL);
break;
case IE_UI_PASSWORD_CHECK_REQUEST:
MS_SEND_OP(MS_OP_CORE_PASSWORD_CHECK_REQUEST, NULL);
break;
case IE_UI_PASSWORD_TIME_OUT:
MS_SEND_OP(MS_OP_CORE_PASSWORD_TIME_OUT, NULL);
break;
case IE_UI_FP_UPDATE_ERROR:
MS_SEND_OP(MS_OP_CORE_FP_UPDATE_ERROR, NULL);
break;
case IE_UI_REFRESH_DEVICE_LIST:
MS_SEND_OP(MS_OP_CORE_REFRESH_DEVICE_LIST, (UINT32)param);
break;
#ifdef I86_USB_SUPPORT
case IE_UI_UNSUPPORT_USB_DEVICE_INSERTED:
MS_SEND_OP(MS_OP_CORE_UNSUPPORT_USB_DEVICE_INSERTED, (UINT32)param);
break;
#endif //SUPPORT_FLASH_CARD
#ifdef FTA_SUPPORT
case IE_UI_FTA_SCANNING_DONE:
MS_SEND_OP(MS_OP_CORE_FTA_SCANNING_DONE, (UINT32)param);
break;
#endif
#if defined(D_HDMI_ENABLED)||defined(D_HD_COMPONENT_ENABLED)
case IE_UI_HDMI_PLUG_IN_OUT:
#ifdef D_VIDOUT_CONTROL_BY_HOTPLUG_ON_UI //<<< ZJS_HN_0009G [112905] : Video out is controlled by hot plug on the ui side.
HotPlugDetect = (BOOL)param;
if(!HotPlugDetect)
{
CoreAPI_SetVideoOutMode(Default_ScanMode);
}
else
{
#ifdef D_VDAC_MUTE_WHEN_HD_MODE //<<< ZJS_HN_0011G [112905] : Video dac mute when HD mode.
CoreAPI_UpdatePlayerSetting(PS_UPDATE_VDAC_CONTROL, (BYTE)DAC_MUTE_ALL);
#endif //D_VDAC_MUTE_WHEN_HD_MODE //>>> ZJS_HN_0011G [112905] : Video dac mute when HD mode.
}
MS_SEND_OP(MS_OP_CORE_HDMI_PLUG_INOUT, NULL);
#else
MS_SEND_OP(MS_OP_CORE_HDMI_PLUG_INOUT, NULL);
#endif //D_VIDOUT_CONTROL_BY_HOTPLUG_ON_UI //>>> ZJS_HN_0009G [112905] : Video out is controlled by hot plug on the ui side.
break;
#endif
case IE_UI_FUPGRADE_REQUEST:
MS_SEND_OP(MS_OP_CORE_FUPGRADE_REQUEST,NULL);
break;
case IE_UI_REPORT_ERROR:
dbg_printf(("Core Error Reported: %x",(UINT32)param));
_ui_core_error_handler((WORD)param);
break;
#ifdef USE_AUX_SUBTITLES
case IE_UI_START_DISPLAY_AUX_SUBTITLE:
MS_SEND_OP(MS_OP_CORE_START_DISPLAY_AUX_SUBTITLE,NULL);
#ifdef D_GINGER_I96
AuxSubtitles_UnlockStringBuffer();
#else //D_GINGER_I96
unlockAuxSubtitlesStringBuffer();
#endif //D_GINGER_I96
break;
case IE_UI_STOP_DISPLAY_AUX_SUBTITLE:
MS_SEND_OP(MS_OP_CORE_STOP_DISPLAY_AUX_SUBTITLE,NULL);
break;
#endif //USE_AUX_SUBTITLES
#ifdef AVI_DRM_SUPPORT
case IE_UI_DIVX_MSG_AUTHORIZATION_ERROR:
MS_SEND_OP(MS_OP_CORE_DIVX_AUTHORIZATION_ERROR,NULL);
break;
case IE_UI_DIVX_MSG_RENTAL_EXPIRED:
MS_SEND_OP(MS_OP_CORE_DIVX_RENTAL_EXPIRED,NULL);
break;
case IE_UI_DIVX_RENTAL_CONFIRM:
MS_SEND_OP(MS_OP_CORE_DIVX_RENTAL_CONFIRM,NULL);
break;
case IE_UI_CLOSE_MENU:
MS_SEND_OP(MS_OP_CORE_CLOSE_DRM_MENU,NULL);
break;
#ifdef D_VCR_DRM_UI_NOTIFICATION // <<< ITA_KK_0006G: Added notice of DRM ON or OFF.
case IE_UI_DIVX_DRM_ON:
tr_printf(("--- DRM ON\n")); // test code
break;
case IE_UI_DIVX_DRM_OFF:
tr_printf(("--- DRM OFF\n")); // test code
break;
#endif // >>> ITA_KK_0006G: Added notice of DRM ON or OFF
#endif //AVI_DRM_SUPPORT
#ifdef D_DIVX6_SUPPORT
case IE_UI_ROOT_MENU_REQUEST:
MS_SEND_OP(MS_OP_CORE_DIVX6_ROOT_MENU_REQUEST,NULL);
break;
#endif
#if defined( D_VCR_DRM_UI_NOTIFICATION) || defined(D_RESUME_STOP_AFTER_POWER_ON) // <<< ITA_KK_0002G: Customized of the power on action.
case IE_UI_MSG_PLAYSTATE_RESUME_STOP:
//MS_SEND_OP(MS_OP_STOP, 0);
MS_SendOp(MS_OP_MSG_PLAYSTATE_STOP_RESUME, 0);
break;
case IE_UI_MSG_PLAYSTATE_STOP:
//MS_SEND_OP(MS_OP_STOP, 0);
MS_SendOp(MS_OP_MSG_PLAYSTATE_STOP, 0);
break;
#endif
#if D_SUPPORT_SACD
case IE_UI_TRACK_UPDATE:
MS_SendOp(MS_OP_CORE_SACD_TRACK_UPDATE, 0);
break;
case IE_UI_SACD_AREA_CHANGED:
MS_SendOp(MS_OP_CORE_SACD_AREA_CHANGED, 0);
break;
case IE_UI_SWITCH_SACD_LAYER:
MS_SendOp(MS_OP_CORE_SACD_SWITCH_LAYER, 0);
break;
#endif // D_SUPPORT_SACD
case IE_UI_TICK_ONE_SEC:
#ifdef D_PORTABLE_DVD_POWER
if(BATTERY_EMPTY == CoreAPI_GetBatteryState())
{
CoreAPI_PowerControl(FALSE);
CoreAPI_PowerOff();
}
#endif
break;
// default:
// tr_printf(("Warnning: Unkonw UI Events %04x \n", event));
// break;
}
return 0;
}
static void _ui_core_error_handler(WORD wParam)
{
switch(wParam & ERROR_BASE_MASK)
{
case DVDNAV_ERROR_BASE:
MS_SendOp(MS_OP_MSG_ERROR_DVDNAV, wParam);
break;
default:
break;
}
}
#ifdef D_GINGER_I86
#pragma argsused
int UI_NullEventHandler(HDLR_OP op, EVENT event, void *param)
{
static UINT8 __RAMTYPE cPowerCounter = 0;
UINT8 cIndex;
if ((op == HDLR_ENTER) )
{
return NULL;
}
if ((!IS_POWER_ON) )
{
if (( IE_UI_TICK_100 == event ) )
{
if (cPowerCounter < POWER_DOWN_TIME)
{
cPowerCounter++;
//tr_printf(("\n\r count:%x power:%x\n\r",cPowerCounter,g_power_state));
}
else
{
cPowerCounter = 0;
tr_printf(("\n\r snd power down in UI power:%x\n\r",g_power_state));
//remove all UI handler, just run this code only once
for (cIndex=0; cIndex<MAX_UI_HANDLER; cIndex++)
{
remove_ui_event_handler(cIndex);
}
ie_send_ex(IE_CORE_CMD_POWER,(void*)1);
}
return NULL;
}
else
return NULL;
}
return NULL;
}
#endif //D_GINGER_I86
#pragma argsused
int UI_PowerOffHandler(HDLR_OP op, EVENT event, void *param)
{
UINT16 wUIOP;
if ((op == HDLR_ENTER) )
{
#ifdef D_AUTO_POWER_OFF_AFTER_POWER_DOWN
wAutoPowerOffTimeOut = AUTO_POWEROFF_TIMEOUT_MINUTE*60;
#endif
return NULL;
}
event = UI_Input_Handler(event, (UINT32*)¶m);
switch (event)
{
case IE_UI_INPUT:
wUIOP = (UINT16)param;
switch (wUIOP)
{
case MS_OP_POWER:
ie_send_ex(IE_CORE_CMD_POWER,(void*)0);
break;
#ifdef D_EJECT_WAKE_UP
/* EJECT key to wake up from standby and eject */
case MS_OP_EJECT:
ie_send_ex(IE_CORE_CMD_EJECT,(void*)0);
#endif // D_EJECT_WAKE_UP
default:
//tr_printf(("\n\runknown UICC:%x ",wUICC));
break;
}
break;
#ifndef I96_CPU_POWER_DOWN
case IE_UI_TICK_200: //for power off POWER KEY
_KeyScanHandler();
break;
#endif
case IE_UI_TICK_ONE_SEC:
#ifdef D_AUTO_POWER_OFF_AFTER_POWER_DOWN
wAutoPowerOffTimeOut--;
if(0 == wAutoPowerOffTimeOut)
CoreAPI_PowerOff();
#endif
break;
default:
break;
}
return NULL;
}
#if 0// defined( D_VCR_DRM_UI_NOTIFICATION) || defined(D_RESUME_STOP_AFTER_POWER_ON) // <<< ITA_KK_0002G: Customized of the power on action.
void power_on_resume_stop(void)
{
MS_SendOp(MS_OP_MSG_PLAYSTATE_STOP_RESUME, 0);
}
#endif // <<< ITA_KK_0002G: Customized of the power on action.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -