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

📄 modmgr.cpp

📁 这是DVD中伺服部分的核心代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
BOOLEAN ModMgrGetPGTextSTDisplayState(void)
{
    uint32 ioValue;

    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrGetPGTextSTDisplayState: Module Manager not created!\n"));
        return (FALSE);
    }

    /* Get status register for PG and text Subtitle stream number */
    PlayCtrlGetPSR(PLAYCTRL_PSR_PG_AND_ST_STN, &ioValue);

    return ( (ioValue & 0x80000000) ? TRUE : FALSE );
}

/**
 * ModMgrIsTimeDisplayProhibited -- Get the permission of displaying the time
 *
 * @param
 *      none
 *
 * @retval
 *      TRUE if time display is prohibited, FALSE is it is allowed
 */
BOOLEAN ModMgrIsPGTextSTDisplayProhibited(void)
{
    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrIsPGTextSTDisplayProhibited: Module Manager not created!\n"));
        return (TRUE);
    }

    /* todo - this needs extended, but at a min disallow when not playing a movie */
    return ( (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_NONE) ? TRUE : FALSE );
}


/**
 * ModMgrIsTimeDisplayProhibited -- Get the permission of displaying the time
 *
 * @param
 *      none
 *
 * @retval
 *      TRUE if time display is prohibited, FALSE is it is allowed
 */
BOOLEAN ModMgrIsTimeDisplayProhibited(void)
{
    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrIsPGTextSTDisplayProhibited: Module Manager not created!\n"));
        return (TRUE);
    }

    /* Time display is allowed only if active title is a movie title */
    return ( (hModMgr->StateInfo.tActiveTitle != MODMGR_TITLE_HDMV_MOVIE) ? TRUE : FALSE );
}

/**
 * ModMgrUOPMenuCall -- Implements the user operation to change the active title
 *                      to the TopMenu title defined in the index table.
 *
 * @param
 *      none
 *
 * @retval
 *      MODMGR_SUCCESS if successful
 *      MODMGR_FAILURE if not successful
 *      MODMGR_UOP_PROHIBITED if the user operation is currently prohibited
 */
MODMGR_STATUS ModMgrUOPMenuCall(void)
{
    MODMGR_STATUS   tStatus = MODMGR_FAILURE;

    DBGPRINT(DBG_ON(DBG_TRACE), ("ModMgrUOPMenuCall: ENTER\n"));

    /*
     * If we are already on the top menu and there is a suspended title that
     * we can resume to, then try to do the resume rather than a menu call.
     */
    if ( (0 == ModMgrGetTitle() ) && (hModMgr->SuspendedObj.fValid == TRUE) )
    {
        return ( ModMgrUOPResume() );
    }

    /* Check active title type */
    if ( (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_HDMV_MOVIE) ||
         (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_HDMV_INTERACTIVE) )
    {
        MVOBJ_TERMINFO  *pTermInfo = NULL;

        /* Get terminal info of current movie object */
        pTermInfo = MvObjGetTermInfo(hModMgr->ActiveObj.ObjID.ulHdmvMobjID);
        if (pTermInfo == NULL)
        {
            DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrUOPMenuCall: failed to get terminal info!\n"));
        }
        else
        {
            /* check the menu call mask */
            if (pTermInfo->fMenuCallMask == TRUE)
            {
                /* menu call operation is masked, so prohibit the operation */
                tStatus = MODMGR_UOP_PROHIBITED;
            }
            else
            {
                /*
                 * If resume intention flag is set, then the current movie object should
                 * be suspended before playing the top menu movie title (call title).
                 * If the flag is not set, then the current movie object should
                 * be terminated before playing the top menu movie title (jump title).
                 */
                if (pTermInfo->fResumeIntentionFlag == TRUE)
                {
                    /* Perform a call title, with title set to 0 to indicate top menu */
                    tStatus = ModMgrCallTitle(0);
                }
                else
                {
                    /* Perform a jump title, with title set to 0 to indicate top menu */
                    tStatus = ModMgrJumpTitle(0);
                }
            }
        }
    }
    else if (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_NONE)
    {
        /* Perform a jump title, with title set to 0 to indicate top menu */
        tStatus = ModMgrJumpTitle(0);
    }
#ifdef VDVD_ENABLE_BDJ
    else if ( (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_BDJ_MOVIE) ||
              (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_BDJ_INTERACTIVE) )
    {
        /* Call BD-J Module here */
        if ( menu_call_mask == TRUE )
        {
            /* menu call operation is masked, so prohibit the operation */
            tStatus = MODMGR_UOP_PROHIBITED;
        }
        else
        {
            /* Terminate the current BD-J object before playing the top menu title */
            tStatus = ModMgrJumpTitle(0);
        }
    }
#endif

    return (tStatus);
}

/**
 * ModMgrUOPTitleSearch -- Implements the user operation to start title playback.
 *
 * @param
 *      title_number -- specifies the title number to be played.
 *
 * @retval
 *      MODMGR_SUCCESS if successful
 *      MODMGR_FAILURE if not successful
 *      MODMGR_UOP_PROHIBITED if the user operation is currently prohibited
 */
MODMGR_STATUS ModMgrUOPTitleSearch(int title_number)
{
    MODMGR_STATUS   tStatus         = MODMGR_FAILURE;
    USHORT          *pusNumTitles   = NULL;
    INDEX_OBJ_REF   *pTitleObj      = NULL;

    DBGPRINT(DBG_ON(DBG_TRACE), ("ModMgrUOPTitleSearch: ENTER\n"));

    /* Get number of titles */
    pusNumTitles = IndexGetNumberOfTitles();
    if (pusNumTitles == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrUOPTitleSearch: failed to get number of titles!\n"));
        return (MODMGR_FAILURE);
    }

    /* Check that title number is valid */
    if ( (title_number <= 0) || (title_number > *pusNumTitles) )
    {
        DBGPRINT(DBG_ON(DBG_TRACE), ("ModMgrUOPTitleSearch: invalid title number; disallow!\n"));
        return (MODMGR_UOP_PROHIBITED);
    }

    /* Check active title type */
    if ( (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_HDMV_MOVIE) ||
         (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_HDMV_INTERACTIVE) )
    {
        MVOBJ_TERMINFO  *pTermInfo  = NULL;

        /* Get terminal info of current movie object */
        pTermInfo = MvObjGetTermInfo(hModMgr->ActiveObj.ObjID.ulHdmvMobjID);

        /* Get object info of title to be searched to */
        pTitleObj = IndexGetTitle(title_number);

        if ( (pTermInfo == NULL) || (pTitleObj == NULL) )
        {
            DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrUOPTitleSearch: failed to get title info!\n"));
        }
        else
        {
            /* check that title search to specified title is allowed */
            if ( (pTermInfo->fTitleSearchMask == TRUE) || (pTitleObj->tAccessType != INDEX_TITLE_ACCESS_PERMIT) )
            {
                /* title search operation is masked, so prohibit the operation */
                tStatus = MODMGR_UOP_PROHIBITED;
            }
            else
            {
                /* Perform a jump title */
                tStatus = ModMgrJumpTitle(title_number);
            }
        }
    }
    else if (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_NONE)
    {
        /* Get object info of title to be searched to */
        pTitleObj = IndexGetTitle(title_number);
        if (pTitleObj == NULL)
        {
            DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrUOPTitleSearch: failed to get title info!\n"));
        }
        else
        {
            /* check that title search to specified title is allowed */
            if (pTitleObj->tAccessType != INDEX_TITLE_ACCESS_PERMIT)
            {
                /* title search operation is masked, so prohibit the operation */
                tStatus = MODMGR_UOP_PROHIBITED;
            }
            else
            {
                /* Perform a jump title */
                tStatus = ModMgrJumpTitle(title_number);
            }
        }
    }
#ifdef VDVD_ENABLE_BDJ
    else if ( (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_BDJ_MOVIE) ||
              (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_BDJ_INTERACTIVE) )
    {
        /* Call BD-J Module here */
        if ( title_search_mask == TRUE )
        {
            /* title search operation is masked, so prohibit the operation */
            tStatus = MODMGR_UOP_PROHIBITED;
        }
        else
        {
            /* Perform a jump title */
            tStatus = ModMgrJumpTitle(title_number);
        }
    }
#endif

    return (tStatus);
}

/**
 * ModMgrUOPResume -- Implements the user operation to resume playback of a previously
 *                    suspended Movie Object.
 *
 * @param
 *      none
 *
 * @retval
 *      MODMGR_SUCCESS if successful
 *      MODMGR_FAILURE if not successful
 *      MODMGR_UOP_PROHIBITED if the user operation is currently prohibited
 */
MODMGR_STATUS ModMgrUOPResume(void)
{
    MODMGR_STATUS   tStatus = MODMGR_FAILURE;

    DBGPRINT(DBG_ON(DBG_TRACE), ("ModMgrUOPResume: ENTER\n"));

    /*
     * If suspended object is not valid, then resume is prohibited.
     * Otherwise, check the resume uo mask and perform resume if it is not masked.
     */
    if (hModMgr->SuspendedObj.fValid != TRUE)
    {
        tStatus = MODMGR_UOP_PROHIBITED;
    }
    else
    {
        /* Check active title type */
        if ( (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_HDMV_MOVIE) ||
             (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_HDMV_INTERACTIVE) ||
             (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_NONE) )
        {
            uint64 UO_mask_table = 0;

            /* Get UO Mask Table */
            if (PlayCtrlGetUOPMaskTable(&UO_mask_table) != PLAYCTRL_SUCCESS)
            {
                DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrUOPResume: failed to get UO Mask table!\n"));
            }
            else
            {
                /* check the resume mask */
                if ( (UO_mask_table & MODMGR_UOMASK_RESUME) != 0)
                {
                    /* Resume operation is masked, so prohibit the operation */
                    tStatus = MODMGR_UOP_PROHIBITED;
                }
                else
                {
                    /* Perform a resume operation */
                    tStatus = ModMgrResume();
                }
            }
        }
#ifdef VDVD_ENABLE_BDJ
        else if ( (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_BDJ_MOVIE) ||
                  (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_BDJ_INTERACTIVE) )
        {
            /* Call BD-J Module here */
        }
#endif
    }

    return (tStatus);
}

/**
 * ModMgrUOPPlay -- Implements the user operation to start playback of the
 *                  firstplay title defined in the index table.
 *
 * @param
 *      none
 *
 * @retval
 *      MODMGR_SUCCESS if successful
 *      MODMGR_FAILURE if not successful
 *      MODMGR_UOP_PROHIBITED if the user operation is currently prohibited
 */
MODMGR_STATUS ModMgrUOPPlay(void)
{
    MODMGR_STATUS   tStatus = MODMGR_SUCCESS;

    DBGPRINT(DBG_ON(DBG_TRACE), ("ModMgrUOPPlay: ENTER\n"));

    /* Check active title type */
    if ( (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_HDMV_MOVIE) ||
         (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_HDMV_INTERACTIVE) )
    {
        if (hModMgr->StateInfo.tState == MODMGR_STATE_HOLD)
        {
            /* Tell playback control engine to resume from pause */
            if (PlayCtrlPauseOff() == PLAYCTRL_SUCCESS)
            {
                uint32                  uiPGandTextST;
                PE_ISTREAMCTRL_IG_PARAM ig_param;
                PE_IG_UI_MODEL          ig_ui_model;

                /* Hide the splash screen */
                ModMgrSplashScreenHide();

                /* un-mute the video */
                PEiConfigureSetVideoMute(hModMgr->hPE, VIDEO_MUTE_OFF);

                /* Get the IG user interface model */
                if (PEiStreamCtrlGetIGUserInterfaceModel(hModMgr->hPE, &ig_ui_model) == PE_SUCCESS)
                {
                    /*
                     * If IG user interface model is always-on, then show the IG.
                     */
                    if (ig_ui_model == PE_IG_UI_MODEL_ALWAYS_ON)
                    {
                        /* IG user interface model is always-on, so show the IG */
                        ig_param.cmd = PE_IG_SHOW;
                        if (PEiStreamCtrlSendIGCmd(hModMgr->hPE, &ig_param) != PE_SUCCESS)
                        {
                            DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrUOPPlay: Failed to send IG command!\n"));
                            tStatus = MODMGR_FAILURE;
                        }
                    }
                }

                /* get PSR for pg/textst */
                PlayCtrlGetPSR(PLAYCTRL_PSR_PG_AND_ST_STN, &uiPGandTextST);

                /* if pg/textst display flag is set, then show the subtitles */
                if (uiPGandTextST & 0x80000000)
                {
                    /* show subtitles */
                    PEiConfigureShowSubPic(hModMgr->hPE);
                }

                /* change state */
                hModMgr->StateInfo.tState = MODMGR_STATE_RUNNING;
            }
            else
            {
                DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrUOPPlay: Failed to pause-off!\n"));
                tStatus = MODMGR_FAILURE;
            }

#ifdef DRM_SUPPORT
            /* If we are resuming from play, we have to re-read all the
             * content protection information and apply it to the output since it was cleared
             * when we stoped */

            /*
             * TODO: Set up macrovision, DOT, ICT, CGMS
             */
#endif

        }
        else
        {
            /* Start firstplay title by performing a jump title with title number 0xffff */
            tStatus = ModMgrJumpTitle(0xffff);
        }
    }
    else if (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_NONE)
    {
        /* Hide the splash screen */
        /*PEiSplashScreenHide(hModMgr->hPE);*/

        /*
         * If modmgr is in intitial terminated state, waiting for first play, then do a firstplay.
         * Otherwise, we are in full stop mode, so jump to the first title.
         */
        if (hModMgr->StateInfo.tState != MODMGR_STATE_TERMINATED_FIRSTPLAY)
        {
            /* Start playback at title 1.  If title search to title 1 is prohibited, do firstplay. */
            tStatus = ModMgrUOPTitleSearch(1);
            if (tStatus != MODMGR_SUCCESS)
            {
                DBGPRINT(DBG_ON(DBG_TRACE), ("ModMgrUOPPlay: Title search to title 1 prohibited.\n"));

                /* Start firstplay title by performing a jump title with title number 0xffff */
                tStatus = ModMgrJumpTitle(0xffff);
            }
        }
        else
        {
            /* Start firstplay title by performing a jump title with title number 0xffff */
            tStatus = ModMgrJumpTitle(0xffff);
        }
    }
#ifdef VDVD_ENABLE_BDJ
    else if ( (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_BDJ_MOVIE) ||
     

⌨️ 快捷键说明

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