o_search.c
来自「ZORAN 962/966 SOURCE CODE,DVD chip」· C语言 代码 · 共 1,413 行 · 第 1/3 页
C
1,413 行
/* **************************************************************************************
* Copyright (c) 2004 ZORAN Corporation, All Rights Reserved
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
* File: $Workfile: o_timesearch.c $
*
* Description:
* ============
* Project definition of the MSO_SEARCH
*
****************************************************************************************/
#include "Config.h" // Global Configuration - do not remove!
#ifdef D_GUI_COMPONENT_SEARCH
#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 "CoreAPI\CoreAPI.h"
#include "CoreAPI\DeviceManager.h"
#include "Library\String_generate.h"
#include "Library\Number.h"
#include "GUI\Menu_system\ms_menu.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 "Components\Search\o_search.h"
#include "GUI\Resource\Bitmap\bitmap.h"
#include "Menu\menu_operation_def.h"
#include "Menu_config\menu_config_common.h"
#include "Components\Search\o_search.h"
#include "Components\Search\o_search_config.h"
#include "Components\Custom\Search\o_search_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 BOOL _AddItemsToSearchKit(MSO_VLIST __NEAR* pList);
STATIC BOOL _IsTitleChapterValid(UINT16 wTitleNum, UINT16 wChapterNum);
#ifdef DVD_AUDIO_PAGE_SEARCH
STATIC BOOL _IsPageValid(UINT16 wPageNum);
#endif//DVD_AUDIO_PAGE_SEARCH
STATIC BOOL _IsTitleTimeValid(UINT32 dwTime);
STATIC BOOL _IsClipsTimeSearchAllowed(void);
/***************************************************************************************
* Operation functions
****************************************************************************************/
STATIC MS_OP _SearchOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _SearchKitOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _SearchkitVlistOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _TrackOrTitleOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _ChapterOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _BasicTimeEditOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _TrackTimeOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
STATIC MS_OP _DiscTimeOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#ifdef DVD_AUDIO_PAGE_SEARCH
STATIC MS_OP _PageOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#endif//DVD_AUDIO_PAGE_SEARCH
/***************************************************************************************
* Display functions
****************************************************************************************/
STATIC BOOL _SearchFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
STATIC BOOL _TrackOrTitleFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
STATIC BOOL _TimeFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);
/***************************************************************************************
* Utility functions
****************************************************************************************/
#include "Components\Custom\Search\o_search_custom.c"
#include "Components\Search\o_search_config.c"
/***************************************************************************************
* Function : _AddItemsToSearchKit
*
* In : pList = Pointer to the Searchkit MSO_VLIST.
*
* Out :
*
* Desc :
****************************************************************************************/
STATIC BOOL _AddItemsToSearchKit(MSO_VLIST __NEAR* pList)
{
if(NULL != pList)
{
UINT8 cIndex;
UINT8 cNumItems;
UINT8 cTotalItemsInToolkit = 0;
MSO_OBJECT __NEAR* pObject;
MS_DESCRIPTOR** ppDescriptor = NULL;
DEVICE_MEDIA_TYPE tMediaType = CoreAPI_GetCurrentMediaType();
switch(tMediaType)
{
#ifdef DVD_AUDIO_SUPPORT
case MEDIA_TYPE_DVD_AUDIO:
if (CoreAPI_IsFullStop())
{
ppDescriptor = (MS_DESCRIPTOR**)aDVDAudioFullStopSearchKit;
cTotalItemsInToolkit = MAX_ITEM_IN_DVDA_STOP_SEARCH;
}
else
{
#ifdef DVD_AUDIO_PAGE_SEARCH
if(CoreAPI_IsMenuAllowedPageSearch())
{
ppDescriptor = (MS_DESCRIPTOR**)aDVDAudioPageSearchKit;
cTotalItemsInToolkit = MAX_ITEM_IN_DVDA_PAGE_SEARCH;
}
else
#endif//DVD_AUDIO_PAGE_SEARCH
{
ppDescriptor = (MS_DESCRIPTOR**)aDVDAudioSearchKit;
cTotalItemsInToolkit = MAX_ITEM_IN_DVDA_SEARCH;
}
}
break;
#endif//DVD_AUDIO_SUPPORT
case MEDIA_TYPE_DVD_VIDEO:
#ifdef DVD_VR_SUPPORT
case MEDIA_TYPE_DVDVR:
#endif // DVD_VR_SUPPORT
if (CoreAPI_IsFullStop())
{
ppDescriptor = (MS_DESCRIPTOR**)aDVDFullStopSearchKit;
cTotalItemsInToolkit = MAX_ITEM_IN_DVD_STOP_SEARCH;
}
else
{
ppDescriptor = (MS_DESCRIPTOR**)aDVDSearchKit;
cTotalItemsInToolkit = MAX_ITEM_IN_DVD_SEARCH;
}
break;
case MEDIA_TYPE_SVCD:
case MEDIA_TYPE_VCD:
if (CoreAPI_IsSVCDPBCOn())
{
ppDescriptor = (MS_DESCRIPTOR**)aVCDPBCOnSearchKit;
cTotalItemsInToolkit = MAX_ITEM_IN_PBC_SEARCH;
}
else if (CoreAPI_IsFullStop()) //When PBC off and VCD in full stop.
{
ppDescriptor = (MS_DESCRIPTOR**)aVCDPBCOffAndCDDAFullStopSearchKit;
cTotalItemsInToolkit = MAX_ITEM_IN_CDDA_STOP_SEARCH;
}
else
{
ppDescriptor = (MS_DESCRIPTOR**)aVCDAndCDDASearchKit;
cTotalItemsInToolkit = MAX_ITEM_IN_CDDA_SEARCH;
}
break;
#if D_SUPPORT_SACD
case MEDIA_TYPE_SACD:
if(CoreAPI_IsFullStop())
{
ppDescriptor = (MS_DESCRIPTOR**)aVCDPBCOffAndCDDAFullStopSearchKit;
cTotalItemsInToolkit = MAX_ITEM_IN_CDDA_STOP_SEARCH;
}
else
{
ppDescriptor = (MS_DESCRIPTOR**)aVCDAndCDDASearchKit;
cTotalItemsInToolkit = MAX_ITEM_IN_CDDA_SEARCH;
}
break;
#endif // D_SUPPORT_SACD
case MEDIA_TYPE_CLIPS:
{
if(TRUE == DeviceManager_IsDiscCDDA())
{
if (CoreAPI_IsFullStop()) //When CDDA in full stop, there is no track time search items.
{
ppDescriptor = (MS_DESCRIPTOR**)aVCDPBCOffAndCDDAFullStopSearchKit;
cTotalItemsInToolkit = MAX_ITEM_IN_CDDA_STOP_SEARCH;
}
else
{
ppDescriptor = (MS_DESCRIPTOR**)aVCDAndCDDASearchKit;
cTotalItemsInToolkit = MAX_ITEM_IN_CDDA_SEARCH;
}
}
else
{
#ifdef D_DIVX6_SUPPORT
if(CoreAPI_IsCurrItemDivX6())
{
ppDescriptor = (MS_DESCRIPTOR**)aDVDSearchKit;
cTotalItemsInToolkit = MAX_ITEM_IN_DVD_SEARCH;
}
else
#endif // D_DIVX6_SUPPORT
{
ppDescriptor = (MS_DESCRIPTOR**)aClipsSearchKit;
cTotalItemsInToolkit = MAX_ITEM_IN_CLIP_SEARCH;
}
}
}
break;
default:
return FALSE;
}
pList->moParam.mwTotalItems = cTotalItemsInToolkit;
// When Descriptor changed, will appear pList->moParam.mwFirstDisplayItem not less than
// pList->moParam.mwTotalItems, so need to reset pList->moParam.mwFirstDisplayItem.
if (pList->moParam.mwFirstDisplayItem >= pList->moParam.mwTotalItems)
pList->moParam.mwFirstDisplayItem = 0;
cNumItems = MIN(pList->moParam.mcNumVisibleItems, (pList->moParam.mwTotalItems - pList->moParam.mwFirstDisplayItem));
for(cIndex = 0; cIndex < cNumItems; cIndex++)
{
pObject = OVLIST_CreateAndAppendItem(pList, ppDescriptor[pList->moParam.mwFirstDisplayItem + cIndex]);
MS_SendOperation(pObject, MS_OP_OPEN, 0);
MS_SendOperation(pObject, MS_OP_INIT, 0);
}
return TRUE;
}
return FALSE;
}
/**********************************************************************************
* Name : _IsTitleChapterValid
*
* Purpose : Check whether the title num and the chapter num are in the range.
*
* Input : wTitleNum = group/title number
* wChapterNum = track/chapter number
*
* Return Value : TRUE: The title num and the chapter num are in the range. FALSE: The title num and the chapter num are out of the range.
*
* Description : refer to purpose
*
* Comments : None.
*
**********************************************************************************/
STATIC BOOL _IsTitleChapterValid(UINT16 wTitleNum, UINT16 wChapterNum)
{
#ifdef D_DIVX6_SUPPORT
if(CoreAPI_IsCurrItemDivX6())
{
return CoreAPI_IsMPEG4TitleChapterValid(wTitleNum, wChapterNum);
}
else
#endif // D_DIVX6_SUPPORT
{
if((wTitleNum < 1) ||(wTitleNum > CoreAPI_GetTotalTitleGroupNum()))
return FALSE;
else
{
UINT32 dwAvailableChapterNum = 0;
query_core(CQ_AVAILABLE_CHAPTERS, (void*)wTitleNum, (void*)&dwAvailableChapterNum);
if((wChapterNum > dwAvailableChapterNum) || (wChapterNum < 1))
{
#ifdef D_ALLOW_JUMP_TO_CURRENT_TITLE_WHEN_PTTSEARCH_TIMESEARCH_PROHIBIT
// wChapterNum==INVALID_TRACK means user want to do a title jump
if ((MEDIA_TYPE_DVD_VIDEO == CoreAPI_GetCurrentMediaType()) && (wChapterNum == INVALID_TRACK))
return TRUE;
#endif
return FALSE;
}
}
}
return TRUE;
}
#ifdef DVD_AUDIO_PAGE_SEARCH
/**********************************************************************************
* Name : _IsPageValid
*
* Purpose : Check whether the title num, the chapter num and the page num are in the range.
*
* Input : wPageNum = page number
*
* Return Value : TRUE: The title num and the chapter num are in the range. FALSE: The title num and the chapter num are out of the range.
*
* Description : refer to purpose
*
* Comments : None.
*
**********************************************************************************/
STATIC BOOL _IsPageValid(UINT16 wPageNum)
{
{
if((wPageNum < 1) ||(wPageNum > CoreAPI_GetDVDAudioTotalASVNum()))
return FALSE;
}
return TRUE;
}
#endif//DVD_AUDIO_PAGE_SEARCH
/**********************************************************************************
* Name : _IsTitleTimeValid
*
* Purpose : Check whether the title time is in the range.
*
* Input : dwTime - title time number
*
* Return Value : TRUE: The title time is in the range. FALSE: The title time is out of the range.
*
* Description : refer to purpose
*
* Comments : None.
*
**********************************************************************************/
STATIC BOOL _IsTitleTimeValid(UINT32 dwTime)
{
if (dwTime > CoreAPI_GetTotalDiscTitleGroupTime())
return FALSE;
else
return TRUE;
}
/**********************************************************************************
* Name : _IsClipsTimeSearchAllowed
*
* Purpose : Checks whether time search can be performed.
*
* Input : None.
*
* Return Value : TRUE: If search can be performed. Othewise retunrs FALSE.
*
* Description : refer to purpose
*
* Comments : None.
*
**********************************************************************************/
STATIC BOOL _IsClipsTimeSearchAllowed(void)
{
switch(CoreAPI_GetCurrentClipType())
{
case eClipType_CDDA: // Fall Through !!!
return TRUE; // In Resume stop mode, CDDA still support track time search.
case eClipType_MP3: // Fall Through !!!
case eClipType_MPEG: // Fall Through !!!
case eClipType_AVI: // Fall Through !!!
#ifdef IS_ASF_CAPABLE
case eClipType_ASF: // Fall Through !!!
#endif // IS_ASF_CAPABLE
#ifdef IS_MP4_CAPABLE
case eClipType_MP4:
#ifdef D_ENABLE_AAC_SUPPORT
case eClipType_M4A:
#endif
#endif // IS_MP4_CAPABLE
{
// Track time search is not allowed in resume stop mode.
if(!CoreAPI_IsResumeStop()
#ifdef D_DIVX6_SUPPORT
&& !IsDivX6MenuDomainPlay()
#endif // D_DIVX6_SUPPORT
)
return TRUE;
else
return FALSE;
}
default:
if ((MEDIA_TYPE_CLIPS == CoreAPI_GetCurrentMediaType())
&& (!DeviceManager_IsDiscCDDA()))
return FALSE; // To clips track in full stop not support track time search
return TRUE;
}
}
/***************************************************************************************
* Operation functions
****************************************************************************************/
/***************************************************************************************
* Function : _SearchOperation
*
* In :
*
* Out :
*
* Desc : MSO_SEARCH user operation function.
****************************************************************************************/
STATIC MS_OP _SearchOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
switch(MsOp)
{
case MS_OP_INIT:
{
MSO_SEARCH __NEAR* pSearchObject = (MSO_SEARCH __NEAR*)pThis;
MSO_OBJECT __NEAR* pObject = MS_FindDescendant(pThis, &oTrackOrTitleEditDescriptor);
if(NULL == pObject)
pObject = MS_FindDescendant(pThis, &oTrackTimeDescriptor);
pSearchObject->moParam.mwTrack = INVALID_TRACK;
pSearchObject->moParam.mwChapter = INVALID_TRACK;
#ifdef DVD_AUDIO_PAGE_SEARCH
pSearchObject->moParam.mwPage = INVALID_TRACK;
#endif//DVD_AUDIO_PAGE_SEARCH
MS_ScreenSetFocusObject(pObject);
}
break;
case MS_OP_TICK:
if (!CoreAPI_IsMenuAllowedSearch())
{
MS_SendOperation(pThis, MS_OP_CLOSE_PARENT, 0);
}
else if (NULL != MS_FindDescendant(pThis, &oTrackTimeDescriptor))
{
// If there is track time item in search component, CCDA in (full stop) and Vcd in (PBC off and stop)
// should to refresh search component. Track time will be removed in search component.
if ((DeviceManager_IsDiscCDDA()
||( (MEDIA_TYPE_VCD == CoreAPI_GetCurrentMediaType()
|| MEDIA_TYPE_SVCD ==CoreAPI_GetCurrentMediaType() )
&& ! CoreAPI_IsSVCDPBCOn()))
&& CoreAPI_IsFullStop())
{
// In this condition, keep search component on screen
MS_SendOperation(pThis, MS_OP_REFRESH, 0); // From play to stop, such as scan Back to top. time search componet should be refreshed.
}
else if (CoreAPI_IsFullStop())
{
MS_SendOperation(pThis, MS_OP_CLOSE_PARENT, 0); // In full stop should close
}
}
break;
case MS_OP_CORE_MEDIA_CHANGED: // Fall through !!!
case MS_OP_SEARCH:
MsOp = MS_OP_CLOSE_PARENT;
break;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?