📄 o_playmode.c
字号:
/* **************************************************************************************
* Copyright (c) 2004 ZORAN Corporation, All Rights Reserved
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
* File: $Workfile: o_playmode.c $
*
* Description:
* ============
* Project definition of the MSO_PLAYMODE
*
****************************************************************************************/
#include "Config.h" // Global Configuration - do not remove!
#ifdef D_GUI_COMPONENT_PLAYMODE
#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 "Kernel\eventdef.h"
#include "include\math-macro.h"
#include "Playcore\ScPad\SCMGR.h"
#include "Playcore\Coremain\Coremain.h"
#include "Playcore\Coremain\CoreGDef.h"
#include "Playcore\PlayMode\playmode.h"
#include "CoreAPI\CoreAPI.h"
#include "CoreAPI\DeviceManager.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\Edit\mso_edit.h"
#include "GUI\Object_class\Vlist\mso_vlist.h"
#include "GUI\Object_class\Choice\mso_choice.h"
//#include "Components\Playmode\o_playmode.h"
#include "GUI\Resource\Bitmap\bitmap.h"
#include "Menu\menu_operation_def.h"
#include "Menu_config\menu_config_common.h"
// Include the module header file
#include "Components\Playmode\o_playmode.h"
// Include configuration header file: named constants, macros and typedefs.
#include "Components\Playmode\o_playmode_config.h"
// Include custom header file: customer specific definitions, over-writing common ones.
#include "Components\Custom\Playmode\o_playmode_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
/***************************************************************************************
* Private static variable declaration ARE FORBIDDEN under normal circumstances.
****************************************************************************************/
static UI_PROGRAM_LIST sUIProgramList = {0};
/***************************************************************************************
* _PROGRAM_LIST related functions
****************************************************************************************/
static UINT8 _GetUIProgramListSize(void);
//static BOOL _AddEntryToUIProgramList(UINT8 cIndex, UINT16 wValue);
static BOOL _ModifyUIProgramListEntry(UINT8 cIndex, UINT16 wValue);
static BOOL _RemoveEntryFromUIProgramList(UINT8 cIndex);
//static void _RemoveLastEntryFromUIProgramList(void);
static UINT16 _GetEntryFromUIProgramList(UINT8 cIndex);
static void _SetCoreProgramList(void);
static BOOL _IsValidTrackInUIProgramList(UINT8 cTrackIndex);
static BOOL _IsSupportedDVDMediaType(void);
/***************************************************************************************
* Utility functions
****************************************************************************************/
static BOOL _AddItemsToPlayModeKit(MSO_VLIST __NEAR* pList, BOOL bInitializeEntires);
static BOOL _AddEntriesToProgramList(MSO_VLIST __NEAR* pList);
static void _ProgramItemGetValue(FORMATED_UNICODE_STRING __NEAR* pFormUniStr, UINT32 wParam);
static void _SetPlayMode(MSO_PLAYMODE __NEAR* pPlayMode, BOOL bSetProgramMode);
static UINT16 _GetPlayModeInCore(void);
static void _SetRepeat(MSO_PLAYMODE __NEAR* pPlayMode);
STATIC BOOL _IsTrackEntryValid(MSO_PROGRAM_ENTRY __NEAR* pProgramEntry);
STATIC BOOL _IsTitleChapterValid(MSO_DVD_PROGRAM_ENTRY __NEAR* pProgramEntry);
/***************************************************************************************
* Operation functions
****************************************************************************************/
STATIC MS_OP _ClearProgramButtonOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _PlayProgramButtonOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _PlaymodeOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _PlaymodeKitOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _ProgramVListOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _PlaymodekitVlistOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _ProgramKitOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _ProgramEntryOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _DVDProgramTitleEntryOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _DVDProgramChapterEntryOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _DVDProgramEntryOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
/***************************************************************************************
* Display functions
****************************************************************************************/
STATIC BOOL _PlaymodeFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
STATIC BOOL _ProgramEntryFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
STATIC BOOL _DVDProgramEntryFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
/***************************************************************************************
* Choice item action functions
****************************************************************************************/
STATIC void _PlayModeChoiceAction(MSO_OBJECT __NEAR* pThis, enMutatorType eType, UINT16 wValue);
STATIC void _RepeatChoiceAction(MSO_OBJECT __NEAR* pThis, enMutatorType eType, UINT16 wValue);
// Include custom code file: customer specific code, over-writing common one.
#include "Components\Custom\Playmode\o_playmode_custom.c"
// Include configuration file: constants.
#include "Components\Playmode\o_playmode_config.c"
/***************************************************************************************
* _PROGRAM_LIST related functions
****************************************************************************************/
#ifndef D_CUSTOM_OPLAYMODE_ClearUIProgramList
void OPLAYMODE_ClearUIProgramList(void)
{
UINT8 cIndex;
for(cIndex = 0; cIndex < NONCLIPS_MAX_PROGLIST_SIZE; cIndex++)
sUIProgramList.mwValue[cIndex] = INVALID_TRACK;
sUIProgramList.mcSize = 0;
}
#endif //D_CUSTOM_OPLAYMODE_ClearUIProgramList
#ifndef D_CUSTOM__GetUIProgramListSize
static UINT8 _GetUIProgramListSize(void)
{
UINT8 cIndex;
sUIProgramList.mcSize =0;
for(cIndex = 0; cIndex < NONCLIPS_MAX_PROGLIST_SIZE; cIndex++)
{
if (_IsValidTrackInUIProgramList(cIndex))
sUIProgramList.mcSize ++;
}
return sUIProgramList.mcSize;
}
#endif//D_CUSTOM__GetUIProgramListSize
#ifndef D_CUSTOM__ModifyUIProgramListEntry
static BOOL _ModifyUIProgramListEntry(UINT8 cIndex, UINT16 wValue)
{
if((0 < cIndex) && (NONCLIPS_MAX_PROGLIST_SIZE >= cIndex))
{
sUIProgramList.mwValue[cIndex-1] = wValue;
return TRUE;
}
return FALSE;
}
#endif//D_CUSTOM__ModifyUIProgramListEntry
#ifndef D_CUSTOM__RemoveEntryFromUIProgramList
static BOOL _RemoveEntryFromUIProgramList(UINT8 cIndex)
{
return(_ModifyUIProgramListEntry(cIndex, INVALID_TRACK));
}
#endif//D_CUSTOM__RemoveEntryFromUIProgramList
#ifndef D_CUSTOM__GetEntryFromUIProgramList
static UINT16 _GetEntryFromUIProgramList(UINT8 cIndex)
{
if((0 >= cIndex) || (cIndex > NONCLIPS_MAX_PROGLIST_SIZE))
return INVALID_TRACK;
else
return sUIProgramList.mwValue[(cIndex - 1)];
}
#endif//D_CUSTOM__GetEntryFromUIProgramList
#ifndef D_CUSTOM__IsSupportedDVDMediaType
static BOOL _IsSupportedDVDMediaType(void)
{
DEVICE_MEDIA_TYPE tMediaType = CoreAPI_GetCurrentMediaType();
return ((MEDIA_TYPE_DVD_VIDEO == tMediaType)||(MEDIA_TYPE_DVD_AUDIO == tMediaType)
#ifdef DVD_VR_SUPPORT
||(MEDIA_TYPE_DVDVR == tMediaType)
#endif//DVD_VR_SUPPORT
);
}
#endif//D_CUSTOM__IsSupportedDVDMediaType
#ifndef D_CUSTOM__SetCoreProgramList
static void _SetCoreProgramList(void)
{
UINT8 cIndex;
UINT8 cEntryIndex = 1;
CoreAPI_InitializeProgramList();
for(cIndex = 0; cIndex < NONCLIPS_MAX_PROGLIST_SIZE; cIndex++)
{
if(_IsValidTrackInUIProgramList(cIndex))
{
CoreAPI_SetProgramListEntry(cEntryIndex++, sUIProgramList.mwValue[cIndex]);
}
}
/*for(cIndex = 0; cIndex < NONCLIPS_MAX_PROGLIST_SIZE; cIndex++)
{
tr_printf((">>>>>>>>>>>Program index : %d, track number: %x\n", cIndex+1, PM_GetProgramListEntry(cIndex+1)));
}*/
}
#endif//D_CUSTOM__SetCoreProgramList
#ifndef D_CUSTOM__IsValidTrackInUIProgramList
static BOOL _IsValidTrackInUIProgramList(UINT8 cTrackIndex)
{
if(_IsSupportedDVDMediaType())
{
UINT16 wTitle = _GetTitleFromProgramEntry(sUIProgramList.mwValue[cTrackIndex]);
UINT16 wChapter = _GetChapterFromProgramEntry(sUIProgramList.mwValue[cTrackIndex]);
if((wTitle < 1) ||(wTitle > CoreAPI_GetTotalTitleGroupNum()))
return FALSE;
else if((wChapter < 1)||(wChapter > CoreAPI_GetTotalChapterTrackNum(wTitle)))
return FALSE;
}
else
{
if((sUIProgramList.mwValue[cTrackIndex] < 1) ||(sUIProgramList.mwValue[cTrackIndex] > CoreAPI_GetTotalChapterTrackNum(0)))
return FALSE;
}
return TRUE;
}
#endif//D_CUSTOM__IsValidTrackInUIProgramList
/***************************************************************************************
* Utility functions
****************************************************************************************/
/***************************************************************************************
* Function : _AddItemsToPlayModeKit
*
* In : pList = Pointer to the parent MSO_VLIST.
*
* Out : None.
*
* Return : TRUE if successful, otherwise returns FALSE.
*
* Desc : Adds items to the Playmode kit. I.e. the MSO_VLIST containg the playmode choices.
****************************************************************************************/
#ifndef D_CUSTOM__AddItemsToPlayModeKit
static BOOL _AddItemsToPlayModeKit(MSO_VLIST __NEAR* pList, BOOL bInitializeEntires)
{
if(NULL != pList)
{
UINT8 cIndex;
UINT8 cNumItems;
UINT8 cTotalItemsInToolkit = 0;
MSO_OBJECT __NEAR* pObject;
// Get the total number of tools in the toolkit
while(NULL != aPlayModeKit[cTotalItemsInToolkit])
cTotalItemsInToolkit++;
// Do not add any item related to Program list if not in stop mode.
if(PST_STOP != CoreAPI_GetPlayState())
cTotalItemsInToolkit = 2;
pList->moParam.mwTotalItems = cTotalItemsInToolkit;
cNumItems = MIN(pList->moParam.mcNumVisibleItems, (pList->moParam.mwTotalItems - pList->moParam.mwFirstDisplayItem));
for(cIndex = 0; cIndex < cNumItems; cIndex++)
{
pObject = OVLIST_CreateAndAppendItem(pList, aPlayModeKit[pList->moParam.mwFirstDisplayItem + cIndex]);
MS_SendOperation(pObject, MS_OP_OPEN, 0);
if(TRUE == bInitializeEntires)
MS_SendOperation(pObject, MS_OP_INIT, 0);
}
return TRUE;
}
return FALSE;
}
#endif//D_CUSTOM__AddItemsToPlayModeKit
/***************************************************************************************
* Function : _AddEntriesToProgramList
*
* In : pList = Pointer to the parent MSO_VLIST.
*
* Out : None.
*
* Return : TRUE if successful, otherwise returns FALSE.
*
* Desc : Adds items to the Program list . I.e. the MSO_VLIST containg the program list items.
****************************************************************************************/
#ifndef D_CUSTOM__AddEntriesToProgramList
static BOOL _AddEntriesToProgramList(MSO_VLIST __NEAR* pList)
{
if(NULL != pList)
{
UINT8 cIndex;
UINT8 cNumItems;
MSO_OBJECT __NEAR* pProgramEntry = NULL;
MS_DESCRIPTOR* pProgramEntryDescriptor = NULL;
pList->moParam.mwTotalItems = NONCLIPS_MAX_PROGLIST_SIZE;
if(_IsSupportedDVDMediaType())
pProgramEntryDescriptor = (MS_DESCRIPTOR*)&oDVDProgramEntryDescriptor;
else // VCD media
pProgramEntryDescriptor = (MS_DESCRIPTOR*)&oProgramEntryDescriptor;
cNumItems = MIN(pList->moParam.mcNumVisibleItems, (pList->moParam.mwTotalItems - pList->moParam.mwFirstDisplayItem));
for(cIndex = 0; cIndex < cNumItems; cIndex++)
{
pProgramEntry = OVLIST_CreateAndAppendItem(pList, pProgramEntryDescriptor);
MS_SendOperation(pProgramEntry, MS_OP_OPEN, 0);
MS_SendOperation(pProgramEntry, MS_OP_INIT, (pList->moParam.mwFirstDisplayItem + cIndex + 1));
}
return TRUE;
}
return FALSE;
}
#endif//D_CUSTOM__AddEntriesToProgramList
/***************************************************************************************
* Function : _ProgramItemGetValue
*
* In : pFormUniStr = Pointer to the parent MSO_VLIST.
*
* wParam =
*
* Out : None.
*
* Return : None.
*
* Desc : Prepares the string containing the value in SDRAM.
****************************************************************************************/
#ifndef D_CUSTOM__ProgramItemGetValue
#pragma argsused
static void _ProgramItemGetValue(FORMATED_UNICODE_STRING __NEAR* pFormUniStr, UINT32 wParam)
{
if(INVALID_TRACK == (UINT16)wParam)
STR_GenerateRepeatChars('-', 3, pFormUniStr->mszUniStr, 0, (UNISTR_LENGTH_MAX + 1));
else
STR_GenerateNumericValue((INT32)wParam, pFormUniStr->mszUniStr, 0, (UNISTR_LENGTH_MAX + 1));
// Reformat the unicode string.
OSDR_FormatUniString(pFormUniStr);
}
#endif// D_CUSTOM__ProgramItemGetValue
/***************************************************************************************
* Function : _SetPlayMode
*
* In : pPlayMode = Pointer to the MSO_PLAYMODE component.
*
* bSetProgramMode = Sets the Program mode if TRUE, otherwise ignores
* PLAYMODE_PROGRAM
*
* Out : None.
*
* Return : None.
*
* Desc : Set the Play mode.
****************************************************************************************/
#ifndef D_CUSTOM__SetPlayMode
static void _SetPlayMode(MSO_PLAYMODE __NEAR* pPlayMode, BOOL bSetProgramMode)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -