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

📄 bdrom_app.cpp

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

    /* return time (converted to seconds) */
    return (secOutTime / 45000);
}

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

    if (fBDROMAppInit == FALSE)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("BDROMAppGetNumberOfAngles: BDROM App not initialized!\n"));
    }
    else
    {
        /* Get number of angles from module manager */
        ubNumAngles = ModMgrGetNumberOfAngles();
    }

    return (ubNumAngles);
}

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

    if (fBDROMAppInit == FALSE)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("BDROMAppGetNumberOfAudio: BDROM App not initialized!\n"));
    }
    else
    {
        /* Get number of audio streams from module manager */
        ubNumAudio = ModMgrGetNumberOfAudio();
    }

    return (ubNumAudio);
}

/**
 * BDROMAppGetCurrentAngle -- Get current angle number
 *
 * @param
 *      none
 *
 * @retval
 *      current angle number
 */
UBYTE   BDROMAppGetCurrentAngle(void)
{
    UBYTE ubAngle = 0;

    if (fBDROMAppInit == FALSE)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("BDROMAppGetCurrentAngle: BDROM App not initialized!\n"));
    }
    else
    {
        /* Get current angle from module manager */
        ubAngle = ModMgrGetCurrentAngle();
    }

    return (ubAngle);
}

/**
 * BDROMAppGetCurrentAudio -- Get current audio stream number
 *
 * @param
 *      none
 *
 * @retval
 *      current audio stream number
 */
UBYTE   BDROMAppGetCurrentAudio(void)
{
    UBYTE ubAudioStn = 0;

    if (fBDROMAppInit == FALSE)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("BDROMAppGetCurrentAngle: BDROM App not initialized!\n"));
    }
    else
    {
        /* Get current audio stream from module manager */
        ubAudioStn = ModMgrGetCurrentAudio();
    }

    return (ubAudioStn);
}

/**
 * BDROMAppGetPrimaryAudioLanguage -- Get language of primary audio stream
 *
 * @param
 *      usStreamNum - stream number of subtitle
 *
 * @retval
 *      Language code of audio stream
 */
ULONG BDROMAppGetPrimaryAudioLanguage(USHORT usStreamNum)
{
    if (fBDROMAppInit == FALSE)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("BDROMAppGetPrimaryAudioLanguage: BDROM App not initialized!\n"));
        return (0);
    }

    /* Get current audio stream from module manager */
    return ( ModMgrGetPrimaryAudioLanguageCode(usStreamNum) );
}

/**
 * BDROMAppGetSecondaryAudioLanguage -- Get language of secondary audio stream
 *
 * @param
 *      usStreamNum - stream number of subtitle
 *
 * @retval
 *      Language code of audio stream
 */
ULONG BDROMAppGetSecondaryAudioLanguage(USHORT usStreamNum)
{
    if (fBDROMAppInit == FALSE)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("BDROMAppGetPrimaryAudioLanguage: BDROM App not initialized!\n"));
        return (0);
    }

    /* Get current audio stream from module manager */
    return ( ModMgrGetSecondaryAudioLanguageCode(usStreamNum) );
}

/**
 * BDROMAppGetNumberOfSubtitles -- Get number of subtitles currently available
 *
 * @param
 *      none
 *
 * @retval
 *      Number of currently available subtitles
 */
USHORT BDROMAppGetNumberOfSubtitles(void)
{
    if (fBDROMAppInit == FALSE)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("BDROMAppGetCurrentAngle: BDROM App not initialized!\n"));
        return (0);
    }

    /* Get current audio stream from module manager */
    return ( ModMgrGetNumberOfPGTextST() );
}

/**
 * BDROMAppGetNumberOfTextSubtitleStyles -- Get number of text subtitles user styles currently available
 *
 * @param
 *      none
 *
 * @retval
 *      Number of currently available subtitles
 */
USHORT BDROMAppGetNumberOfTextSubtitleStyles(void)
{
    if (fBDROMAppInit == FALSE)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("BDROMAppGetNumberOfTextSubtitleStyles: BDROM App not initialized!\n"));
        return (0);
    }
    return ( ModMgrGetNumberOfTextSubtitleStyles() );
}

/**
 * BDROMAppGetCurrentTextSTUserStyle -- Get the currently selected text subtitles user style
 *
 * @param
 *      none
 *
 * @retval
 *      Number of currently available subtitles
 */
USHORT BDROMAppGetCurrentTextSTUserStyle(void)
{
    if (fBDROMAppInit == FALSE)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("BDROMAppGetCurrentTextSTUserStyle: BDROM App not initialized!\n"));
        return (0);
    }
    return ( ModMgrGetCurrentTextSTUserStyle() );
}

/**
 * BDROMAppGetSubtitleState -- Determine if subtitles are allowed
 *
 * @param
 *      none
 *
 * @retval
 *      TRUE if navigator is in a state that subtitles are allowed.
 */
BOOLEAN BDROMAppGetSubtitleState(void)
{
    if (fBDROMAppInit == FALSE)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("BDROMAppGetSubtitleState: BDROM App not initialized!\n"));
        return (FALSE);
    }

    /* Get current subtitle permissions from the module manager */
    return ( ModMgrIsPGTextSTDisplayProhibited() ? FALSE : TRUE );
}

/**
 * BDROMAppIsSubtitleOn -- Get state of subtitles
 *
 * @param
 *      none
 *
 * @retval
 *      If there is a subtitle stream that is on, return TRUE
 */
BOOLEAN BDROMAppIsSubtitleOn(void)
{
    if (fBDROMAppInit == FALSE)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("BDROMAppIsSubtitleOn: BDROM App not initialized!\n"));
        return (FALSE);
    }

    /* is subtitle display on? */
    return ( ModMgrGetPGTextSTDisplayState() );
}

/**
 * BDROMAppIsPopupOn -- Return the Popup Menu On/Off State.
 *
 * @param
 *      None
 *
 * @retval
 *      FALSE - Pop up is OFF
 *      TRUE  - Pop up is ON
 */
BOOLEAN BDROMAppIsPopupOn(void)
{
    if (fBDROMAppInit == FALSE)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("BDROMAppIsPopupOn: BDROM App not initialized!\n"));
        return (FALSE);
    }

    return ( ModMgrIsPopupOn() );
}

/**
 * BDROMAppGetRepeatMode -- Return the repeat mode
 *
 * @param
 *      None
 *
 * @retval
 *      VDVD_INFO_REPEAT repeat mode
 */
USHORT  BDROMAppGetRepeatMode(void)
{
    if (fBDROMAppInit == FALSE)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("BDROMAppGetRepeatMode: BDROM App not initialized!\n"));
        return (VDVD_INFO_REPEAT_OFF);
    }

    return ( ModMgrGetRepeatMode() );
}

/**
 * BDROMAppGetCurrentSubtitleStream -- Get currently active subtitle stream
 *
 * @param
 *      none
 *
 * @retval
 *      Subtitle stream number of the currently selected subtitle
 */
USHORT BDROMAppGetCurrentSubtitleStream(void)
{
    if (fBDROMAppInit == FALSE)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("BDROMAppGetCurrentSubtitleStream: BDROM App not initialized!\n"));
        return (0);
    }

    /* Get current audio stream from module manager */
    return ( ModMgrGetCurrentPGTextST() );
}

/**
 * BDROMAppGetSubtitleLanguage -- Get language of subtitle stream
 *
 * @param
 *      usStreamNum - stream number of subtitle
 *
 * @retval
 *      Language code of subtitle with stream number = usStreamNum
 */
ULONG BDROMAppGetSubtitleLanguage(USHORT usStreamNum)
{
    if (fBDROMAppInit == FALSE)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("BDROMAppGetSubtitleLanguage: BDROM App not initialized!\n"));
        return (0);
    }

    /* Get current audio stream from module manager */
    return ( ModMgrGetPGTextSTLanguageCode(usStreamNum) );
}

/**
 * BDROMAppGetTimeDisplayState -- Get permission state of displaying time
 *
 * @param
 *      none
 *
 * @retval
 *      TRUE if time display is allowed, FALSE otherwise
 */
BOOLEAN BDROMAppGetTimeDisplayState(void)
{
    if (fBDROMAppInit == FALSE)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("BDROMAppGetTimeDisplayState: BDROM App not initialized!\n"));
        return (FALSE);
    }

    return ( ModMgrIsTimeDisplayProhibited() ? FALSE : TRUE );
}

/**
 * BDROMAppDiscEject -- Tell BD-J app a tray eject has been requested. This is
 * required in order to support the disc "unbound" titles.
 *
 * @param pfIsDiscUnbound if BD-J title is disc bound or unbound
 *
 * @retval
 *      BDAPP_STATUS
 */
BDAPP_STATUS BDROMAppDiscEject(BOOLEAN *pfIsDiscUnbound)
{
    if (fBDROMAppInit == FALSE)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("BDROMAppDiscEject: BDROM app not initialized\n"));
        return (BDAPP_FAILURE);
    }

    if (ModMgrDiscEject(pfIsDiscUnbound) != MODMGR_SUCCESS)
    {
        return (BDAPP_FAILURE);
    }

    return (BDAPP_SUCCESS);
}

/**
 * BDROMAppDiscInsert -- Inform BD-J unbound title of tray insert event
 *
 * @param
 *      none
 *
 * @retval
 *      BDAPP_STATUS
 */
BDAPP_STATUS BDROMAppDiscInsert(void)
{
    if (fBDROMAppInit == FALSE)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("BDROMAppDiscInsert: BDROM app not initialized\n"));
        return (BDAPP_FAILURE);
    }

    if (ModMgrDiscInsert() != MODMGR_SUCCESS)
    {
        return (BDAPP_FAILURE);
    }

    return (BDAPP_SUCCESS);
}

/**
 * bdromappLoadPlayerCapabilities -- Load the player capabilities from the PE and
 *                                   set the capabilities in the bdrom navigator.
 *
 * @param
 *      pe -- handle to the pe
 *
 * @retval
 *      OS_OK if successful
 *      OS_FAILURE if not successful
 */
static OS_STATUS bdromappLoadPlayerCapabilities(PE_HANDLE pe)
{
    int     regAudioCapability      = 0;
    int     regTextSTCapability     = 0;
    ULONG   iconfigAudioCapable     = AUDIO_CAPABLE_INVALID;
    ULONG   iconfigTextSTCapable    = TEXTST_CAPABLE_INVALID;

    /* Get player's audio capabilities from the PE */
    if (PEiConfigureGetAudioCapability(pe, &iconfigAudioCapable) != PE_SUCCESS)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("bdromappLoadPlayerCapabilities: failed to get audio capabilites!\n"));
        return (OS_FAILURE);
    }

    /* Get player's text subtitle capabilities from the PE */
    if (PEiConfigureGetTextSTCapability(pe, &iconfigTextSTCapable) != PE_SUCCESS)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("bdromappLoadPlayerCapabilities: failed to get textst capabilites!\n"));
        return (OS_FAILURE);
    }

    /* Check LPCM 192 Khz capabilities */
    if ( (iconfigAudioCapable & AUDIO_CAPABLE_LPCM_192) != AUDIO_CAPABLE_INVALID)
    {
        if ( (iconfigAudioCapable & AUDIO_CAPABLE_SURROUND) != AUDIO_CAPABLE_INVALID)
        {
            /* Player is surround capable for LPCM 192Khz sampling frequency */
            regAudioCapability |= 0x00000008;
        }
        else
        {
            /* Player is stereo capable for LPCM 192Khz sampling frequency */
            regAudioCapability |= 0x00000004;
        }
    }

    /* Check LPCM 48/96 Khz capabilities */
    if ( (iconfigAudioCapable & AUDIO_CAPABLE_LPCM_48_96) != AUDIO_CAPABLE_INVALID)
    {
        if ( (iconfigAudioCapable & AUDIO_CAPABLE_SURROUND) != AUDIO_CAPABLE_INVALID)
        {
            /* Player is surround capable for LPCM sampling frequencies of 48/96Khz */
            regAudioCapability |= 0x00000002;
        }
        else
        {
            /* Player is stereo capable for LPCM sampling frequencies of 48/96Khz */
            regAudioCapability |= 0x00000001;
        }
    }

    /* Check Dolby Digital (AC-3) capabilities */
    if ( (iconfigAudioCapable & AUDIO_CAPABLE_AC3) != AUDIO_CAPABLE_INVALID)
    {
        if ( (iconfigAudioCapable & AUDIO_CAPABLE_SURROUND) != AUDIO_CAPABLE_INVALID)
        {
            /* Player is surround capable for AC3 */
            regAudioCapability |= 0x00002020;
        }
        else
        {
            /* Player is stereo capable for AC3 */
            regAudioCapability |= 0x00001010;
        }
    }

    /* Check DTS capabilities */
    if ( (iconfigAudioCapable & AUDIO_CAPABLE_DTS) != AUDIO_CAPABLE_INVALID)
    {
        if ( (iconfigAudioCapable & AUDIO_CAPABLE_SURROUND) != AUDIO_CAPABLE_INVALID)
        {
            /* Player is surround capable for DTS */
            regAudioCapability |= 0x00000200;
        }
        else
        {
            /* Player is stereo capable for DTS */
            regAudioCapability |= 0x00000100;
        }
    }

    /* Check Dolby Digital Plus capabilities */
    if ( (iconfigAudioCapable & AUDIO_CAPABLE_DD_PLUS) != AUDIO_CAPABLE_INVALID)
    {
        if ( (iconfigAudioCapable & AUDIO_CAPABLE_SURROUND) != AUDIO_CAPABLE_INVALID)
        {
            /* Player is surround capable for Dolby Digital Plus */
            regAudioCapability |= 0x00000080;
        }
        else
        {
            /* Player is stereo capable for Dolby Digital Plus */
            regAudioCapability |= 0x00000040;
        }
    }

    /* Check DTS-HD capabilities */
    if ( (iconfigAudioCapable & AUDIO_CAPABLE_DTS_HD) != AUDIO_CAPABLE_INVALID)
    {
        if ( (iconfigAudioCapable & AUDIO_CAPABLE_SURROUND) != AUDIO_CAPABLE_INVALID)
        {
            /* Player is surround capable for DTS-HD */
            regAudioCapability |= 0x00000800;
        }
        else
        {
            /* Player is stereo capable for DTS-HD */
            regAudioCapability |= 0x00000400;
        }
    }

    /* Check Dolby Lossless capabilities */
    if ( (iconfigAudioCapable & AUDIO_CAPABLE_DOLBY_LOSSLESS) != AUDIO_CAPABLE_INVALID)
    {
        if ( (iconfigAudioCapable & AUDIO_CAPABLE_SURROUND) != AUDIO_CAPABLE_INVALID)

⌨️ 快捷键说明

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