o_search.c

来自「ZORAN 962/966 SOURCE CODE,DVD chip」· C语言 代码 · 共 1,413 行 · 第 1/3 页

C
1,413
字号
	case MS_OP_VOLUME:
	case MS_OP_PROLOGIC:  	// Temp done
	//case MS_OP_SEARCH:
	case MS_OP_EJECT:			// Fall through !!!
	case MS_OP_SKIPF:			// Fall through !!!
	case MS_OP_SKIPB:			// Fall through !!!
	case MS_OP_LR:			// Fall through !!!
	case MS_OP_KARAOKE:		// Fall through !!!
	case MS_OP_STOP:			// Fall through !!!
	case MS_OP_SLOWF:		// Fall through !!!
	case MS_OP_SLOWB:		// Fall through !!!
	case MS_OP_FASTF:			// Fall through !!!
	case MS_OP_FASTB:		// Fall through !!!
	case MS_OP_PAUSE:		// Fall through !!!
	case MS_OP_MARKAB:		// Fall through !!!
	case MS_OP_PLAY_MODE:	// Fall through !!!
	case MS_OP_TITLE:		// Fall through !!!
	case MS_OP_MENU:			// Fall through !!!
	case MS_OP_PBC:
		MS_SendOperation(pThis, MS_OP_CLOSE_PARENT, 0);
		break;

	case MS_OP_PLAY:
		MsOp = MS_OP_ENTER;
		break;

	default:
		break;
	}
	return MS_ComponentBasicOperation(pThis, MsOp, lParam);
}

/***************************************************************************************
*	Function 	: 	_SearchKitOperation
*
*	In		:
*
*	Out		:
*
*	Desc 	:	The Search kit operation function.
****************************************************************************************/
#pragma argsused
STATIC MS_OP _SearchKitOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	//Pre-processing
	// TODO : if any	

	MsOp = VScrollListOperation(pThis, MsOp, lParam);

	// Post-processing
	switch(MsOp)
	{		
	case MS_OP_REFRESH:
		{			
			MSO_VLIST __NEAR* pList = (MSO_VLIST __NEAR*)MS_GetObjectListPtr(pThis);				
			MS_ASSERT(NULL != pList);

			if(pList->moParam.mwTotalItems > pList->moParam.mcNumVisibleItems)
			{
				// Remove all items.
				MS_SendOperation((MSO_OBJECT __NEAR*)pList, MS_OP_EMPTY, 0);

				_AddItemsToSearchKit(pList);
				MS_DisplayAddObject(pThis);	

				// Set focus to the appropriate list item.
				if(MS_IsFocused(pList))
				{
					MSO_OBJECT __NEAR* pObject = MS_GetObjectListPtr(pList);
						
					if(!MS_IS_FOCUS_ON_LASTITEM(pList))	
						MS_ScreenSetFocusObject(pObject);
					else
					{						
						// Make sure we do not set focus on the Value VScroll list.					
						while(NULL != pObject->mpNext)
							pObject = pObject->mpNext;						
						MS_ScreenSetFocusObject(pObject);
					}
				}
			}			
		}
		return MS_OP_NONE;
		
	default:
		break;
	}	
	return MsOp;
}

/***************************************************************************************
*	Function 	: 	_SearchkitVlistOperation
*
*	In		:
*
*	Out		:
*
*	Desc 	:	The Search kit VLIST operation function.
****************************************************************************************/
#pragma argsused
STATIC MS_OP _SearchkitVlistOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	switch(MsOp)
	{
	case MS_OP_INIT:
		return MS_OP_NONE;
		
	case MS_OP_OPEN:
		_AddItemsToSearchKit((MSO_VLIST __NEAR*)pThis);
		break;
		
	default:
		break;
	}	
	return VListOperation(pThis, MsOp, lParam);
}

/***************************************************************************************
*	Function 	: 	_TrackOrTitleOperation
*
*	In		:
*
*	Out		:
*
*	Desc 	:	The Title/Track operation function.
****************************************************************************************/
#pragma argsused
STATIC MS_OP _TrackOrTitleOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	switch(MsOp)
	{
	case MS_OP_FOCUS_CHANGE:
		MS_DisplayAddObject(pThis);
		break;
		
	case MS_OP_ENTER:
		{
			MSO_SEARCH __NEAR* pSearch = (MSO_SEARCH __NEAR*)MS_FindAncestor(pThis, &oSearchDescriptor);			
			UINT16 wUserTracks = pSearch->moParam.mwTrack;
			DEVICE_MEDIA_TYPE tMediaType = CoreAPI_GetCurrentMediaType();

			switch(tMediaType)
			{
			case MEDIA_TYPE_VCD: // Fall Through !!!
			case MEDIA_TYPE_SVCD:
				{
					if(CoreAPI_GotoEntry(0, wUserTracks))
						return MS_OP_CLOSE_PARENT;
					else
						MS_SendOperation(pThis, MS_OP_CLEAR, 0);
				}
				break;

#if D_SUPPORT_SACD
			case MEDIA_TYPE_SACD:
				{
					if(INVALID_TRACK != pSearch->moParam.mwTrack)
					{
						if((pSearch->moParam.mwTrack > CoreAPI_GetTotalChapterTrackNum(0)) || (!pSearch->moParam.mwTrack))
						{
							pSearch->moParam.mwTrack = INVALID_TRACK;
							MS_DisplayAddObject(pThis);
							return MS_OP_NONE;
						}
						else
						{
							if(!CoreAPI_GotoEntry(0, pSearch->moParam.mwTrack))
								PROHIBIT(MSG_PROHIBIT_NOT_ALLOWED_BY_DISC);
							return MS_OP_CLOSE_PARENT;
						}
					}
				}
				break;
#endif // D_SUPPORT_SACD

			case MEDIA_TYPE_CLIPS:
#ifdef D_DIVX6_SUPPORT
				if(!CoreAPI_IsCurrItemDivX6()) // Fall through if this is DivX6.
#endif // D_DIVX6_SUPPORT
				{
					if(INVALID_TRACK != pSearch->moParam.mwTrack)
					{
						if((pSearch->moParam.mwTrack > CoreAPI_GetTotalChapterTrackNum(0)) || (!pSearch->moParam.mwTrack))
						{
							pSearch->moParam.mwTrack = INVALID_TRACK;
							MS_DisplayAddObject(pThis);
							return MS_OP_NONE;
						}
						else
						{
							pSearch->moParam.mwTrack = pSearch->moParam.mwTrack - 1;
							MS_SendOperation((MSO_OBJECT __NEAR*)MS_GetParentPtr(pSearch), MS_OP_JUMP_TO_TRACK, pSearch->moParam.mwTrack);
							MS_SendOperation((MSO_OBJECT __NEAR*)pSearch, MS_OP_CLOSE_PARENT, 0);
							return MS_OP_JUMP_TO_TRACK;
						}
					}
					break;
				} // Fall Through !!!

#ifdef DVD_AUDIO_SUPPORT
			case MEDIA_TYPE_DVD_AUDIO: // Fall Through !!!
#endif // DVD_AUDIO_SUPPORT
			case MEDIA_TYPE_DVD_VIDEO: // Fall Through !!!
#ifdef DVD_VR_SUPPORT
			case MEDIA_TYPE_DVDVR:
#endif // DVD_VR_SUPPORT
				{
					UINT16 wTitle = pSearch->moParam.mwTrack;
					UINT16 wChapter = pSearch->moParam.mwChapter;

					if(INVALID_TRACK == wChapter)
					{
#ifdef D_ALLOW_JUMP_TO_CURRENT_TITLE_WHEN_PTTSEARCH_TIMESEARCH_PROHIBIT
						// wChapter==INVALID_TRACK means user want to do a title jump
						if(MEDIA_TYPE_DVD_VIDEO != CoreAPI_GetCurrentMediaType())
#endif // D_ALLOW_JUMP_TO_CURRENT_TITLE_WHEN_PTTSEARCH_TIMESEARCH_PROHIBIT
							wChapter = 1;
					}
					
					if(!_IsTitleChapterValid(wTitle, wChapter))
					{			
						pSearch->moParam.mwTrack = INVALID_TRACK;
						pSearch->moParam.mwChapter = INVALID_TRACK;
						MS_DisplayAddObject((MSO_OBJECT __NEAR*)MS_GetParentPtr(pThis));	
					}
#ifdef DVD_AUDIO_SUPPORT
					//if have hidden track, it only exists in last group.
					else if((CoreAPI_GetTotalTitleGroupNum() == wTitle) && CoreAPI_IsDVDAudioHGRAvailable())
					{
						UINT16 wUserPassword;
						MS_SendOpObject(MS_MenuGetActive(), MS_OP_MENU_DVDA_USER_PASSWORD_GET, &wUserPassword);
						
						if(CoreAPI_GetDVDAudioHiddenGroupInfo() != wUserPassword)
						{
							MS_SendOpObject(MS_MenuGetActive(), MS_OP_MENU_DVDA_PENDING_PLAY_SET, wChapter);
							MS_SendOpObject(pSearch, MS_OP_CLOSE_PARENT, 0);
							return MS_OP_MENU_DVDA_REQUEST_PASSWORD;
						}
						else
						{
							CoreAPI_HGRTrackPlay((((UINT32)wChapter)<<16) | wUserPassword);
							return MS_OP_CLOSE_PARENT;
						}
					}
#endif//#ifdef DVD_AUDIO_SUPPORT
					else if(CoreAPI_GotoEntry(wTitle, wChapter))
						return MS_OP_CLOSE_PARENT;
					else
					{
						PROHIBIT(MSG_PROHIBIT_NOT_ALLOWED_BY_DISC);
						return MS_OP_CLOSE_PARENT;
					}			
				}
				break;

			default:
				break;
			}
			return MS_OP_NONE;			
		}	
		
	case MS_OP_0: // Fall Through
	case MS_OP_1: // Fall Through
	case MS_OP_2: // Fall Through
	case MS_OP_3: // Fall Through
	case MS_OP_4: // Fall Through
	case MS_OP_5: // Fall Through
	case MS_OP_6: // Fall Through
	case MS_OP_7: // Fall Through
	case MS_OP_8: // Fall Through
	case MS_OP_9:
		{
			MSO_SEARCH __NEAR* pSearch = (MSO_SEARCH __NEAR*)MS_FindAncestor(pThis, &oSearchDescriptor);
			
			UINT8 cValue = MsOp - MS_OP_0;

			if(INVALID_TRACK == pSearch->moParam.mwTrack)
			{
				pSearch->moParam.mwTrack = cValue;
				MS_DisplayAddObject(pThis);
			}
			else
			{
				pSearch->moParam.mwTrack = (pSearch->moParam.mwTrack * 10) + cValue;
				pSearch->moParam.mwTrack = (pSearch->moParam.mwTrack) % 1000;
				MS_DisplayAddObject(pThis);
			}
		}
		return MS_OP_NONE;
		
	case MS_OP_CLEAR:
		{
			MSO_SEARCH __NEAR* pSearch = (MSO_SEARCH __NEAR*)MS_FindAncestor(pThis, &oSearchDescriptor);
			if(INVALID_TRACK != pSearch->moParam.mwTrack)
			{
				pSearch->moParam.mwTrack = INVALID_TRACK;
				MS_DisplayAddObject(pThis);
			}
		}
		return MS_OP_NONE;
	}
	return MsOp;
}

/***************************************************************************************
*	Function 	: 	_ChapterOperation
*
*	In		:
*
*	Out		:
*
*	Desc 	:	The Chapter operation function.
****************************************************************************************/
#pragma argsused
STATIC MS_OP _ChapterOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	switch(MsOp)
	{
	case MS_OP_FOCUS_CHANGE:
		MS_DisplayAddObject(pThis);
		break;
		
	case MS_OP_ENTER:
		{			
			MSO_SEARCH __NEAR* pSearch = (MSO_SEARCH __NEAR*)MS_FindAncestor(pThis, &oSearchDescriptor);
			UINT16 wTitle =  pSearch->moParam.mwTrack;
			UINT16 wChapter = pSearch->moParam.mwChapter;

			if(INVALID_TRACK == wTitle)
			{
#ifdef D_DIVX6_SUPPORT
				if(CoreAPI_IsCurrItemDivX6())
					wTitle = CoreAPI_MPEG4GetCurrentTitle();
				else				
#endif // D_DIVX6_SUPPORT
					wTitle = CoreAPI_GetCurrentTitleGroupNum();
			}
			
			if(!_IsTitleChapterValid(wTitle, wChapter))
			{			
				pSearch->moParam.mwTrack = INVALID_TRACK;
				pSearch->moParam.mwChapter = INVALID_TRACK;
				MS_DisplayAddObject((MSO_OBJECT __NEAR*)MS_GetParentPtr(pThis));	
			}
			else if(CoreAPI_GotoEntry(wTitle, wChapter))
			{	
				return MS_OP_CLOSE_PARENT;
			}
			else
			{
				PROHIBIT(MSG_PROHIBIT_NOT_ALLOWED_BY_DISC);
				return MS_OP_CLOSE_PARENT;
			}
		}
		return MS_OP_NONE;
		
	case MS_OP_0: // Fall Through
	case MS_OP_1: // Fall Through
	case MS_OP_2: // Fall Through
	case MS_OP_3: // Fall Through
	case MS_OP_4: // Fall Through
	case MS_OP_5: // Fall Through
	case MS_OP_6: // Fall Through
	case MS_OP_7: // Fall Through
	case MS_OP_8: // Fall Through
	case MS_OP_9:
		{
			MSO_SEARCH __NEAR* pSearch = (MSO_SEARCH __NEAR*)MS_FindAncestor(pThis, &oSearchDescriptor);
			
			UINT8 cValue = MsOp - MS_OP_0;

			if(INVALID_TRACK == pSearch->moParam.mwChapter)
			{
				pSearch->moParam.mwChapter = cValue;
				MS_DisplayAddObject(pThis);
			}
			else 
			{
				pSearch->moParam.mwChapter = (pSearch->moParam.mwChapter * 10) + cValue;
				pSearch->moParam.mwChapter = (pSearch->moParam.mwChapter) % 1000;
				MS_DisplayAddObject(pThis);
			}
		}
		return MS_OP_NONE;
		
	case MS_OP_CLEAR:
		{
			MSO_SEARCH __NEAR* pSearch = (MSO_SEARCH __NEAR*)MS_FindAncestor(pThis, &oSearchDescriptor);
			if(INVALID_TRACK != pSearch->moParam.mwChapter)
			{
				pSearch->moParam.mwChapter = INVALID_TRACK;
				MS_DisplayAddObject(pThis);
			}
		}
		return MS_OP_NONE;
	}
	return MsOp;
}

/***************************************************************************************
*	Function	:	_BasicTimeEditOperation
*
*	In		:
*
*	Out 		:
*
*	Desc		:	Basic operation for all the time edits.
 ****************************************************************************************/
#pragma argsused
STATIC MS_OP _BasicTimeEditOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	switch(MsOp)
	{
	case MS_OP_INIT:
		{
			MSO_TIME __NEAR* pTime = (MSO_TIME __NEAR*)pThis;
			
			pTime->moParam.mdwTime = INVALID_TIME;
			pTime->moParam.mwNumDigits = 0;
		}
		break;

	case MS_OP_FOCUS_CHANGE:
		MS_DisplayAddObject(pThis);
		break;

	case MS_OP_0: // Fall Through
	case MS_OP_1: // Fall Through
	case MS_OP_2: // Fall Through
	case MS_OP_3: // Fall Through
	case MS_OP_4: // Fall Through
	case MS_OP_5: // Fall Through
	case MS_OP_6: // Fall Through
	case MS_OP_7: // Fall Through
	case MS_OP_8: // Fall Through
	case MS_OP_9:
		{
			MSO_TIME __NEAR* pTime = (MSO_TIME __NEAR*)pThis;
			UINT16 wValue = MsOp - MS_OP_0;
			if(pTime->moParam.mwNumDigits < 6)
				pTime->moParam.mwNumDigits++;
			else
				pTime->moParam.mdwTime = pTime->moParam.mdwTime % 100000ul;
			if(INVALID_TIME == pTime->moParam.mdwTime)
				pTime->moParam.mdwTime = wValue;
			else
				pTime->moParam.mdwTime = (pTime->moParam.mdwTime * 10) + wValue;

			MS_DisplayAddObject(pThis);
		}
		return MS_OP_NONE;

	case MS_OP_TICK:
		{
			MSO_OBJECT __NEAR* pObjectSearch = MS_FindAncestor(pThis, &oSearchDescriptor);

			if (!_IsClipsTimeSearchAllowed())	
			{
				MS_SendOperation(pObjectSearch, MS_OP_CLOSE_PARENT, 0);
			}
		}
		break;
		
	case MS_OP_CLEAR:
		{
			MSO_TIME __NEAR* pTime = (MSO_TIME __NEAR*)pThis;
			
			if(INVALID_TIME != pTime->moParam.mdwTime)
			{
				pTime->moParam.mdwTime = INVALID_TIME;
				pTime->moParam.mwNumDigits = 0;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?