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

📄 pbc_stnselect.cpp

📁 这是DVD中伺服部分的核心代码
💻 CPP
📖 第 1 页 / 共 4 页
字号:
                     (pStnTable->PG_textST_stream[i].stream_attributes.PG_language_code[2] == (UBYTE)(uiLangCode & 0x000000ff) ) )
                {
                    if ( (uiTxtSTCapability & 0x00010000) != 0) /* Unsupported language capability */
                    {
                        /* Player is capable of presenting unsupported language, so ignore condition b */

                        /*
                         * If there is not already a stream that satisfies all three conditions,
                         * 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 all three conditions,
                         * then keep track of this stream number.
                         */
                        if (fCondABC == FALSE)
                        {
                            fCondABC = TRUE;
                            stream = i + 1;
                        }
                    }
                }
                else
                {
                    if ( (uiTxtSTCapability & 0x00010000) != 0) /* Unsupported language capability */
                    {
                        /* Player is capable of presenting unsupported language, so ignore condition b */

                        /*
                         * 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 ( (fCondA == FALSE) && (fCondAC == FALSE) )
                        {
                            fCondA = 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;
                        }
                    }
                }
            }
        }

        /*
         * If there are not any pg and st stream that satisfies conditions, then set
         * the register for pg and text st stream to "No PG and Text Subtitle Stream (0x0FFF)".
         * Otherwise, set the register to the first stream encountered that satisfied
         * the conditions listed above.
         */
        if (stream == 0)
        {
            /* Set selected stream number */
            *pSelectedStn = 0x0FFF;
        }
        else
        {
            /* Set selected stream number */
            *pSelectedStn = stream;
        }
    }

    return (PLAYCTRL_SUCCESS);
}

/**
 * PbcStnSelectIG -- Set the IG stream player register.  Set it to the specified
 *                   IG stream number as long as the player is capable
 *                   of playing the specified IG stream.  If the player is not
 *                   capable of playing the specified IG stream, then select an
 *                   IG stream it is capable of playing from the stn table.
 *                   If there are no IG streams that the player is capable of playing,
 *                   then set the IG stream player register to its initial value (0x0fff).
 *
 * @param
 *      uiStreamNumber -- IG 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 PbcStnSelectIG(uint32 uiStreamNumber, STN_TABLE *pStnTable, uint32 *pSelectedStn)
{
    /* Check that stn table is valid */
    if ( (pStnTable == NULL) || (pSelectedStn == NULL) )
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("PbcStnSelectIG: NULL pointer!\n"));
        return (PLAYCTRL_NULL_POINTER);
    }

    /*
     * Check if player is capable of selecting specified IG stream.
     * If not, set IG stream number to initial value.
     */
    if ( (pStnTable->number_of_IG_stream_entries == 0                                         ) ||
         ( (uiStreamNumber > 0) && (uiStreamNumber <= pStnTable->number_of_IG_stream_entries) )  )
    {
        /* Set selected IG stream number */
        *pSelectedStn = uiStreamNumber;
    }
    else
    {
        /* Set selected IG stream number */
        *pSelectedStn = 1;
    }

    return (PLAYCTRL_SUCCESS);
}

/**
 * pbcstnselectCheckAudioCapability -- Check the presentation capability of the player to
 *                                     play a specified audio stream.
 *
 * @param
 *      uiStreamNumber -- audio stream number
 *      pStnTable -- pointer to stn table from current playitem being played
 *      fSurround -- flag that indicates whether to check also for surround capabilities
 *
 * @retval
 *      TRUE if player is capable of playing audio stream
 *      FALSE if player is not capable of playing audio stream
 */
static BOOLEAN pbcstnselectCheckAudioCapability(uint32 uiStreamNumber, STN_TABLE *pStnTable, BOOLEAN fSurround)
{
    BOOLEAN fAudioCapability = FALSE;
    uint32  uiAudioConfig;

    /* Check that stn table is valid */
    if (pStnTable == NULL)
    {
        DBGPRINT(DBG_ON(DBG_ERROR), ("pbcstnselectCheckAudioCapability: NULL POINTER!\n"));
        return (FALSE);
    }

    /* Get the value of the player register for audio capabilities */
    PbcRegGetPSR(PLAYCTRL_PSR_AUDIO_CAPABILITY, &uiAudioConfig);

    /*
     * If surround capability is to be checked, and the specified audio stream does not
     * have a presentation type for surround, then the player is not surround capable.
     */
    if ( (fSurround == FALSE) ||
         (pStnTable->primary_audio_stream[uiStreamNumber-1].stream_attributes.audio_presentation_type == 6) ||
         (pStnTable->primary_audio_stream[uiStreamNumber-1].stream_attributes.audio_presentation_type == 12) )
    {
        /*
         * Check audio stream number is in the range of audio streams in the stn table.
         */
        if (uiStreamNumber <= pStnTable->number_of_primary_audio_stream_entries)
        {
            /*
             * Compare the stream coding format of the currently selected stream
             * to the audio capabilities of the player to determine if presentation
             * of the currently selected stream is capable.
             */
            if (pStnTable->primary_audio_stream[uiStreamNumber-1].stream_attributes.stream_coding_type ==
                MPLS_STREAM_CODING_TYPE_LPCM)
            {
                /*
                 * Stream coding type is LPCM, so look at the sampling frequency.
                 */
                if ( (pStnTable->primary_audio_stream[uiStreamNumber-1].stream_attributes.sampling_frequency == 1) ||
                     (pStnTable->primary_audio_stream[uiStreamNumber-1].stream_attributes.sampling_frequency == 4) )
                {
                    /*
                     * Sampling frequency is 48 or 96 KHz.  Check audio capability of the player to
                     * determine if it is capable of playing LPCM 48/96Khz.
                     */
                    if (fSurround == TRUE)
                    {
                        /* Surround only */
                        fAudioCapability = ( (uiAudioConfig & 0x00000002) != 0);
                    }
                    else
                    {
                        /* Stereo or Surround */
                        fAudioCapability = ( (uiAudioConfig & 0x00000003) != 0);
                    }
                }
                else if (pStnTable->primary_audio_stream[uiStreamNumber-1].stream_attributes.sampling_frequency == 5)
                {
                    /*
                     * Sampling frequency is 192 KHz. Check audio capability of the player to
                     * determine if it is capable of playing LPCM 192Khz.
                     */
                    if (fSurround == TRUE)
                    {
                        /* Surround only */
                        fAudioCapability = ( (uiAudioConfig & 0x00000008) != 0);
                    }
                    else
                    {
                        /* Stereo or Surround */
                        fAudioCapability = ( (uiAudioConfig & 0x0000000c) != 0);
                    }
                }
            }
            else if (pStnTable->primary_audio_stream[uiStreamNumber-1].stream_attributes.stream_coding_type ==
                MPLS_STREAM_CODING_TYPE_AC3)
            {
                /*
                 * Stream coding type is AC-3. Check audio capability of the player to
                 * determine if it is capable of playing AC-3.
                 */
                if (fSurround == TRUE)
                {
                    /* Surround only */
                    fAudioCapability = ( (uiAudioConfig & 0x00002000) != 0);
                }
                else
                {
                    /* Stereo or Surround */
                    fAudioCapability = ( (uiAudioConfig & 0x00003000) != 0);
                }
            }
            else if (pStnTable->primary_audio_stream[uiStreamNumber-1].stream_attributes.stream_coding_type ==
                MPLS_STREAM_CODING_TYPE_DTS)
            {
                /*
                 * Stream coding type is DTS. Check audio capability of the player to
                 * determine if it is capable of playing DTS.
                 */
                if (fSurround == TRUE)
                {
                    /* Surround only */
                    fAudioCapability = ( (uiAudioConfig & 0x00000200) != 0);
                }
                else
                {
                    /* Stereo or Surround */
                    fAudioCapability = ( (uiAudioConfig & 0x00000300) != 0);
                }
            }
            else if (pStnTable->primary_audio_stream[uiStreamNumber-1].stream_attributes.stream_coding_type ==
                MPLS_STREAM_CODING_TYPE_AC3_PLUS)
            {
                /*
                 * Stream coding type is Dolby Digital Plus. Check audio capability of the player to

⌨️ 快捷键说明

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