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

📄 pbc_stnselect.cpp

📁 这是DVD中伺服部分的核心代码
💻 CPP
📖 第 1 页 / 共 4 页
字号:
                        /*
                         * If there is not already a stream that satisfies condition a,
                         * conditions a and c, conditions a and b, nor conditions a, b and c,
                         * then keep track of this stream number.
                         */
                        if ( (fCondA == FALSE) && (fCondAC == FALSE) && (fCondAB == FALSE) && (fCondABC == FALSE) )
                        {
                            fCondA = TRUE;
                            stream = i + 1;
                        }
                    }
                }
            }
        }

        /*
         * If there are not any audio stream that satisfies condition a, then set
         * the register for audio stream to "No Audio Stream (0xFF)".
         * Otherwise, set the register to the first stream encountered that satisfied
         * the conditions listed above.
         */
        if (stream == 0)
        {
            /* Set selected stream number */
            *pSelectedStn = 0xFF;
        }
        else
        {
            /* Set selected stream number */
            *pSelectedStn = stream;
        }
    }

    return (PLAYCTRL_SUCCESS);
}

/**
 * PbcStnSelectPGandST -- Set the pg and subtitle stream player register.  Set it to the specified
 *                        pg and subtitle stream number as long as the player is capable
 *                        of playing the specified pg and subtitle stream.  If the player is not,
 *                        capable of playing the specified pg and subtitle stream, then select an
 *                        pg and subtitle stream it is capable of playing from the stn table.
 *                        If there are no pg and subtitle streams that the player is capable of playing,
 *                        then set the pg and subtitle stream player register to its initial value (0x0fff).
 *
 * @param
 *      uiStreamNumber -- pg and subtitle stream number
 *      pStnTable -- pointer to stn table from current playitem being played
 *      pSelectedStn - pointer that gets set to seleted stream number
 *
 * @retval
 *      PLAYCTRL_STATUS
 */
PLAYCTRL_STATUS PbcStnSelectPGandST(uint32 uiStreamNumber, STN_TABLE *pStnTable, uint32 *pSelectedStn)
{
    BOOLEAN fPGandSTCapability = FALSE;
    uint32  uiTxtSTCapability;
    uint32  uiPgandSTreg;

    /* validate paramters */
    if ( (pStnTable == NULL) || (pSelectedStn == NULL) )
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("PbcStnSelectPGandST: NULL pointer!\n"));
        return (PLAYCTRL_NULL_POINTER);
    }

    /* Get Register value for current pg and st stream  */
    PbcRegGetPSR(PLAYCTRL_PSR_PG_AND_ST_STN, &uiPgandSTreg);

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

    if (pStnTable->number_of_PG_textST_stream_entries == 0)
    {
        /* No streams exist in this playitem, don't change anything */
        fPGandSTCapability = TRUE;
    }
    /*
     * Check if player is capable of selecting specified pg and st stream.
     */
    else if ( (uiStreamNumber > 0) && (uiStreamNumber <= pStnTable->number_of_PG_textST_stream_entries) )
    {
        /* Check the stream type.  Should be either Text Subtitle or PG stream */
        if (pStnTable->PG_textST_stream[uiStreamNumber - 1].stream_attributes.stream_coding_type ==
            MPLS_STREAM_CODING_TYPE_TEXT_SUBTITLE)
        {
            /*
             * Stream is a text st stream.  Now check if player is capable of decoding the character
             * coding format used in this stream.
             */
            if (pbcstnselectCheckTextSTCapability(uiStreamNumber, pStnTable) == TRUE)
            {
                /*
                 * if player is capable of presenting language of specified text st stream or
                 * if player is capable of selecting a text st stream with unsupported language.
                 */
                if (pbcstnselectCheckLanguageCapability(pStnTable->PG_textST_stream[uiStreamNumber - 1].stream_attributes.textST_language_code) == TRUE)
                {
                    /*
                     * The player is capable of decoding text st streams and it is capable of presenting
                     * the language of the specified stream, therefore the player is capable of
                     * selecting the specified text st stream.
                     */
                    fPGandSTCapability = TRUE;
                }
                else if ( (uiTxtSTCapability & 0x00010000) != 0)
                {
                    /*
                     * The player is capable of decoding text st streams and it is capable of selecting
                     * a stream with an unsupported language, therefore the player is capable of
                     * selecting the specified text st stream.
                     */
                    fPGandSTCapability = TRUE;
                }
            }
        }
        else if (pStnTable->PG_textST_stream[uiStreamNumber - 1].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_PG)
        {
            /* Stream is a pg stream, so player is capable of selecting stream */
            fPGandSTCapability = TRUE;
        }
    }

    /*
     * If player is capable of selecting specified stream, then select the specified stream.
     * Otherwise, do further processing to determine what stream to select.
     */
    if (fPGandSTCapability == TRUE)
    {
        /* Set selected stream number */
        *pSelectedStn = uiStreamNumber;
    }
    else
    {
        UBYTE   i;
        uint32  stream      = 0;
        BOOLEAN fCondA      = FALSE;
        BOOLEAN fCondAB     = FALSE;
        BOOLEAN fCondAC     = FALSE;
        BOOLEAN fCondABC    = FALSE;
        uint32  uiLangCode;

        /* Get the value of the user configuration setting for default pg and st language */
        PbcRegGetPSR(PLAYCTRL_PSR_PG_AND_ST_LANG, &uiLangCode);

        /*
         * Check all pg and st streams in the stn table for the following three conditions:
         * a) Text ST Decoding capability (in case of pg stream, this condition is ignored)
         * b) Language capability (in case of pg stream, this condition is ignored)
         * c) Correspondence between language code and user configuration setting
         *    for default pg and text st stream language
         * x) Unsupported language capability (in case of pg stream, this condition is ignored)
         *
         * The first stream that satisfies a, b, and c should be used.
         * If no stream satisfies a, b, and c then the first stream that satisfies
         * a and b should be used.  If no stream satisfies a and b, then the first stream
         * that satisfies a and c should be used, as long as the player is capable of selecting
         * unsupported languages.  If no stream satisfies a and c, then
         * the first stream that satisfies a should be used, as long as the player is capable of selecting
         * unsupported languages.  If no stream satisfies a, then no stream is used.
         */
        for (i = 0; i < pStnTable->number_of_PG_textST_stream_entries; i++)
        {
            /* Check stream type, either pg or text st */
            if (pStnTable->PG_textST_stream[i].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_TEXT_SUBTITLE)
            {
                /*
                 * Stream is a text st stream.  Now check if player is capable of decoding the character
                 * coding format used in this stream.
                 */
                if (pbcstnselectCheckTextSTCapability(i+1, pStnTable) == TRUE)
                {
                    if ( (uiTxtSTCapability & 0x00010000) == 0) /* Unsupported language capability */
                    {
                        /* Player not capable of presenting unsupported language */

                        /* Check if player is capable of presenting language of stream */
                        if (pbcstnselectCheckLanguageCapability(pStnTable->PG_textST_stream[i].stream_attributes.textST_language_code) == TRUE)
                        {
                            /*
                             * Check if user configuration for default pg and text st language matches
                             * the language of the stream.
                             */
                            if ( (pStnTable->PG_textST_stream[i].stream_attributes.textST_language_code[0] == (UBYTE)( (uiLangCode & 0x00ff0000) >> 16) ) &&
                                 (pStnTable->PG_textST_stream[i].stream_attributes.textST_language_code[1] == (UBYTE)( (uiLangCode & 0x0000ff00) >> 8) ) &&
                                 (pStnTable->PG_textST_stream[i].stream_attributes.textST_language_code[2] == (UBYTE)(uiLangCode & 0x000000ff) ) )
                            {
                                /*
                                 * If there is not already a stream that satisfies all three conditions,
                                 * then keep track of this stream number.
                                 */
                                if (fCondABC == FALSE)
                                {
                                    fCondABC = TRUE;
                                    stream = i + 1;
                                }
                            }
                            else
                            {
                                /*
                                 * If there is not already a stream that satisfies conditions a and b,
                                 * nor conditions a, b and c, then keep track of this stream number.
                                 */
                                if ( (fCondAB == FALSE) && (fCondABC == FALSE) )
                                {
                                    fCondAB = TRUE;
                                    stream = i + 1;
                                }
                            }
                        }
                    }
                    else
                    {
                        /* Player is capable of presenting unsupported language so ignore condition b */

                        /*
                         * Check if user configuration for default pg and text st language matches
                         * the language of the stream.
                         */
                        if ( (pStnTable->PG_textST_stream[i].stream_attributes.textST_language_code[0] == (UBYTE)( (uiLangCode & 0x00ff0000) >> 16) ) &&
                             (pStnTable->PG_textST_stream[i].stream_attributes.textST_language_code[1] == (UBYTE)( (uiLangCode & 0x0000ff00) >> 8) ) &&
                             (pStnTable->PG_textST_stream[i].stream_attributes.textST_language_code[2] == (UBYTE)(uiLangCode & 0x000000ff) ) )
                        {
                            /*
                             * If there is not already a stream that satisfies conditions a and c
                             * then keep track of this stream number.
                             */
                            if (fCondAC == FALSE)
                            {
                                fCondAC = TRUE;
                                stream = i + 1;
                            }
                        }
                        else
                        {
                            /*
                             * If there is not already a stream that satisfies condition a,
                             * nor conditions a and c then keep track of this stream number.
                             */
                            if ( (fCondA == FALSE) && (fCondAC == FALSE) )
                            {
                                fCondA = TRUE;
                                stream = i + 1;
                            }
                        }
                    }
                }
            }
            else if (pStnTable->PG_textST_stream[i].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_PG)
            {
                /*
                 * Check if user configuration for default pg and text st language matches
                 * the language of the stream.
                 */
                if ( (pStnTable->PG_textST_stream[i].stream_attributes.PG_language_code[0] == (UBYTE)( (uiLangCode & 0x00ff0000) >> 16) ) &&
                     (pStnTable->PG_textST_stream[i].stream_attributes.PG_language_code[1] == (UBYTE)( (uiLangCode & 0x0000ff00) >> 8) ) &&

⌨️ 快捷键说明

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