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

📄 navcmd.cpp

📁 这是DVD中伺服部分的核心代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:

/**
 * NavCmdJumpObject
 *
 * @param
 *      hCmdProc        -- handle to the command processor private data
 *      pCommand        -- pointer to the command to be executed
 *      pulStatusParam  -- pointer to the parameter associated with the return status
 *
 * @retval
 *      CMDPROC_STATUS
 */
CMDPROC_STATUS  NavCmdJumpObject(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
    ULONG uiDstType;

#if DBG_ON(DBG_VERBOSE)
    DbgPrint(("NavCmdJumpObject: ENTER\n"));
#endif

    /* check for valid handle */
    if (hCmdProc == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdJumpObject: Invalid handle!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* check for valid command pointer */
    if (pCommand == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdJumpObject: Invalid command pointer!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* check for valid status parameter pointer */
    if (pulStatusParam == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdJumpObject: Invalid handle!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* get destination operand type */
    uiDstType = NavCmdGetDstOperandType(pCommand->ulOpCode);

    /*
     * If Destination operand is a register number, get the register value.
     * If it is an immediate value, then use that value.
     * Otherwise, return an error.
     */
    if (uiDstType == NAVCMD_OPERAND_REG)
    {
        /* Get mobj id value from specified register */
        *pulStatusParam = NavCmdGetRegisterValue(pCommand->ulDstOperand);
    }
    else if (uiDstType == NAVCMD_OPERAND_IMM)
    {
        /* Set mobj id to the immediate value */
        *pulStatusParam = pCommand->ulDstOperand;
    }
    else
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdJumpObject: Invalid operand type!\n"));
        return (CMDPROC_FAILURE);
    }

    if (hCmdProc->tState == CMDPROC_STATE_BUTTON_PROCESSING)
    {
        /* End of button command program, so return to waiting state */
        hCmdProc->tState = CMDPROC_STATE_WAITING;
    }

    /* signal that a transition needs to occur */
    hCmdProc->fTransitionPending = TRUE;

    return (CMDPROC_JUMP_OBJECT);
}

/**
 * NavCmdJumpTitle
 *
 * @param
 *      hCmdProc        -- handle to the command processor private data
 *      pCommand        -- pointer to the command to be executed
 *      pulStatusParam  -- pointer to the parameter associated with the return status
 *
 * @retval
 *      CMDPROC_STATUS
 */
CMDPROC_STATUS  NavCmdJumpTitle(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
    ULONG uiDstType;

#if DBG_ON(DBG_VERBOSE)
    DbgPrint(("NavCmdJumpTitle: ENTER\n"));
#endif

    /* check for valid handle */
    if (hCmdProc == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdJumpTitle: Invalid handle!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* check for valid command pointer */
    if (pCommand == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdJumpTitle: Invalid command pointer!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* check for valid status parameter pointer */
    if (pulStatusParam == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdJumpTitle: Invalid handle!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* get destination operand type */
    uiDstType = NavCmdGetDstOperandType(pCommand->ulOpCode);

    /*
     * If Destination operand is a register number, get the register value.
     * If it is an immediate value, then use that value.
     * Otherwise, return an error.
     */
    if (uiDstType == NAVCMD_OPERAND_REG)
    {
        /* Get title number value from specified register */
        *pulStatusParam = NavCmdGetRegisterValue(pCommand->ulDstOperand);
    }
    else if (uiDstType == NAVCMD_OPERAND_IMM)
    {
        /* Set title number to the immediate value */
        *pulStatusParam = pCommand->ulDstOperand;
    }
    else
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdJumpTitle: Invalid operand type!\n"));
        return (CMDPROC_FAILURE);
    }

    if (hCmdProc->tState == CMDPROC_STATE_BUTTON_PROCESSING)
    {
        /* End of button command program, so return to waiting state */
        hCmdProc->tState = CMDPROC_STATE_WAITING;
    }

    /* signal that a transition needs to occur */
    hCmdProc->fTransitionPending = TRUE;

    return (CMDPROC_JUMP_TITLE);
}

/**
 * NavCmdCallObject
 *
 * @param
 *      hCmdProc        -- handle to the command processor private data
 *      pCommand        -- pointer to the command to be executed
 *      pulStatusParam  -- pointer to the parameter associated with the return status
 *
 * @retval
 *      CMDPROC_STATUS
 */
CMDPROC_STATUS  NavCmdCallObject(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
    ULONG uiDstType;

#if DBG_ON(DBG_VERBOSE)
    DbgPrint(("NavCmdCallObject: ENTER\n"));
#endif

    /* check for valid handle */
    if (hCmdProc == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdCallObject: Invalid handle!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* check for valid command pointer */
    if (pCommand == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdCallObject: Invalid command pointer!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* check for valid status parameter pointer */
    if (pulStatusParam == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdCallObject: Invalid handle!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* get destination operand type */
    uiDstType = NavCmdGetDstOperandType(pCommand->ulOpCode);

    /*
     * If Destination operand is a register number, get the register value.
     * If it is an immediate value, then use that value.
     * Otherwise, return an error.
     */
    if (uiDstType == NAVCMD_OPERAND_REG)
    {
        /* Get mobj id value from specified register */
        *pulStatusParam = NavCmdGetRegisterValue(pCommand->ulDstOperand);
    }
    else if (uiDstType == NAVCMD_OPERAND_IMM)
    {
        /* Set mobj id to the immediate value */
        *pulStatusParam = pCommand->ulDstOperand;
    }
    else
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdCallObject: Invalid operand type!\n"));
        return (CMDPROC_FAILURE);
    }

    if (hCmdProc->tState == CMDPROC_STATE_BUTTON_PROCESSING)
    {
        /* End of button command program, so return to waiting state */
        hCmdProc->tState = CMDPROC_STATE_WAITING;
    }

    /* signal that a transition needs to occur */
    hCmdProc->fTransitionPending = TRUE;

    return (CMDPROC_CALL_OBJECT);
}

/**
 * NavCmdCallTitle
 *
 * @param
 *      hCmdProc        -- handle to the command processor private data
 *      pCommand        -- pointer to the command to be executed
 *      pulStatusParam  -- pointer to the parameter associated with the return status
 *
 * @retval
 *      CMDPROC_STATUS
 */
CMDPROC_STATUS  NavCmdCallTitle(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
    ULONG uiDstType;

#if DBG_ON(DBG_VERBOSE)
    DbgPrint(("NavCmdCallTitle: ENTER\n"));
#endif

    /* check for valid handle */
    if (hCmdProc == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdCallTitle: Invalid handle!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* check for valid command pointer */
    if (pCommand == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdCallTitle: Invalid command pointer!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* check for valid status parameter pointer */
    if (pulStatusParam == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdCallTitle: Invalid handle!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* get destination operand type */
    uiDstType = NavCmdGetDstOperandType(pCommand->ulOpCode);

    /*
     * If Destination operand is a register number, get the register value.
     * If it is an immediate value, then use that value.
     * Otherwise, return an error.
     */
    if (uiDstType == NAVCMD_OPERAND_REG)
    {
        /* Get title number value from specified register */
        *pulStatusParam = NavCmdGetRegisterValue(pCommand->ulDstOperand);
    }
    else if (uiDstType == NAVCMD_OPERAND_IMM)
    {
        /* Set title number to the immediate value */
        *pulStatusParam = pCommand->ulDstOperand;
    }
    else
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdCallTitle: Invalid operand type!\n"));
        return (CMDPROC_FAILURE);
    }

    if (hCmdProc->tState == CMDPROC_STATE_BUTTON_PROCESSING)
    {
        /* End of button command program, so return to waiting state */
        hCmdProc->tState = CMDPROC_STATE_WAITING;
    }

    /* signal that a transition needs to occur */
    hCmdProc->fTransitionPending = TRUE;

    return (CMDPROC_CALL_TITLE);
}

/**
 * NavCmdResume
 *
 * @param
 *      hCmdProc        -- handle to the command processor private data
 *      pCommand        -- pointer to the command to be executed
 *      pulStatusParam  -- pointer to the parameter associated with the return status
 *
 * @retval
 *      CMDPROC_STATUS
 */
CMDPROC_STATUS  NavCmdResume(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
#if DBG_ON(DBG_VERBOSE)
    DbgPrint(("NavCmdResume: ENTER\n"));
#endif

    /* check for valid handle */
    if (hCmdProc == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdResume: Invalid handle!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    if (hCmdProc->tState == CMDPROC_STATE_BUTTON_PROCESSING)
    {
        /* End of button command program, so return to waiting state */
        hCmdProc->tState = CMDPROC_STATE_WAITING;
    }

    /* signal that a transition needs to occur */
    hCmdProc->fTransitionPending = TRUE;

    return (CMDPROC_RESUME_OBJECT);
}

/**
 * NavCmdPlayPL
 *
 * @param
 *      hCmdProc        -- handle to the command processor private data
 *      pCommand        -- pointer to the command to be executed
 *      pulStatusParam  -- pointer to the parameter associated with the return status
 *
 * @retval
 *      CMDPROC_STATUS
 */
CMDPROC_STATUS  NavCmdPlayPL(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
    uint32 uiDstType;
    ULONG   ulPlaylist;

#if DBG_ON(DBG_VERBOSE)
    DbgPrint(("NavCmdPlayPL: ENTER\n"));
#endif

    /* check for valid handle */
    if (hCmdProc == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdPlayPL: Invalid handle!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* check for valid command pointer */
    if (pCommand == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdPlayPL: Invalid command pointer!\n"));
        return (CMDPROC_NULL_POINTER);
    }

    /* Only a movie object can execute this command */
    if (hCmdProc->tState != CMDPROC_STATE_MOVIE_PROCESSING)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdPlayPL: Command not allowed!\n"));
        return (CMDPROC_FAILURE);
    }

    /* get destination operand type */
    uiDstType = NavCmdGetDstOperandType(pCommand->ulOpCode);

    /*
     * If Destination operand is a register number, get the register value.
     * If it is an immediate value, then use that value.
     * Otherwise, return an error.
     */
    if (uiDstType == NAVCMD_OPERAND_REG)
    {
        /* Get playlist id value from specified register */
        ulPlaylist = NavCmdGetRegisterValue(pCommand->ulDstOperand);
    }
    else if (uiDstType == NAVCMD_OPERAND_IMM)
    {
        /* Set playlist id to the immediate value */
        ulPlaylist = pCommand->ulDstOperand;
    }
    else
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdPlayPL: Invalid operand type!\n"));
        return (CMDPROC_FAILURE);
    }

    /* Entering playback control critical section */
    PlayCtrlTakeSemaphore();

    /* Tell playback control engine to play playlist */
    if (PlayCtrlPlayPLPlayItem(ulPlaylist, 0) != PLAYCTRL_SUCCESS)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdPlayPL: Failed to play playlist!\n"));
        PlayCtrlGiveSemaphore();
        return (CMDPROC_FAILURE);
    }

    /* Leaving playback control critical section */
    PlayCtrlGiveSemaphore();

    /* Send command processor to the waiting state */
    hCmdProc->tState = CMDPROC_STATE_WAITING;

    /* signal that a transition needs to occur */
    hCmdProc->fTransitionPending = TRUE;

    return (CMDPROC_WAITING);
}

/**
 * NavCmdPlayPLatPI
 *
 * @param
 *      hCmdProc        -- handle to the command processor private data
 *      pCommand        -- pointer to the command to be executed
 *      pulStatusParam  -- pointer to the parameter associated with the return status
 *
 * @retval
 *      CMDPROC_STATUS

⌨️ 快捷键说明

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