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

📄 navcmd.cpp

📁 这是DVD中伺服部分的核心代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
 */
CMDPROC_STATUS  NavCmdPlayPLatPI(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
    uint32 uiDstType;
    uint32 uiSrcType;
    ULONG   ulPlaylist;
    ULONG   ulPlayitem;

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

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

    /* check for valid command pointer */
    if (pCommand == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdPlayPLatPI: 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), ("NavCmdPlayPLatPI: 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), ("NavCmdPlayPLatPI: Invalid operand type!\n"));
        return (CMDPROC_FAILURE);
    }

    /* get source operand type */
    uiSrcType = NavCmdGetSrcOperandType(pCommand->ulOpCode);

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

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

    /* Tell playback control engine to play playlist */
    if (PlayCtrlPlayPLPlayItem(ulPlaylist, ulPlayitem) != PLAYCTRL_SUCCESS)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdPlayPLatPI: 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);
}

/**
 * NavCmdPlayPLatMK
 *
 * @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  NavCmdPlayPLatMK(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
    uint32 uiDstType;
    uint32 uiSrcType;
    ULONG   ulPlaylist;
    ULONG   ulPlaymark;

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

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

    /* check for valid command pointer */
    if (pCommand == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdPlayPLatMK: 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), ("NavCmdPlayPLatMK: 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), ("NavCmdPlayPLatMK: Invalid operand type!\n"));
        return (CMDPROC_FAILURE);
    }

    /* get source operand type */
    uiSrcType = NavCmdGetSrcOperandType(pCommand->ulOpCode);

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

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

    /* Tell playback control engine to play playlist */
    if (PlayCtrlPlayPLMark( (int)ulPlaylist, (int)ulPlaymark, FALSE) != PLAYCTRL_SUCCESS)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdPlayPLatMK: 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);
}

/**
 * NavCmdTerminatePL
 *
 * @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  NavCmdTerminatePL(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
#if DBG_ON(DBG_VERBOSE)
    DbgPrint(("NavCmdTerminatePL: ENTER\n"));
#endif

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

    /* This command can only occur in a button object */
    if (hCmdProc->tState != CMDPROC_STATE_BUTTON_PROCESSING)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdTerminatePL: Command not allowed!\n"));
        return (CMDPROC_FAILURE);
    }

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

    /* Tell playback control engine to terminate playlist */
    if (PlayCtrlStop() != PLAYCTRL_SUCCESS)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdTerminatePL: Failed to terminate playlist!\n"));
        PlayCtrlGiveSemaphore();
        return (CMDPROC_FAILURE);
    }

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

    /* 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_PL_TERMINATED);
}

/**
 * NavCmdLinkPI
 *
 * @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  NavCmdLinkPI(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
    uint32 uiDstType;
    uint32 uiPlayitem;

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

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

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

    /* Only a button object can execute this command */
    if (hCmdProc->tState != CMDPROC_STATE_BUTTON_PROCESSING)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdLinkPI: 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 playitem id value from specified register */
        uiPlayitem = NavCmdGetRegisterValue(pCommand->ulDstOperand);
    }
    else if (uiDstType == NAVCMD_OPERAND_IMM)
    {
        /* Set playitem id to the immediate value */
        uiPlayitem = pCommand->ulDstOperand;
    }
    else
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdLinkPI: Invalid operand type!\n"));
        return (CMDPROC_FAILURE);
    }

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

    /* Tell playback control engine to link playitem */
    if (PlayCtrlLinkPlayItem(uiPlayitem) != PLAYCTRL_SUCCESS)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdLinkPI: Failed to link playitem!\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_SUCCESS);
}

/**
 * NavCmdLinkMK
 *
 * @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  NavCmdLinkMK(CMDPROC_HANDLE *hCmdProc, MVOBJ_NAV_COMMAND *pCommand, ULONG *pulStatusParam)
{
    uint32 uiDstType;
    uint32 uiPlaymark;

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

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

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

    /* Only a button object can execute this command */
    if (hCmdProc->tState != CMDPROC_STATE_BUTTON_PROCESSING)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdLinkMK: 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 playmark id value from specified register */
        uiPlaymark = NavCmdGetRegisterValue(pCommand->ulDstOperand);
    }
    else if (uiDstType == NAVCMD_OPERAND_IMM)
    {
        /* Set playmark id to the immediate value */
        uiPlaymark = pCommand->ulDstOperand;
    }
    else
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdLinkMK: Invalid operand type!\n"));
        return (CMDPROC_FAILURE);
    }

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

    /* Tell playback control engine to link play mark */
    if (PlayCtrlLinkMark(uiPlaymark, FALSE) != PLAYCTRL_SUCCESS)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("NavCmdLinkMK: Failed to link playmark!\n"));
        PlayCtrlGiveSemaphore();
        return (CMDPROC_FAILURE);
    }

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

⌨️ 快捷键说明

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