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

📄 pbc_stnselect.cpp

📁 这是DVD中伺服部分的核心代码
💻 CPP
📖 第 1 页 / 共 4 页
字号:
                 * determine if it is capable of playing Dolby Digital Plus.
                 */
                if (fSurround == TRUE)
                {
                    /* Surround for both dependent and independent substreams */
                    fAudioCapability = ( (uiAudioConfig & 0x000000a0) == 0x000000a0);
                }
                else
                {
                    /* Stereo or Surround for both dependent and independent substreams */
                    fAudioCapability = ( (uiAudioConfig & 0x000000c0) != 0) && ( (uiAudioConfig & 0x00000030) != 0);
                }
            }
            else if (pStnTable->primary_audio_stream[uiStreamNumber-1].stream_attributes.stream_coding_type ==
                MPLS_STREAM_CODING_TYPE_DTS_HD)
            {
                /*
                 * Stream coding type is DTS-HD. Check audio capability of the player to
                 * determine if it is capable of playing DTS-HD.
                 */
                if (fSurround == TRUE)
                {
                    if (pStnTable->primary_audio_stream[uiStreamNumber-1].stream_attributes.audio_presentation_type == 6)
                    {
                        /* Surround for both extension and core substreams */
                        fAudioCapability = ( (uiAudioConfig & 0x00000a00) == 0x00000a00);
                    }
                    else if (pStnTable->primary_audio_stream[uiStreamNumber-1].stream_attributes.audio_presentation_type == 12)
                    {
                        /* Surround for extension substream and stereo or surround for core substream */
                        fAudioCapability = ( (uiAudioConfig & 0x00000800) != 0) && ( (uiAudioConfig & 0x00000300) != 0);
                    }
                }
                else
                {
                    /* Stereo or Surround for both extension and core substreams */
                    fAudioCapability = ( (uiAudioConfig & 0x0000c000) != 0) && ( (uiAudioConfig & 0x00003000) != 0);
                }
            }
            else if (pStnTable->primary_audio_stream[uiStreamNumber-1].stream_attributes.stream_coding_type ==
                MPLS_STREAM_CODING_TYPE_DTS_HD_XLL)
            {
                /*
                 * Stream coding type is DTS-HD. Check audio capability of the player to
                 * determine if it is capable of playing DTS-HD.
                 */
                if (fSurround == TRUE)
                {
                    if (pStnTable->primary_audio_stream[uiStreamNumber-1].stream_attributes.audio_presentation_type == 6)
                    {
                        /* Surround for both extension and core substreams */
                        fAudioCapability = ( (uiAudioConfig & 0x00000a00) == 0x00000a00);
                    }
                    else if (pStnTable->primary_audio_stream[uiStreamNumber-1].stream_attributes.audio_presentation_type == 12)
                    {
                        /* Surround for extension substream and stereo or surround for core substream */
                        fAudioCapability = ( (uiAudioConfig & 0x00000800) != 0) && ( (uiAudioConfig & 0x00000300) != 0);
                    }
                }
                else
                {
                    /* Stereo or Surround for both extension and core substreams */
                    fAudioCapability = ( (uiAudioConfig & 0x0000c000) != 0) && ( (uiAudioConfig & 0x00003000) != 0);
                }
            }
            else if (pStnTable->primary_audio_stream[uiStreamNumber-1].stream_attributes.stream_coding_type ==
                MPLS_STREAM_CODING_TYPE_DOLBY_LOSSLESS)
            {
                /*
                 * Stream coding type is Dolby Lossless. Check audio capability of the player to
                 * determine if it is capable of playing Dolby Lossless.
                 */
                if (fSurround == TRUE)
                {
                    if (pStnTable->primary_audio_stream[uiStreamNumber-1].stream_attributes.audio_presentation_type == 6)
                    {
                        /* Surround for both mlp audio and dolby digital audio streams */
                        fAudioCapability = ( (uiAudioConfig & 0x0000a000) == 0x0000a000);
                    }
                    else if (pStnTable->primary_audio_stream[uiStreamNumber-1].stream_attributes.audio_presentation_type == 12)
                    {
                        /* Surround for mlp stream and stereo or surround for dolby digital stream*/
                        fAudioCapability = ( (uiAudioConfig & 0x00008000) != 0) && ( (uiAudioConfig & 0x00003000) != 0);
                    }
                }
                else
                {
                    /* Stereo or Surround for both mlp and dolby digital streams */
                    fAudioCapability = ( (uiAudioConfig & 0x0000c000) != 0) && ( (uiAudioConfig & 0x00003000) != 0);
                }
            }
            else
            {
                DBGPRINT(DBG_ON(DBG_ERROR), ("pbcstnselectCheckAudioCapability: UNKNOWN STREAM_CODING_TYPE (0x%x)\n",
                    pStnTable->primary_audio_stream[uiStreamNumber-1].stream_attributes.stream_coding_type));
            }
        }
    }

    return (fAudioCapability);
}

/**
 * pbcstnselectCheckLanguageCapability -- Check the text st presentation capability of the player for
 *                                        a specified language code.
 *
 * @param
 *      pubLangCode -- 3-letter language code
 *
 * @retval
 *      TRUE if player is capable of presenting specified language
 *      FALSE if player is not capable of presenting specified language
 */
static BOOLEAN pbcstnselectCheckLanguageCapability(UBYTE *pubLangCode)
{
    BOOLEAN fLangCapability = FALSE;
    BOOLEAN fDone           = FALSE;
    UBYTE   ubRegNumber     = 0;
    UBYTE   ubBitNumber     = 0;
    ULONG   ulLangCode      = 0;
    int     i, j;

    if (pubLangCode == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("pbcstnselectCheckLanguageCapability: NULL pointer!\n"));
        return (FALSE);
    }

    /* Convert 3-letter language code into a dword code */
    ulLangCode = ( ( (ULONG)pubLangCode[0] << 16) | ( (ULONG)pubLangCode[1] << 8) | pubLangCode[2] ) & 0x00ffffff;

    /* Find register number and bit number for corresponding language code */
    for (i = 0; i < TEXTST_LANG_NUMBER_OF_REGS; i++)
    {
        for (j = 0; j < 32; j++)
        {
            /* Check if the language code matches the entry in the language table */
            if ( (ulLangCode == TEXTST_LANG_TABLE[i][j]) && (TEXTST_LANG_TABLE[i][j] != 0xffffffff) )
            {
                /* Match found.  Set register number and bit number */
                ubRegNumber = TEXTST_LANG_BASE_REG + i;
                ubBitNumber = j;
                fDone       = TRUE;
                break;
            }
        }

        if (fDone == TRUE)
        {
            break;
        }
    }

    /*
     * If the language code corresponds to a valid bit of the characteristic text capability
     * registers, then look at the bit to determine if the language is supported.  If the bit
     * is set, then the language is supported.
     */
    if (ubRegNumber != 0)
    {
        uint32 uiRegValue;

        /* Get register value */
        PbcRegGetPSR(ubRegNumber, &uiRegValue);

        /* Look at the specified bit number and determine if it is set */
        if ( ( (uiRegValue >> ubBitNumber) & 0x00000001) != 0)
        {
            /* Language is supported */
            fLangCapability = TRUE;
        }
    }

    return (fLangCapability);
}

/**
 * pbcstnselectCheckTextSTCapability -- Check the text st capability of decoding the character
 *                                      encoding scheme of the specified subtitle stream.
 *
 * @param
 *      uiStreamNumber -- stream number
 *      pStnTable -- stn table
 *
 * @retval
 *      TRUE if player is capable of decoding specified text subtitle stream
 *      FALSE if player is not capable of decoding specified text subtitle stream
 */
static BOOLEAN pbcstnselectCheckTextSTCapability(uint32 uiStreamNumber, STN_TABLE *pStnTable)
{
    BOOLEAN fCapable = FALSE;
    uint32  uiTxtSTCapability;

    DbgAssert(pStnTable != NULL);
    DbgAssert( (uiStreamNumber > 0) && (uiStreamNumber <= pStnTable->number_of_PG_textST_stream_entries) );

    /* verify that subtitle stream is textst */
    if (pStnTable->PG_textST_stream[uiStreamNumber - 1].stream_attributes.stream_coding_type !=
        MPLS_STREAM_CODING_TYPE_TEXT_SUBTITLE)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("pbcstnselectCheckTextSTCapability: Subtitle stream is not TextST!\n"));
        return (FALSE);
    }

    /* Get Register value for text ST player capability */
    PbcRegGetPSR(PLAYCTRL_PSR_TEXT_CAPABILITY, &uiTxtSTCapability);

    /*
     * Check if player is capable of decoding the character encoding format of this stream.
     */
    switch (pStnTable->PG_textST_stream[uiStreamNumber - 1].stream_attributes.character_code)
    {
    case MPLS_CHAR_CODE_UTF8:   /* These are required to be supported */
    case MPLS_CHAR_CODE_UTF16:
        fCapable = TRUE;
        break;
    case MPLS_CHAR_CODE_SHIFT_JIS:
        if (uiTxtSTCapability & 0x00000008)
        {
            fCapable = TRUE;
        }
        break;
    case MPLS_CHAR_CODE_EUC_KR:
        if (uiTxtSTCapability & 0x00000010)
        {
            fCapable = TRUE;
        }
        break;
    case MPLS_CHAR_CODE_GB18030_2000:
        if (uiTxtSTCapability & 0x00000020)
        {
            fCapable = TRUE;
        }
        break;
    case MPLS_CHAR_CODE_CN_GB:
        if (uiTxtSTCapability & 0x00000040)
        {
            fCapable = TRUE;
        }
        break;
    case MPLS_CHAR_CODE_BIG5:
        if (uiTxtSTCapability & 0x00000080)
        {
            fCapable = TRUE;
        }
        break;
    default:
        DBGPRINT(DBG_ON(DBG_ERROR), ("pbcstnselectCheckTextSTCapability: Unknow character encoding format\n"));
        break;
    }

    return (fCapable);
}

⌨️ 快捷键说明

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