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

📄 modmgr.cpp

📁 这是DVD中伺服部分的核心代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
        /* Get status register for chapter number */
        PlayCtrlGetPSR(PLAYCTRL_PSR_CHAPTER, &uiChapter);
            uiChapter &= 0x0000ffff;
        }
        else if ( (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_HDMV_INTERACTIVE) ||
                  (hModMgr->StateInfo.tActiveTitle == MODMGR_TITLE_BDJ_INTERACTIVE) )
        {
            uiChapter = PlayCtrlGetCurrentMark(ENTRY_MARK) + 1;
        }
    }

    return (uiChapter);
}



/**
 * ModMgrGetNumberOfChapters -- Get the number of chapters (or entry-marks)
 *
 * @param
 *      none
 *
 * @retval
 *      Chapter number
 */
USHORT ModMgrGetNumberOfChapters(void)
{
    ULONG usNumChapters = 0;

    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrGetNumberOfChapters: Module Manager not created!\n"));
    }
    else
    {
        usNumChapters = PlayCtrlGetNumberOfMarks(ENTRY_MARK);
    }

    return ( (USHORT)(usNumChapters) );
}


/**
 * ModMgrGetPlayItem -- Get the current playitem number
 *
 * @param
 *      none
 *
 * @retval
 *      PlayItem number
 */
ULONG  ModMgrGetPlayItem(void)
{
    uint32 uiPlayItemID = 0;

    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrGetChapter: Module Manager not created!\n"));
    }
    else
    {
        /* Get status register for playitem number */
        PlayCtrlGetPSR(PLAYCTRL_PSR_PLAYITEM, &uiPlayItemID);
    }

    return (uiPlayItemID & 0x0000ffff);
}

/**
 * ModMgrGetTitleDuration -- Get the total title time
 *
 * @param
 *      none
 *
 * @retval
 *      total length of the playlist (in units of 45khz clock)
 */
ULONG ModMgrGetTitleDuration(void)
{
    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrGetTitleDuration: Module Manager not created!\n"));
        return (0);
    }

    return ( PlayCtrlGetPlayListDuration() );
}

/**
 * ModMgrGetPlayTime -- Get the current title time
 *
 * @param
 *      none
 *
 * @retval
 *      current time into the playlist (in units of 45khz clock)
 */
ULONG ModMgrGetPlayTime(void)
{
    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrGetPlayTime: Module Manager not created!\n"));
        return (0);
    }

    return ( PlayCtrlGetCurrentPlayListTime() );
}


/**
 * ModMgrGetRawPTS -- Get the current time
 *
 * @param
 *      none
 *
 * @retval
 *      current raw pts (45kHz clock)
 */
ULONG  ModMgrGetRawPTS(void)
{
    ULONG ulTime = 0;

    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrGetRawPTS: Module Manager not created!\n"));
    }
    else
    {
        ulTime = (ULONG)PlayCtrlGetRawPTS();
    }

    return (ulTime);
}


/**
 * ModMgrGetNumberOfAngles -- Get the number of available angles
 *
 * @param
 *      none
 *
 * @retval
 *      Number of available angles
 */
UBYTE  ModMgrGetNumberOfAngles(void)
{
    UBYTE ubNumAngles = 0;

    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrGetNumberOfAngles: Module Manager not created!\n"));
    }
    else
    {
        /* Get number of angles from pbc engine */
        ubNumAngles = (UBYTE)PlayCtrlGetNumberOfAngles();
    }

    return (ubNumAngles);
}

/**
 * ModMgrGetNumberOfAudio -- Get the number of available audio streams
 *
 * @param
 *      none
 *
 * @retval
 *      Number of available audio streams
 */
UBYTE  ModMgrGetNumberOfAudio(void)
{
    UBYTE ubNumAudio = 0;

    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrGetNumberOfAudio: Module Manager not created!\n"));
    }
    else
    {
        /* Get number of audio streams from pbc engine */
        ubNumAudio = (UBYTE)PlayCtrlGetNumberOfAudio();
    }

    return (ubNumAudio);
}

/**
 * ModMgrGetCurrentAngle -- Get the current angle number
 *
 * @param
 *      none
 *
 * @retval
 *      Current angle number
 */
UBYTE  ModMgrGetCurrentAngle(void)
{
    uint32 uiAngle = 0;

    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrGetCurrentAngle: Module Manager not created!\n"));
    }
    else
    {
        /* Get status register for angle number */
        PlayCtrlGetPSR(PLAYCTRL_PSR_ANGLE, &uiAngle);
    }

    return ( (UBYTE)(uiAngle & 0x000000ff) );
}

/**
 * ModMgrGetCurrentAudio -- Get the current audio stream number
 *
 * @param
 *      none
 *
 * @retval
 *      Current audio stream number
 */
UBYTE  ModMgrGetCurrentAudio(void)
{
    uint32 uiAudioStn = 0;

    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrGetCurrentAudio: Module Manager not created!\n"));
    }
    else
    {
        /* Get status register for audio stream number */
        PlayCtrlGetPSR(PLAYCTRL_PSR_AUDIO_STN, &uiAudioStn);
    }

    return ( (UBYTE)(uiAudioStn & 0x000000ff) );
}

/**
 * ModMgrGetPrimaryAudioLanguageCode -- Get the Language code for the indicated audio stream
 *
 * @param
 *      usStreamNum - stream number
 *
 * @retval
 *      audio language code
 */
ULONG ModMgrGetPrimaryAudioLanguageCode(USHORT usStreamNum)
{
    STREAM_ATTRIBUTES attributes;
    ULONG             ulLangCode;

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

    if (PlayCtrlGetPrimaryAudioAttributes(usStreamNum, &attributes) != PLAYCTRL_SUCCESS)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrGetPrimaryAudioLanguageCode: FAILED!\n"));
        return (0);
    }

    /* get the language code */
    ulLangCode  = attributes.audio_language_code[0] << 16;
    ulLangCode |= attributes.audio_language_code[1] << 8;
    ulLangCode |= attributes.audio_language_code[2];

    return (ulLangCode);
}

/**
 * ModMgrGetSecondaryAudioLanguageCode -- Get the Language code for the indicated audio stream
 *
 * @param
 *      usStreamNum - stream number
 *
 * @retval
 *      audio language code
 */
ULONG ModMgrGetSecondaryAudioLanguageCode(USHORT usStreamNum)
{
    STREAM_ATTRIBUTES attributes;
    ULONG             ulLangCode;

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

    if (PlayCtrlGetSecondaryAudioAttributes(usStreamNum, &attributes) != PLAYCTRL_SUCCESS)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrGetSecondaryAudioLanguageCode: FAILED!\n"));
        return (0);
    }

    /* get the language code */
    ulLangCode  = attributes.audio_language_code[0] << 16;
    ulLangCode |= attributes.audio_language_code[1] << 8;
    ulLangCode |= attributes.audio_language_code[2];

    return (ulLangCode);
}

/**
 * ModMgrGetNumberOfPGTextST -- Get the number of available PG/textST streams
 *
 * @param
 *      none
 *
 * @retval
 *      Number of available audio streams
 */
USHORT ModMgrGetNumberOfPGTextST(void)
{
    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrGetNumberOfPGTextST: Module Manager not created!\n"));
        return (0);
    }

    /* Get number of audio streams from pbc engine */
    return ( (USHORT)(PlayCtrlGetNumberOfPGTextST()) );
}

/**
 * ModMgrGetCurrentPGTextST -- Get the current PG/ST stream number
 *
 * @param
 *      none
 *
 * @retval
 *      Current PG/ST stream number
 */
USHORT ModMgrGetCurrentPGTextST(void)
{
    uint32 uiSteamNumber;

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

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

    return ( (USHORT)(uiSteamNumber & 0x00000fff) );
}

/**
 * ModMgrGetNumberOfTextSubtitleStyles -- Get the number of available textST user styles
 *
 * @param
 *      none
 *
 * @retval
 *      Number of available textST user styles
 */
USHORT ModMgrGetNumberOfTextSubtitleStyles(void)
{
    if (hModMgr == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrGetNumberOfTextSubtitleStyles: Module Manager not created!\n"));
        return (0);
    }
    return ( PlayCtrlGetNumberOfTextSubtitleStyles() );
}

/**
 * ModMgrGetCurrentTextSTUserStyle -- Get the current textST user style
 *
 * @param
 *      none
 *
 * @retval
 *      The current textST user style
 */
USHORT ModMgrGetCurrentTextSTUserStyle(void)
{
    uint32 uiStyle;

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

    /* Get PSR 12 (user style) */
    PlayCtrlGetPSR(PLAYCTRL_PSR_SEL_STYLE, &uiStyle);

    return ( (USHORT)(uiStyle & 0x00000ff) );
}

/**
 * ModMgrGetPGTextSTLanguageCode -- Get the Language code for the indicated PG/ST stream
 *
 * @param
 *      usStreamNum - stream number
 *
 * @retval
 *      PG/ST language code
 */
ULONG ModMgrGetPGTextSTLanguageCode(USHORT usStreamNum)
{
    STREAM_ATTRIBUTES attributes;
    ULONG             ulLangCode;

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

    if (PlayCtrlGetPGTextSTAttributes(usStreamNum, &attributes) != PLAYCTRL_SUCCESS)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("ModMgrGetPGTextSTLanguageCode: FAILED!\n"));
        return (0);
    }

    if (attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_PG)
    {
        /* get the PG language code */
        ulLangCode  = attributes.PG_language_code[0] << 16;
        ulLangCode |= attributes.PG_language_code[1] << 8;
        ulLangCode |= attributes.PG_language_code[2];
    }
    else
    {
        /* get the TextST language code */
        ulLangCode  = attributes.textST_language_code[0] << 16;
        ulLangCode |= attributes.textST_language_code[1] << 8;
        ulLangCode |= attributes.textST_language_code[2];
    }

    return (ulLangCode);
}

/**
 * ModMgrGetPGTextSTDisplayState -- Are PG/ST being displayed.
 *
 * @param
 *      none
 *
 * @retval
 *      PG/ST display state ( TRUE = yes, FALSE = no )
 */

⌨️ 快捷键说明

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