📄 cmdproc.cpp
字号:
}
/* Check for valid command program buffer */
if (pButtonProgram == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("CmdProcProcessButtonProgram: Invalid command program buffer!\n"));
return (CMDPROC_NULL_POINTER);
}
/* Check for valid command program size */
if (ulNumberOfCommands > MVOBJ_MAX_BUTTON_NAV_COMMANDS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("CmdProcProcessButtonProgram: Invalid command program size!\n"));
return (CMDPROC_FAILURE);
}
/* Check for valid status param pointer */
if (pulStatusParam == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("CmdProcProcessMovieProgram: Invalid status parameter pointer!\n"));
return (CMDPROC_NULL_POINTER);
}
/*
* The command processor must be in the waiting state, with a playlist playing,
* to be able to execute a button object command program.
*/
if (hCmdProc->tState != CMDPROC_STATE_WAITING)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("CmdProcProcessButtonProgram: Invalid state for processing a button program!\n"));
}
else
{
/* Copy command program */
memcpy( (void *)hCmdProc->ButtonPrgm.aCommands, (void *)pButtonProgram, (ulNumberOfCommands * sizeof(MVOBJ_NAV_COMMAND) ) );
/* Set command program length and current command ID */
hCmdProc->ButtonPrgm.ulLength = ulNumberOfCommands;
hCmdProc->ButtonPrgm.ulCurrentCmdID = 0;
/* Set the state of the command processor to processing */
hCmdProc->tState = CMDPROC_STATE_BUTTON_PROCESSING;
hCmdProc->fTransitionPending = FALSE;
/* Execute the command program */
tStatus = CmdProcExecuteCommandProgram(&hCmdProc->ButtonPrgm, pulStatusParam);
}
return (tStatus);
}
/**
* CmdProcGetNVTimerJumpObject -- Get the Movie Object ID of movie object that should
* be jumped to when navigation timer expires.
*
* @param
* pulMvObjID - Pointer to variable that gets set to movie object id.
*
* @retval
* Command ID of where Movie Program was suspended.
*/
CMDPROC_STATUS CmdProcGetNVTimerJumpObject(ULONG *pulMvObjID)
{
if (hCmdProc == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("CmdProcGetNVTimerJumpObject: Command Processor not initialized!\n"));
return (CMDPROC_FAILURE);
}
/* Check for valid mvobj id pointer */
if (pulMvObjID == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("CmdProcGetNVTimerJumpObject: NULL pointer!\n"));
return (CMDPROC_NULL_POINTER);
}
/* Set movie object id */
*pulMvObjID = hCmdProc->uiNVTimerJumpObj;
return (CMDPROC_SUCCESS);
}
/**
* CmdProcRepeatOn -- Turn repeat on for the active playlist.
*
* @param
* fOnOff - TRUE = repeat on, FALSE = repeat off
*
* @retval
* CMDPROC_STATUS
*/
CMDPROC_STATUS CmdProcSetRepeat(BOOLEAN fOnOff)
{
if (hCmdProc == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("CmdProcSetRepeat: Command Processor not initialized!\n"));
return (CMDPROC_FAILURE);
}
/*
* The command processor must be in the waiting state, with a playlist playing,
* to be able to set repeat mode.
*/
if (hCmdProc->tState != CMDPROC_STATE_WAITING)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("CmdProcRepeatOn: Invalid state for setting repeat mode!\n"));
return (CMDPROC_FAILURE);
}
/* Set repeat flag */
hCmdProc->fTitleRepeatOn = fOnOff;
return (CMDPROC_SUCCESS);
}
/**
* CmdProcIsRepeatOn -- Return repeat on flag.
*
* @param
* none
*
* @retval
* TRUE if repeat is on
* FALES if repeat is off
*/
BOOLEAN CmdProcIsRepeatOn(void)
{
if (hCmdProc == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("CmdProcIsRepeatOn: Command Processor not initialized!\n"));
return (FALSE);
}
return (hCmdProc->fTitleRepeatOn);
}
/**
* CmdProcGetNavCmdID -- Return current movie navigation command id.
*
* @param
* none
*
* @retval
* command id
*/
uint32 CmdProcGetNavCmdID(void)
{
if (hCmdProc == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("CmdProcGetNavCmdID: Command Processor not initialized!\n"));
return (FALSE);
}
return (hCmdProc->MoviePrgm.ulCurrentCmdID);
}
/**
* CmdProcMapNavCmdFunctions -- Map function pointers to navigation command routines
*
* @param
* none
*
* @retval
* CMDPROC_SUCCESS if successful
* CMDPROC_FAILURE otherwise
*/
static CMDPROC_STATUS CmdProcMapNavCmdFunctions(void)
{
if ( (hCmdProc == NULL) || (hCmdProc->pvCmdFunction == NULL) )
{
DBGPRINT(DBG_ON(DBG_ERROR), ("CmdProcMapNavCmdFunctions: ERROR!\n"));
return (CMDPROC_FAILURE);
}
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_NOP] = NavCmdNop;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_GOTO] = NavCmdGoto;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_BREAK] = NavCmdBreak;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_JUMP_OBJECT] = NavCmdJumpObject;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_JUMP_TITLE] = NavCmdJumpTitle;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_CALL_OBJECT] = NavCmdCallObject;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_CALL_TITLE] = NavCmdCallTitle;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_RESUME] = NavCmdResume;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_PLAY_PL] = NavCmdPlayPL;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_PLAY_PLATPI] = NavCmdPlayPLatPI;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_PLAY_PLATMK] = NavCmdPlayPLatMK;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_TERMINATE_PL] = NavCmdTerminatePL;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_LINK_PI] = NavCmdLinkPI;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_LINK_MK] = NavCmdLinkMK;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_STILL_ON] = NavCmdStillOn;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_STILL_OFF] = NavCmdStillOff;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_BC] = NavCmdBC;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_EQ] = NavCmdEQ;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_NE] = NavCmdNE;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_GE] = NavCmdGE;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_GT] = NavCmdGT;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_LE] = NavCmdLE;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_LT] = NavCmdLT;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_MOVE] = NavCmdMove;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_SWAP] = NavCmdSwap;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_ADD] = NavCmdAdd;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_SUB] = NavCmdSub;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_MULT] = NavCmdMul;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_DIV] = NavCmdDiv;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_MOD] = NavCmdMod;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_RND] = NavCmdRnd;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_AND] = NavCmdAnd;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_OR] = NavCmdOr;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_XOR] = NavCmdXor;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_BIT_SET] = NavCmdBitSet;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_BIT_CLEAR] = NavCmdBitClear;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_SHIFT_LEFT] = NavCmdShiftLeft;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_SHIFT_RIGHT] = NavCmdShiftRight;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_SET_STREAM] = NavCmdSetStream;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_SET_NV_TIMER] = NavCmdSetNVTimer;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_SET_BUTTON_PAGE] = NavCmdSetButtonPage;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_ENABLE_BUTTON] = NavCmdEnableButton;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_DISABLE_BUTTON] = NavCmdDisableButton;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_SET_SECONDARY_STREAM] = NavCmdSetSecondaryStream;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_POPUP_MENU_OFF] = NavCmdPopupMenuOff;
#ifdef DRM_BDPLUS_SUPPORT
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_SET_MESSAGE_BDPLUS] = NavCmdSetMessageBDPlus;
( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[NAVCMD_SET_STATUS_BDPLUS] = NavCmdSetStatusBDPlus;
#endif
return (CMDPROC_SUCCESS);
}
/**
* CmdProcExecuteCommandProgram -- Execute a command program
*
* @param
* pCmdProgram -- pointer to command program to process
* pulStatusParam -- Pointer to parameter that is associated with the return status code
*
* @retval
* CMDPROC_SUCCESS if successful
* CMDPROC_FAILURE otherwise
*/
static CMDPROC_STATUS CmdProcExecuteCommandProgram(CMDPROC_CMD_PRGM *pCmdProgram, ULONG *pulStatusParam)
{
CMDPROC_STATUS tStatus = CMDPROC_SUCCESS;
NAVCMD_TYPE tCmdType;
if (pCmdProgram == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("CmdProcExecuteCommandProgram: Null pointer!\n"));
return (CMDPROC_NULL_POINTER);
}
/* Check for valid status param pointer */
if (pulStatusParam == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("CmdProcExecuteCommandProgram: Invalid status parameter pointer!\n"));
return (CMDPROC_NULL_POINTER);
}
/*
* Execute command program one command at a time until a transition
* occurs or an error occurs.
*/
while ( (hCmdProc->fTransitionPending == FALSE) && (tStatus == CMDPROC_SUCCESS) )
{
/* If end of command program is reached, stop execution */
if (pCmdProgram->ulCurrentCmdID >= pCmdProgram->ulLength)
{
DBGPRINT(DBG_ON(DBG_TRACE), ("CmdProcExecuteCommandProgram: Reached end of command program\n"));
if (hCmdProc->tState == CMDPROC_STATE_MOVIE_PROCESSING)
{
/* End of movie command program, so return to terminated state */
hCmdProc->tState = CMDPROC_STATE_TERMINATED;
}
else
{
/* End of button command program, so return to waiting state */
hCmdProc->tState = CMDPROC_STATE_WAITING;
}
/* done executing command program */
break;
}
/* Get the command type of the current command */
tCmdType = NavCmdGetCommandType(&pCmdProgram->aCommands[pCmdProgram->ulCurrentCmdID] );
/* check for a valid command type */
if (tCmdType < NAVCMD_INVALID)
{
if (hCmdProc->pvCmdFunction != NULL)
{
/* Fire function pointer to appropriate navigation command routine */
#if DBG_ON(DBG_VERBOSE)
NavToText(&pCmdProgram->aCommands[pCmdProgram->ulCurrentCmdID]);
#endif
tStatus = ( (NAVCMD_FUNC_PTR *)hCmdProc->pvCmdFunction)[tCmdType](hCmdProc, &pCmdProgram->aCommands[pCmdProgram->ulCurrentCmdID], pulStatusParam);
/* spec 10.2.3.2 if the command is a set button page or SetStream with ig_flag = 1
then stop execution */
if ((tCmdType == NAVCMD_SET_BUTTON_PAGE) && (hCmdProc->tState == CMDPROC_STATE_BUTTON_PROCESSING))
{
pCmdProgram->ulCurrentCmdID = pCmdProgram->ulLength;
hCmdProc->tState = CMDPROC_STATE_WAITING;
break;
}
/* 10.2.3.2 this is a SetStream button program with ig_flag=1, end program here */
if ((tCmdType == NAVCMD_SET_STREAM) && (hCmdProc->tState == CMDPROC_STATE_BUTTON_PROCESSING) &&
(pCmdProgram->aCommands[pCmdProgram->ulCurrentCmdID].ulSrcOperand & 0x80000000))
{
pCmdProgram->ulCurrentCmdID = pCmdProgram->ulLength;
hCmdProc->tState = CMDPROC_STATE_WAITING;
break;
}
}
else
{
DBGPRINT(DBG_ON(DBG_ERROR), ("CmdProcExecuteCommandProgram: NULL function pointer!\n"));
tStatus = CMDPROC_FAILURE;
break;
}
}
else
{
DBGPRINT(DBG_ON(DBG_ERROR), ("CmdProcExecuteCommandProgram: Unknown command!\n"));
}
/*
* If a transition is not occurring, then go to next command.
*/
if (hCmdProc->fTransitionPending == FALSE)
{
/* increment command id to next command */
pCmdProgram->ulCurrentCmdID++;
}
}
/* If command program failed, go into terminated state */
if (tStatus < CMDPROC_SUCCESS)
{
hCmdProc->tState = CMDPROC_STATE_TERMINATED;
}
return (tStatus);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -