?? o_dvdvr.c
字號(hào):
/* **************************************************************************************
* Copyright (c) 2004 ZORAN Corporation, All Rights Reserved
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
* File: $Workfile: o_dvdvr.c $
*
* Description:
* ============
* Project definition of the MSO_DVDVR component
*
****************************************************************************************/
#include "Config.h" // Global Configuration - do not remove!
#ifdef D_GUI_COMPONENT_DVDVR
#ifdef DEBUG_UI_TRACE
#undef IFTRACE
#define IFTRACE if (gTraceUI)
#include "Debug\DbgMain.h"
#endif //DEBUG_UI_TRACE
#include "Include\SysDefs.h"
/***************************************************************************************
* Include files
****************************************************************************************/
#include <stdio.h>
#include <string.h>
#include "include\math-macro.h"
#include "CoreAPI\CoreAPI.h"
#include "CoreAPI\DeviceManager.h"
#include "Library\Container_misc.h"
#include "Library\String_generate.h"
#include "Library\Number.h"
#include "GUI\Menu_system\ms_object.h"
#include "gui\menu_system\osd_rendering.h"
#include "gui\menu_system\ms_display.h"
#include "GUI\Menu_system\ms_screen.h"
#include "GUI\Menu_system\ms_component.h"
#include "GUI\Object_class\Button\mso_button.h"
#include "GUI\Object_class\Text\mso_text.h"
#include "GUI\Object_class\Hscroll\mso_hscroll_text.h"
#include "GUI\Object_class\Vlist\mso_vlist.h"
#include "GUI\Resource\Bitmap\bitmap.h"
#include "Menu\menu_operation_def.h"
#include "Menu_config\menu_config_common.h"
#include "Components\Dvdvr\o_dvdvr.h"
#include "Components\Dvdvr\o_dvdvr_config.h"
#include "Components\Custom\Dvdvr\o_dvdvr_custom.h"
#ifndef DEBUG_UI_TRACE
#undef dbg_printf(sMsg)
#define dbg_printf(sMsg)
#undef dbgm_printf(sMsg, mode)
#define dbgm_printf(sMsg, mode)
#endif //DEBUG_UI_TRACE
/***************************************************************************************
* Utility functions
****************************************************************************************/
STATIC PGC_TYPE _GetProgramChainType(void);
STATIC BOOL _DisplayActiveTitle(void);
STATIC void _ResetActiveTitleFlag(void);
STATIC void _GetDiscName(FORMATED_UNICODE_STRING __NEAR* pFormUniStr, UINT32 wParam);
STATIC void _GetPlayTitle(FORMATED_UNICODE_STRING __NEAR* pFormUniStr, UINT32 wParam);
/***************************************************************************************
* Operation functions
****************************************************************************************/
STATIC MS_OP _ProgramChainOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _PlayTitleOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _ListItemOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _BrowserScrollListOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _HelpTextOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _DVDVROperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
/***************************************************************************************
* Display functions
****************************************************************************************/
STATIC BOOL _DVDVRFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
STATIC BOOL _ListItemFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
#include "Components\Custom\Dvdvr\o_dvdvr_custom.c"
#include "Components\Dvdvr\o_dvdvr_config.c"
/* Macros for the MSO_PLAYTITLE object */
#define _MakePlayTitleParam(_CurrentTitle_, _TotalTitles_) (((UINT32)_CurrentTitle_ << 16) | _TotalTitles_)
#define _GetCurrentTitleFromParam(_Param_) ((UINT16)(_Param_ >> 16))
#define _GetTotalTitlesFromParam(_Param_) ((UINT16)_Param_)
/* Macros for the MSO_DVDVR_LISTITEM objects */
#define _MakeListItemParam(_Index_, _IsPlaying_) (((UINT32)_Index_ << 16) | _IsPlaying_)
#define _GetIndexFromParam(_Param_) ((UINT16)(_Param_ >> 16))
#define _GetIsPlayingStatusFromParam(_Param_) ((BOOL)(_Param_ && 0xFFFF))
/***************************************************************************************
* Utility functions
****************************************************************************************/
/***************************************************************************************
* Function : _GetProgramChainType
*
* In : None.
*
* Out : eProgramChain_Original if the DVD-VR component is displaying the original program
* chain.
*
* Desc : Returns the type of program chain that is being currently displayed in the Browser list..
****************************************************************************************/
STATIC PGC_TYPE _GetProgramChainType(void)
{
MSO_DVDVR __NEAR* pDVDVRWindow = (MSO_DVDVR __NEAR*)MS_FindDescendant(gpScreen, &oDVDVRDescriptor);
if(NULL != pDVDVRWindow)
return pDVDVRWindow->moParam.mcProgramChain;
return FALSE;
}
/***************************************************************************************
* Function : _DisplayActiveTitle
*
* In : None.
*
* Out : TRUE if the Browser list should display active title.
*
* Desc : The Browser list displays the active title if this function returns TRUE.
****************************************************************************************/
STATIC BOOL _DisplayActiveTitle(void)
{
MSO_DVDVR __NEAR* pDVDVRWindow = (MSO_DVDVR __NEAR*)MS_FindDescendant(gpScreen, &oDVDVRDescriptor);
if(NULL != pDVDVRWindow)
return pDVDVRWindow->moParam.mbDisplayActiveItem;
return FALSE;
}
/***************************************************************************************
* Function : _ResetActiveTitleFlag
*
* In : None.
*
* Out : None.
*
* Desc : Resets the mbDisplayActiveItem flag of MSO_DVDVR.
****************************************************************************************/
STATIC void _ResetActiveTitleFlag(void)
{
MSO_DVDVR __NEAR* pDVDVRWindow = (MSO_DVDVR __NEAR*)MS_FindDescendant(gpScreen, &oDVDVRDescriptor);
if(NULL != pDVDVRWindow)
pDVDVRWindow->moParam.mbDisplayActiveItem = FALSE;
}
/***************************************************************************************
* Function : _GetDiscName
*
* In : 1. pFormUniStr = Pointer to structure that holds the formatted Unicode string.
* 2. wParam = Contains the current playing track in the HIWORD, and the
* total number of tracks in the LOWORD.
*
* Out : None.
*
* Desc : This function builds the unicode formatted string which would display the DVD-VR
* disc name.
****************************************************************************************/
#pragma argsused
STATIC void _GetDiscName(FORMATED_UNICODE_STRING __NEAR* pFormUniStr, UINT32 wParam)
{
UINT8 cWordsWritten = STR_GenerateOSDMESSAGEString(S_DVD_VR, pFormUniStr->mszUniStr, 0, UNISTR_LENGTH_MAX);
// Tag a colon, and a space on the end.
pFormUniStr->mszUniStr[cWordsWritten++] = L':';
pFormUniStr->mszUniStr[cWordsWritten++] = UNICODE_SPACE;
STR_GenerateDiscName(pFormUniStr->mszUniStr, cWordsWritten, (UNISTR_LENGTH_MAX - cWordsWritten));
// Reformat the unicode string.
OSDR_FormatUniString(pFormUniStr);
}
/***************************************************************************************
* Function : _GetPlayTitle
*
* In : 1. pFormUniStr = Pointer to structure that holds the formatted Unicode string.
* 2. wParam = Contains the current playing title in the HIWORD, and the
* total number of titles in the LOWORD.
* Out : None.
*
* Desc : This function builds the unicode formatted string which would display the current
* playing title, and the total number of titles in the current program chain.
****************************************************************************************/
#pragma argsused
STATIC void _GetPlayTitle(FORMATED_UNICODE_STRING __NEAR* pFormUniStr, UINT32 wParam)
{
STR_GenerateNumericAndTotalNumeric(_GetCurrentTitleFromParam(wParam), _GetTotalTitlesFromParam(wParam),
pFormUniStr->mszUniStr, 0, UNISTR_LENGTH_MAX + 1);
OSDR_FormatUniString(pFormUniStr);
}
/***************************************************************************************
* Operation functions
****************************************************************************************/
/***************************************************************************************
* Function : _ProgramChainOperation
*
* In :
*
* Out :
*
* Desc : MSO_PROGRAM_CHAIN user operation function.
****************************************************************************************/
STATIC MS_OP _ProgramChainOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
// Pre-processing
switch(MsOp)
{
case MS_OP_TICK:
{
MSO_PROGRAM_CHAIN __NEAR* pProgramChain = (MSO_PROGRAM_CHAIN __NEAR*)pThis;
PGC_TYPE tProgramChain = _GetProgramChainType();
if(tProgramChain != pProgramChain->moParam.mtProgramChain)
{
OSD_MESSAGES osdProgramChain = (PGC_TYPE_ORIGINAL == tProgramChain) ? S_PROGRAM_LIST : S_PLAY_LIST;
pProgramChain->moParam.mtProgramChain = tProgramChain;
MS_SendOperation(pThis, MS_OP_BUILD_TEXT_STRING, osdProgramChain);
MS_DisplayAddObject(pThis);
}
}
break;
default:
break;
}
MsOp = OTEXT_Operation(pThis, MsOp, lParam);
// Post-processing.
switch(MsOp)
{
case MS_OP_INIT: // Fall Through !!!
case MS_OP_ON_DEFROST:
{
MSO_PROGRAM_CHAIN __NEAR* pProgramChain = (MSO_PROGRAM_CHAIN __NEAR*)pThis;
pProgramChain->moParam.mtProgramChain = PGC_TYPE_NONE;
}
break;
default:
break;
}
return MsOp;
}
/***************************************************************************************
* Function : _PlayTitleOperation
*
* In :
*
* Out :
*
* Desc : MSO_PLAYTITLE user operation function.
****************************************************************************************/
STATIC MS_OP _PlayTitleOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
// Pre-processing
switch(MsOp)
{
case MS_OP_TICK:
{
PGC_TYPE tProgramChain = _GetProgramChainType();
// Display current/total titles if the following conditions hold true:
// 1. The current play state is not full stop state.
// 2. The active item belongs to the orginal/user defined program chain if the original/user define
// program chain is currently displayed in the Browser list respectively.
if(!CoreAPI_IsFullStop()
&& (((PGC_TYPE_ORIGINAL == tProgramChain) && CoreAPI_DVDVRIsPGPlaying())
|| ((PGC_TYPE_USERDEFINED == tProgramChain) && !CoreAPI_DVDVRIsPGPlaying())))
{
MSO_PLAYTITLE __NEAR* pPlayTitle = (MSO_PLAYTITLE __NEAR*)pThis;
UINT16 wCurrentTitle = (PGC_TYPE_ORIGINAL == tProgramChain) ? CoreAPI_GetDVDVRCurrtProgramNum() : CoreAPI_GetDVDVRCurrentPlayListNum();
UINT16 wTotalTitles = (PGC_TYPE_ORIGINAL == tProgramChain) ? CoreAPI_GetDVDVRMaxProgramNum() : CoreAPI_GetDVDVRMaxPlayListNum();
if((wCurrentTitle != pPlayTitle->moParam.mwTitleCurrent) || (wTotalTitles != pPlayTitle->moParam.mwTitlesTotal) || MS_IsInvisible(pThis))
{
pPlayTitle->moParam.mwTitleCurrent = wCurrentTitle;
pPlayTitle->moParam.mwTitlesTotal = wTotalTitles;
MS_SendOperation(pThis, MS_OP_BUILD_TEXT_STRING, _MakePlayTitleParam(pPlayTitle->moParam.mwTitleCurrent, pPlayTitle->moParam.mwTitlesTotal));
MS_ClearInvisible(pThis);
MS_DisplayAddObject(pThis);
}
}
else
{
if(!MS_IsInvisible(pThis))
{
MS_SetInvisible(pThis);
MS_DisplayAddObject(pThis);
}
}
}
break;
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -