⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 o_message_playstate.c

📁 Zoran V966 DVD 解码 Soc芯片的源程序
💻 C
字号:
/****************************************************************************************************
*  Copyright (c) 2005 ZORAN Corporation, All Rights Reserved
*  THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
*  File: o_message_playstate.c
*
* Description:
* =========
*
****************************************************************************************************/

/****************************************************************************************************
*	DECLARATION: Public functions
****************************************************************************************************/

MS_OP OMESSAGE_PLAYSTATE_Operation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#define OMESSAGE_PLAYSTATE_FillOSDSeg(o, a)		OMESSAGE_FillOSDSeg(o, a)
#define MASK_HIGH16 0xFFFF0000L
#define MASK_LOW16  0x0000FFFFL
/***************************************************************************************
* 	Include customization file.
****************************************************************************************/

// Include custom code file: customer specific code, over-writing common one.
#include "Components\Custom\Message\o_message_playstate_custom.c"



/****************************************************************************************************
*	DEFINITION: Private named constants
****************************************************************************************************/

/****************************************************************************************************
*	DEFINITION: Private macros
****************************************************************************************************/
/****************************************************************************************************
*	DEFINITION: Private typedefs
****************************************************************************************************/
/****************************************************************************************************
*	DEFINITION: Public (global) variables
****************************************************************************************************/
/****************************************************************************************************
*	DEFINITION: Private (static) variables
****************************************************************************************************/
/****************************************************************************************************
*	DECLARATION: Private (static) functions
****************************************************************************************************/
STATIC void _SetTimeoutMaintainMessageState(MSO_MESSAGE __NEAR* pMessage, BOOL bStateValid, UINT16 wMaintainTimeout);

/****************************************************************************************************
*	DEFINITION: Public functions
****************************************************************************************************/
/****************************************************************************************************
* Function	: Name
*
* Input		: Parameter_1 - description
*			  Parameter_2 - description
*
* Output		: Parameter_3 - description
*			  Parameter_4 - description
*
* Return		: Describe_possible_returned_values_and_their_meaning
*
* Description	: Describe_what_the_function_does_in_English
*
****************************************************************************************************/
MS_OP OMESSAGE_PLAYSTATE_Operation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	FORMATED_UNICODE_STRING	oFormUniStr;
	OSD_MESSAGES				eMsg = S_NULL;
	MS_OP						MsOpMsgBeforeDefrost;
	BOOL						bSaveAndUpdate = TRUE;
	MSO_MESSAGE __NEAR* 		pMessage = (MSO_MESSAGE __NEAR*)pThis;
	MS_DESCRIPTOR_MESSAGE*	pMessageDescriptor = (MS_DESCRIPTOR_MESSAGE*)(pThis->mpDescriptor);

	// Initialize oFormUniStr, if no font index, then OSDR_GetFormUniStr_OsdMessage will be wrong
	oFormUniStr.mtFontIndex = FONT_MESSAGE;
	oFormUniStr.mszUniStr[0] = 0;
	
	switch(MsOp)
	{
	case MS_OP_TICK:
		bSaveAndUpdate = FALSE;

		if (pMessage->moParam.mwCoreTimer)
			break;
		
		// The timeout of messages is handled in the generic message handler.
		// This handler deals with the updating of the PLAYSTATE message
		// and the removal of certain WHILE TRUE conditions.

		switch(pMessage->moParam.mMsOpMsg)
		{		
		case MS_OP_MSG_PLAYSTATE_PAUSE:	
			_SetTimeoutMaintainMessageState(pMessage, CoreAPI_GetPlayState() == PST_PAUSE, OMESSAGE_PLAYSTATE_MAINTAIN_TIMEOUT_PAUSE);
			break;

		case MS_OP_MSG_PLAYSTATE_STOP_RESUME: 
			_SetTimeoutMaintainMessageState(pMessage, CoreAPI_IsMediaReady() && CoreAPI_IsResumeStop(), OMESSAGE_PLAYSTATE_MAINTAIN_TIMEOUT_STOP);
			break;
			
		case MS_OP_MSG_PLAYSTATE_STOP:
			// If media is not ready, playstate will be stop
			_SetTimeoutMaintainMessageState(pMessage, CoreAPI_IsMediaReady() && (CoreAPI_GetPlayState() == PST_STOP), OMESSAGE_PLAYSTATE_MAINTAIN_TIMEOUT_STOP);
			break;

		case MS_OP_MSG_PLAYSTATE_STEP:
#ifdef D_GUI_MESSAGE_PLAYSTATE_STEP_INFINITE
			_SetTimeoutMaintainMessageState(pMessage, CoreAPI_GetPlayState() == PST_PAUSE, OMESSAGE_PLAYSTATE_MAINTAIN_TIMEOUT_STEP);
#else //D_GUI_MESSAGE_PLAYSTATE_STEP_INFINITE
			// Avoid display effect on transition, display the Pause message right away
			if(pMessage->moParam.mwTimer == 1)
			{
				_DisplayMessageOnTick(pThis, MS_OP_MSG_PLAYSTATE_PAUSE, 0);
			}
#endif //D_GUI_MESSAGE_PLAYSTATE_STEP_INFINITE
			break;

		case MS_OP_MSG_PLAYSTATE_SCAN:	
			_SetTimeoutMaintainMessageState(pMessage, CoreAPI_GetPlayState() == PST_SCAN, OMESSAGE_PLAYSTATE_MAINTAIN_TIMEOUT_SCAN);
			break;

		case MS_OP_MSG_PLAYSTATE_SLOW:	
			_SetTimeoutMaintainMessageState(pMessage, CoreAPI_GetPlayState() == PST_SLOW, OMESSAGE_PLAYSTATE_MAINTAIN_TIMEOUT_SLOW);
			break;
			
		case MS_OP_MSG_PLAYSTATE_LOADING_FILE:	
			_SetTimeoutMaintainMessageState(pMessage, CoreAPI_IsFileLoading() , OMESSAGE_PLAYSTATE_MAINTAIN_TIMEOUT_LOADING);
			break;

		default:
			break;
		}
				
		// Display playstate with no transition effect if a playstate message is about to be removed
		if ((MS_OP_NONE == pMessage->moParam.mMsOpMsg) || (1 == pMessage->moParam.mwTimer))
		{				
			PLAY_STATE PlayState = CoreAPI_GetPlayState();
			
			switch (PlayState)
			{
			case PST_SCAN:
				{
					SCAN_SPEED Speed = CoreAPI_GetScanSpeed();

					// Test speed just to fix a Core/Api bug
					if (SCAN_SPEED_0 != Speed)
					{
						_DisplayMessageOnTick(pThis, MS_OP_MSG_PLAYSTATE_SCAN, (UINT32)Speed);
					}
				}
				break;
			
			case PST_SLOW:
				{
					SLOW_SPEED Speed = CoreAPI_GetSlowSpeed();

					// Test speed just to fix a Core/Api bug
					if (SLOW_SPEED_0 != Speed)
						_DisplayMessageOnTick(pThis, MS_OP_MSG_PLAYSTATE_SLOW, (UINT32)Speed);
				}
				break;
			
			case PST_PAUSE:
				_DisplayMessageOnTick(pThis, MS_OP_MSG_PLAYSTATE_PAUSE, 0);
				break;

			default:
				// Loading file message can only be following another playstate message or if playing a JPEG
				if 	(CoreAPI_IsFileLoading() &&
						(	(MS_OP_NONE != pMessage->moParam.mMsOpMsg) 
#ifndef D_DISABLE_MESSAGE_PLAYSTATE_LOADING_JPEG 
							|| (eClipType_JPEG == CoreAPI_GetCurrentClipType())
#endif//D_DISABLE_MESSAGE_PLAYSTATE_LOADING_JPEG 
#ifdef D_DIVX6_SUPPORT
// TODO: Use API for IsDivX6TitleDomainLoading
							|| (CoreAPI_IsCurrItemDivX6() && (IsDivX6TitleDomainLoading())) 
#endif // D_DIVX6_SUPPORT
						)
					)
				{
						_DisplayMessageOnTick(pThis, MS_OP_MSG_PLAYSTATE_LOADING_FILE, 0);
				}
				// This code would always display stop if in stop state
				/*else if ((PST_STOP == PlayState) && CoreAPI_IsMediaReady() && (MS_OP_NONE == pMessage->moParam.mMsOpMsg))
				{
					if (CoreAPI_IsResumeStop())
						_DisplayMessageOnTick(pThis, MS_OP_MSG_PLAYSTATE_STOP_RESUME, 0);									
					else
						_DisplayMessageOnTick(pThis, MS_OP_MSG_PLAYSTATE_STOP, 0);			
				}*/
				break;
			}
		}
		break;

	case MS_OP_MSG_PLAYSTATE_PLAY:			
		eMsg = S_PLAY;
		pMessage->moParam.mwTimer = pMessageDescriptor->mwDefaultTimeout;
		break;

	case MS_OP_MSG_PLAYSTATE_RESUME_PLAY:
		eMsg = S_RESUME;
		pMessage->moParam.mwTimer = pMessageDescriptor->mwDefaultTimeout;
		break;

	case MS_OP_MSG_PLAYSTATE_STOP:			
		eMsg = S_STOP;
		pMessage->moParam.mwTimer = OMESSAGE_INFINITE_TIMEOUT;
		break;

	case MS_OP_MSG_PLAYSTATE_STOP_RESUME:	
		eMsg = S_STOP_PAUSED;
		pMessage->moParam.mwTimer = OMESSAGE_INFINITE_TIMEOUT;
		break;

	case MS_OP_MSG_PLAYSTATE_PAUSE:		
		eMsg = S_PAUSE;
		pMessage->moParam.mwTimer = OMESSAGE_INFINITE_TIMEOUT;
		break;

	case MS_OP_MSG_PLAYSTATE_STEP:		
		eMsg = S_STEP_F;
		pMessage->moParam.mwTimer =  OMESSAGE_PLAYSTATE_STEP_TIMEOUT;
		break;
		
// TODO: Remove MS_OP_MSG_PLAYSTATE_FB, keep only MS_OP_MSG_PLAYSTATE_SCAN
	case MS_OP_MSG_PLAYSTATE_SCAN:			
		// Slight adjustment to make things look good:
		lParam = (lParam == 20) ? 16 : lParam;
		STR_GeneratePlaybackFastSpeed((INT16)lParam, oFormUniStr.mszUniStr, 0, UNISTR_LENGTH_MAX);
		OSDR_FormatUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr);
		pMessage->moParam.mwTimer = OMESSAGE_INFINITE_TIMEOUT;
		break;

	case MS_OP_MSG_PLAYSTATE_SLOW:		
		// Slight adjustment to make things look good:
		lParam = (lParam == 7) ? 8 : lParam;
		lParam = (lParam == -7) ? -8 : lParam;
		STR_GeneratePlaybackSlowSpeed((INT16)lParam, oFormUniStr.mszUniStr,0, UNISTR_LENGTH_MAX);
		OSDR_FormatUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr);
		pMessage->moParam.mwTimer = pMessageDescriptor->mwDefaultTimeout;
		break;

	case MS_OP_MSG_PLAYSTATE_NEXT:	
		
		eMsg = S_SKIPF;
 		pMessage->moParam.mwTimer = pMessageDescriptor->mwDefaultTimeout;
		break;

	case MS_OP_MSG_PLAYSTATE_PREV:	

 		eMsg = S_SKIPB;
 		pMessage->moParam.mwTimer = pMessageDescriptor->mwDefaultTimeout;
		break;

#ifdef IS_MP4_CAPABLE
	 case MS_OP_MSG_PLAYSTATE_PREV_CHAPTER: //Fall through
	 case MS_OP_MSG_PLAYSTATE_NEXT_CHAPTER:
	{
		
		int cBuffOffset = 0;
		
		
		if(MS_OP_MSG_PLAYSTATE_PREV_CHAPTER == MsOp)
		{
			cBuffOffset = STR_GenerateUnicodeChar(PRIVATE_SYMBOL_PREVIOUS, 
												((WORD*)oFormUniStr.mszUniStr ),
												cBuffOffset,
												UNISTR_LENGTH_MAX);
		}
		else
		{
			cBuffOffset = STR_GenerateUnicodeChar(PRIVATE_SYMBOL_NEXT, 
												((WORD*)oFormUniStr.mszUniStr ),
												cBuffOffset,
												UNISTR_LENGTH_MAX);
		}
		oFormUniStr.mszUniStr[cBuffOffset++] = UNICODE_SPACE;
			
		cBuffOffset = STR_GenerateOSDMESSAGEString(S_CHAPTER, 
												((WORD*)oFormUniStr.mszUniStr ),
												cBuffOffset,
												UNISTR_LENGTH_MAX);
			
	
		oFormUniStr.mszUniStr[cBuffOffset++] = UNICODE_SPACE;
		STR_GenerateNumericAndTotalNumeric((INT16)((lParam & MASK_HIGH16)>>16),
											   (INT16)(lParam & MASK_LOW16),
											   ((WORD*)oFormUniStr.mszUniStr),
											   cBuffOffset,
											   UNISTR_LENGTH_MAX+1);
		OSDR_FormatUniString((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr);
			
	
		pMessage->moParam.mwTimer = pMessageDescriptor->mwDefaultTimeout;
		break;
	 }
 #endif//IS_MP4_CAPABLE

#ifdef DVD_AUDIO_SUPPORT
	case MS_OP_MSG_PLAYSTATE_NEXT_INDEX:
		eMsg = S_DVDA_INDEX_UP;
		pMessage->moParam.mwTimer = pMessageDescriptor->mwDefaultTimeout;
		break;

	case MS_OP_MSG_PLAYSTATE_PREV_INDEX:
		eMsg = S_DVDA_INDEX_DOWN;
		pMessage->moParam.mwTimer = pMessageDescriptor->mwDefaultTimeout;
		break;
#endif //DVD_AUDIO_SUPPORT
	case MS_OP_MSG_PLAYSTATE_RETURN:
		eMsg = S_RETURN;
		pMessage->moParam.mwTimer = pMessageDescriptor->mwDefaultTimeout;
		break;

	case MS_OP_MSG_PLAYSTATE_ROOT_MENU:	
		eMsg = S_ROOT_MENU;
		pMessage->moParam.mwTimer = pMessageDescriptor->mwDefaultTimeout;
		break;

	case MS_OP_MSG_PLAYSTATE_TITLE_MENU:	
		eMsg = S_TITLE_MENU;
		pMessage->moParam.mwTimer = pMessageDescriptor->mwDefaultTimeout;
		break;

	case MS_OP_MSG_PLAYSTATE_LOADING_FILE:	
		eMsg = S_LOADING;
		pMessage->moParam.mwTimer = pMessageDescriptor->mwDefaultTimeout;
		break;

		case MS_OP_ON_DEFROST:
		MsOpMsgBeforeDefrost = pMessage->moParam.mMsOpMsg;
		// Fall through!
	default:
		bSaveAndUpdate = FALSE;
		break;
	}
	if(eMsg != S_NULL)
	{
		OSDR_GetFormUniStr_OsdMessage((FORMATED_UNICODE_STRING __NEAR*)&oFormUniStr, (UINT32) eMsg);
	}
	if(bSaveAndUpdate == TRUE)
	{
		pMessage->moParam.mMsOpMsg = MsOp;
		MsOp = MS_OP_MSO_MESSAGE_BUILD;
		lParam = (UINT32)&oFormUniStr;
	}

	MsOp = OMESSAGE_Operation(pThis, MsOp, lParam);

	// This code assumes we are going to freeze the menu in which is added this message
	// If the menu is always closed and not frozzen anymore, then it won't display.
	// Messages that can be restored on defrost
	switch(MsOp)
	{
	case MS_OP_ON_DEFROST:
		switch (MsOpMsgBeforeDefrost)
		{
		case MS_OP_MSG_PLAYSTATE_STOP:
		case MS_OP_MSG_PLAYSTATE_STOP_RESUME:
			// No need display, done when display the menu
			OMESSAGE_PLAYSTATE_Operation(pThis, MsOpMsgBeforeDefrost, 0);
			break;
		}
		break;
	}
	return MsOp;
}

/****************************************************************************************************
*	DEFINITION: Private functions
****************************************************************************************************/
STATIC void _SetTimeoutMaintainMessageState(MSO_MESSAGE __NEAR* pMessage, BOOL bStateValid, UINT16 wMaintainTimeout)
{
	if (bStateValid)
		pMessage->moParam.mwTimer = OMESSAGE_INFINITE_TIMEOUT;
	else if ((pMessage->moParam.mwTimer > wMaintainTimeout) || (pMessage->moParam.mwTimer == OMESSAGE_INFINITE_TIMEOUT))
		pMessage->moParam.mwTimer = wMaintainTimeout;
}

⌨️ 快捷键说明

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