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

📄 parstask.cpp

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

    /* new angle change scheme */
    /* Either angle change or angle replay */
    if (0x02 == angle_change)
    {
        /* Get angle_num from system param */
        angle_num = angle_num_tt & 0x7f;

        DBGPRINT(DBG_ON(DBG_TRACE), ("proc_nvpck: angle_change, angle_num=%d\n", angle_num));

        if ( (c_pbi[next_cell - 1].c_cat[0] & 0x11) == 0x11 )     /* seamless angle change flag */
        {
            if ( (nvpck[CURRENT].sml_agli[angle_num - 1].agl_c_dsta & 0x7fffffff) != 0x7fffffff )
            {
                if ( (goto_angle & 0x0f) )
                {
                    angle_num  = goto_angle & 0x0f;
                }

                if ( nvpck[CURRENT].sml_agli[angle_num - 1].agl_c_sz &&
                    ((nvpck[CURRENT].sml_agli[angle_num - 1].agl_c_dsta & 0x7fffffff) != 0x7fffffff) &&
                    (angle_num < 10))
                {
                    goto_angle   = 0;
                    angle_num_tt = angle_num;
                    send_seamless_angle_change();
                    send_another_cell_request = 0;
                }
            }
        }
        else if ((c_pbi[next_cell - 1].c_cat[0] & 0x11) == 0x10)   /* non-seamless angle change flag */
        {
            if (((nvpck[CURRENT].nsml_agli[angle_num - 1] & 0x7fffffff) != 0x7fffffff))
            {
                if (goto_angle & 0x0f)
                {
                    angle_num = goto_angle & 0x0f;
                    if (((nvpck[CURRENT].nsml_agli[angle_num - 1] & 0x7fffffff) != 0x7fffffff) && (angle_num < 10))
                    {
                        angle_num_tt = angle_num;
                    }

                    goto_angle = 0;
                }

                if (angle_num != 10)
                {
                    send_nonseamless_angle_change();
                    return SUCCESS;
                }
                else
                {
                    angle_change = 0;
                }
            }
            else
            {
                angle_change = 0;
            }
        }
        else
        {
            angle_change = 0;
        }
    }

    /* check repeat A-B mode */
    if (repeat_mode == REPEAT_A_B)
    {
        if (A_B_count == 2)
        {
            if ( (player_state != REVERSE) &&
                ( (next_vts_sa + vtsi_mat.vtstt_vobs_sa + nvpck[CURRENT].pci_gi.nv_pck_lbn) >= B_addr) )
            {
                if (nav_state != NORMAL_PLAYING)
                {
                    message[0] = VDVD_STATUS_PLAY;
                    if (UsrEventHandler(message) != USR_SUCCESS)
                    {
                        DbgPrint(("\nUsrEventHandler FAILURE, %s, %d\n\n", __FILE__, __LINE__));
                    }
                }
                repeat_A_B();
                return SUCCESS;
            }
            else if ( (player_state == REVERSE) &&
                ( (next_vts_sa + vtsi_mat.vtstt_vobs_sa + nvpck[CURRENT].pci_gi.nv_pck_lbn) <= A_addr) )
            {
                if (nav_state != NORMAL_PLAYING)
                {
                    nav_state = NORMAL_PLAYING;
                    message[0] = VDVD_STATUS_PLAY;
                    if (UsrEventHandler(message) != USR_SUCCESS)
                    {
                        DbgPrint(("\nUsrEventHandler FAILURE, %s, %d\n\n", __FILE__, __LINE__));
                    }
                }
                player_state = NORMAL_PLAY;
                trick_resume_offset = nvpck[CURRENT].pci_gi.nv_pck_lbn;
                TMForwardPlay(PLAY_RATE_NORMAL);
                return SUCCESS;
            }
        }
        else if (A_B_count == 1)
        {
            if ( (player_state == REVERSE) &&
                ( (next_vts_sa + vtsi_mat.vtstt_vobs_sa + nvpck[CURRENT].pci_gi.nv_pck_lbn) <= A_addr) )
            {
                repeat_mode = REPEAT_OFF;
                A_B_count = 0;
                UsrSendRepeatEvent(VDVD_INFO_REPEAT_OFF);
            }
        }
    }

    /*
     * If the access restriction flag of the cell is set, Forward scan
     * and backward scan shall be canceled and normal playback resumes.
     */
    if ( ((player_state == FORWARD) || (player_state == REVERSE)) && (c_pbi[next_cell - 1].c_cat[1] & 0x20) )
    {
        /* update state info */
        nav_state    = NORMAL_PLAYING;
        player_state = NORMAL_PLAY;

        /* send nav notification of trick mode change */
        message[0]   = VDVD_STATUS_PLAY;
        if (UsrEventHandler(message) != USR_SUCCESS)
        {
            DbgPrint(("\nUsrEventHandler FAILURE, %s, %d\n\n", __FILE__, __LINE__));
        }

        /* resume normal playback */
        TMForwardPlay(PLAY_RATE_NORMAL);
    }

    if (send_another_cell_request != 0)
    {
        DBGPRINT(DBG_ON(DBG_TRACE), ("proc_nvpck: send_another_cell_request\n"));
        send_another_cell_request = 0;
        get_next_cell();
    }

    /* Check for infinite VOBU still
     * Disable execution of infinite VOBU still during trick modes */
    if ( (c_pbi[next_cell - 1].c_cat[1] & 0x40) && (player_state != FORWARD) && (player_state != REVERSE) )
    {
        DBGPRINT(DBG_ON(DBG_TRACE), ("proc_nvpck: infinite VOBU still!!!\n"));

        /* update nav_state right away */
        nav_state = PAUSED;

        /* pick new resume point
         * according to the blue book in section 3.3.3.2, pg VI3-20
         *   if presentation is in a still then the SP_PCKA info should
         *   be used to adjust the resume point */
        if (nvpck[CURRENT].synci.sp_synca[spu_get_id()&0x1f] & 0x80000000)
        {
            valid_lbn_for_rsm -= (nvpck[CURRENT].synci.sp_synca[spu_get_id()&0x1f] & 0x7fffffff);
            DBGPRINT(DBG_ON(DBG_VERBOSE), ("proc_nvpck: new valid_lbn_for_rsm = %x\n", valid_lbn_for_rsm));
        }

        /* so that the Navi. Timer still works during VOBU still */
        adjust_nv_tmr = 0;
        return (FAILURE);
    }

    /* If valid HLI exists and is different from that of the previous VOBU, and
     * this VOBU is in menu domain, then set the highlight timer */
    if (nvpck[CURRENT].hl_gi.hli_ss != 0) /* a highlight exists if this is NOT equal to zero. */
    {
        if (player_state == NORMAL_PLAY)
        {
            vobu_button_hl++;

            DBGPRINT(DBG_ON(DBG_TRACE), ("proc_nvpck: btn_ns = %d, hli_ss = 0x%.2x\n",
                (nvpck[CURRENT].hl_gi.btn_ns & 0x3f), nvpck[CURRENT].hl_gi.hli_ss));

            /* if ((we have buttons) and ((HLI status is same as last VOBU) or (this is the first hli in the cell)) */
            if ( ((nvpck[CURRENT].hl_gi.btn_ns & 0x3f) != 0) && ((hli_count == 0) || (nvpck[CURRENT].hl_gi.hli_ss != 0x02)))
            {
                if (player_state == NORMAL_PLAY)
                {
                    /* Set flag to block nav_task message processing */
                    wait_for_button_hl = 1;
                }

                hli_count++;

                /* ptm is ptm/90k seconds, in nav_cmd_timer timer 1 second = 50 ticks,
                 * so ptm equal to ptm/90k * 40 ticks = ptm/1800 ticks */

                /* Integrity test for encoded value - 'hl_gi.hli_s_ptm' */
                end_highlight_ticks   = (ULONG)((nvpck[CURRENT].hl_gi.hli_e_ptm - nvpck[CURRENT].dsi_gi.nv_pck_scr) / 2250.0);
                start_highlight_ticks = (ULONG)((nvpck[CURRENT].hl_gi.hli_s_ptm - nvpck[CURRENT].dsi_gi.nv_pck_scr) / 2250.0);

                /* check for 'hl_gi.hli_s_ptm' having already passed if this is the case then
                 * we want to enable the highlight as soon as possible i.e. ticks = 1 */
                if (start_highlight_ticks > end_highlight_ticks)
                {
                    ticks = 1;
                }
                else
                {
                    ticks = (start_highlight_ticks == 0) ? 1 : start_highlight_ticks;
                }

                DBGPRINT(DBG_ON(DBG_TRACE), ("proc_nvpck: start_highlight_ticks = %d, end_highlight_ticks = %d, ticks = %d\n",
                    start_highlight_ticks, end_highlight_ticks, ticks));

                if (ticks > (0xfffffffe - nav_timer_counter))
                {
                    highlight_expire = ticks - (0xfffffffe - nav_timer_counter);
                }
                else
                {
                    highlight_expire = nav_timer_counter + ticks;
                }

                tmp = (num_of_times >= vobu_button_hl) ? (num_of_times - vobu_button_hl) : (vobu_button_hl - num_of_times);
                if (tmp < 2)
                {
                    if ((nvpck[CURRENT].hl_gi.foac_btnn && (nvpck[CURRENT].hl_gi.foac_btnn <= (nvpck[CURRENT].hl_gi.btn_ns & 0x3f))) ||
                        (nvpck[CURRENT].hl_gi.foac_btnn == 63))
                    {
                        if ((nvpck[CURRENT].hl_gi.btn_sl_e_ptm != 0xffffffff) && nvpck[CURRENT].hl_gi.btn_sl_e_ptm)
                        {
                            ticks = (ULONG)(((LONG) nvpck[CURRENT].hl_gi.btn_sl_e_ptm - (LONG) nvpck[CURRENT].dsi_gi.nv_pck_scr) / 2250.0);

                            if (ticks == 0)
                            {
                                ticks = 1;
                            }

                            if (ticks > (0xfffffffe - nav_timer_counter))
                            {
                                button_sl_expire = ticks - (0xfffffffe - nav_timer_counter);
                            }
                            else
                            {
                                button_sl_expire = nav_timer_counter + ticks;
                            }
                        }
                    }
                }
            }
            else
            {
                DBGPRINT(DBG_ON(DBG_TRACE), ("proc_nvpck: Either no buttons or HLI is equal to the previous VOBU\n"));
            }
        }

        DBGPRINT(DBG_ON(DBG_TRACE), ("proc_nvpck: highlight_expire = %d, nav_timer_counter = %d\n", highlight_expire, nav_timer_counter));
    }
    else
    {
        button_sl_expire = highlight_expire = 0xffffffff;
    }

#if (KARAOKE_TYPE == KARAOKE_DEFAULT)
    if ( get_karaoke_on() && (kara_freeze == 1) )
    {
        ULONG time;
        time = time_to_bin(nvpck[CURRENT].pci_gi.c_eltm);
        if ( (time >= 100) && (time < 300) )
        {
            kara_freeze = 0;
            PEiStreamCtrlPause(tPE);
            nav_state = PAUSED;
        }
    }
#endif

    return (SUCCESS);

} /* end of proc_nvpck() */

/*
 * PRIVATE FUNCTIONS
 *****************************************************************************/

#if 0
static UCHAR audio_stream_exists(void)
{
    /* determine if there is any audio information to be presented synchronously
     * to presentation start time of the current nav pack. */
    return
    (
        !((nvpck[CURRENT].synci.a_synca[0] == 0) &&
          (nvpck[CURRENT].synci.a_synca[1] == 0) &&
          (nvpck[CURRENT].synci.a_synca[2] == 0) &&
          (nvpck[CURRENT].synci.a_synca[3] == 0) &&
          (nvpck[CURRENT].synci.a_synca[4] == 0) &&
          (nvpck[CURRENT].synci.a_synca[5] == 0) &&
          (nvpck[CURRENT].synci.a_synca[6] == 0) &&
          (nvpck[CURRENT].synci.a_synca[7] == 0))
    );
}
#endif

⌨️ 快捷键说明

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