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

📄 pgc_play.cpp

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

        pgc_mode = PGC_STOP;
        retval = 0;
    }
    else if (nav_cmd == NAV_BRANCH)     /* execute new program chain */
    {
        DBGPRINT(DBG_ON(DBG_TRACE), ("button_cell_cmd() --NAV_BRANCH\n"));

        /*
         * when branching to a new program chain, the post-command phase of
         * the current PGC is not executed, and execution of the target PGC
         * starts from the pre-command phase
         */
        pgc_init();
        retval = 0;
    }
    else if (nav_cmd == NAV_PRE_CMD)
    {
        DBGPRINT(DBG_ON(DBG_TRACE), ("button_cell_cmd() --NAV_PRE_CMD\n"));

        pgc_mode = PGC_PRE_CMD;
        retval = 0;
    }
    else if (nav_cmd == NAV_PG_PLAY)
    {
        DBGPRINT(DBG_ON(DBG_TRACE), ("button_cell_cmd() --NAV_PG_PLAY\n"));
        vob_init();
        pgc_mode = PGC_PG_PLAY;
        retval = 0;
    }
    else if (nav_cmd == NAV_POST_CMD)
    {
        DBGPRINT(DBG_ON(DBG_TRACE), ("button_cell_cmd() --NAV_POST_CMD\n"));

        pgc_mode = PGC_POST_CMD;
        retval = 0;
    }
    else if ((nav_cmd == NAV_BREAK) || (nav_cmd == NAV_PGC_PT_INIT))
    {
        DBGPRINT(DBG_ON(DBG_TRACE), ("button_cell_cmd() --NAV_BREAK || NAV_PGC_PT_INIT\n"));

        /*
         * terminate pre-command phase and proceed with presentation initialization phase
         */
        pgc_mode = PGC_PT_INIT;
        retval = 0;
    }
    else if (nav_cmd == NAV_CELL_PLAY)
    {
        DBGPRINT(DBG_ON(DBG_TRACE), ("button_cell_cmd() --NAV_CELL_PLAY\n"));
        vob_init();
        cell_play(1);
        return(0);
    }
    else if (nav_cmd == NAV_LOOP_COUNT)
    {
        DBGPRINT(DBG_ON(DBG_TRACE), ("button_cell_cmd() --NAV_LOOP_COUNT\n"));

        pgc_mode = PGC_LOOP_COUNT;
        retval = 0;
    }
    else if (nav_cmd == NAV_CONTINUE)
    {
        DBGPRINT(DBG_ON(DBG_TRACE), ("button_cell_cmd() --NAV_CONTINUE\n"));

        if (TV_Type_Changed)
        {
            TV_Type_Changed   = 0;
            modify_video_mode = 1;
        }

        if (which_cmd == CELL_CMD) /* cell command */
        {
            /* Goto POST COMMAND PHASE if cell command in last cell */
            /* of current PGC does not perform a branch             */

            if ((next_cell == pgc_gi.pgc_cnt[3]) &&
                ((nvpck[CURRENT].pci_gi.nv_pck_lbn >= c_pbi[next_cell - 1].c_lvobu_sa) &&
                (nvpck[CURRENT].pci_gi.nv_pck_lbn <= c_pbi[next_cell - 1].c_lvobu_ea)))
            {
                pgc_mode = PGC_POST_CMD;
                retval = 0;
            }
        }
        else           /* button command */
        {
            change_hl_forbidden = 1;
            if ((nav_state == CELL_STILL) && (c_pbi[next_cell - 1].c_cat[2] == 0xff) &&
                (next_cell == pgc_gi.pgc_cnt[3]))
            {
                pgc_mode = PGC_POST_CMD;
                retval = 0;
            }
        }
    }

    if (retval == 0)
    {
        pgc_play();
    }


    DBGPRINT(DBG_ON(DBG_TRACE), ("button_cell_cmd() exit\n\n"));

    return (retval);

} /* end of function button_cell_cmd() */


/**
 *   Name:           pgc_play
 *
 *   Description:    play a PGC from the nav_task loop
 *
 *   Arguments:
 *
 *   Returns:
 *
 *   Structures:
 *
 *   Pseudocode:
 *
 *   Functionality:
 *
 *   Theory of Operation:
 */
void pgc_play(void)
{
    USHORT cmd_index;
    USHORT nav_cmd;
    UBYTE  num_programs;
    ULONG  out_msg[4];
    UBYTE  retval;
    int    i;

    DBGPRINT(DBG_ON(DBG_TRACE), ("pgc_play() -- ENTER\n"));

    while (fKillNavTasks == FALSE)
    {
        switch (pgc_mode)
        {
        case PGC_STOP:
#if DBG_ON(DBG_VERBOSE)
            DbgPrint(("pgc_play() - PGC_STOP\n"));
#endif
            if (zoom_on)
            {
                zoom_on = FALSE;
                rsm_from_zoom();

                out_msg[0] = VDVD_STATUS_ZOOM_OFF;
                if (UsrEventHandler(out_msg) != USR_SUCCESS)
                {
                    DbgPrint(("\nUsrEventHandler FAILURE, %s, %d\n\n", __FILE__, __LINE__));
                }
            }

            during_search = 0;

            nav_state = FULL_STOPPED;

            DisableNavCmdTimer();

#if PROGRAM_MODE == PROGRAM_MODE_2
            user_program_enable = user_program_start = 0;
#endif

            if (repeat_mode != REPEAT_OFF)
            {
                repeat_count = A_B_count = 0;
                repeat_mode = REPEAT_OFF;
                UsrSendRepeatEvent(VDVD_INFO_REPEAT_OFF);
            }

            pause_scr();
            player_state = STOP;
            pgc_domain = FP_PGC;

#if LOADER_ERROR_RECOVER == TRUE
            if (0 == disc_error_flag)
#endif
            {
                out_msg[0] = VDVD_STATUS_STOP;
                out_msg[1] = 1;     /* full stop */
                if (UsrEventHandler(out_msg) != USR_SUCCESS)
                {
                    DbgPrint(("\nUsrEventHandler FAILURE, %s, %d\n\n", __FILE__, __LINE__));
                }
            }

            /* stop spu */
            stop_spu_decode();
            discard_spu();
            spu_disp_force_off();

            /* abort current play operation */
            DRStop(tDR);

            /* put up a splash screen */
            logo_display();

            nvpck[CURRENT].hl_gi.hli_ss = nvpck[CURRENT].hl_gi.btn_ns = 0;

#if LOADER_ERROR_RECOVER == TRUE
            if (1 == disc_error_flag)
            {
                disc_error_handle();
            }
#endif
            return;

        case PGC_PRE_CMD:
#if DBG_ON(DBG_VERBOSE)
            DbgPrint(("pgc_play() - case PGC_PRE_CMD\n"));
#endif

            /*
             * execute any commands at the beginning of PGC before cell presentation
             */
            pgc_mode = PGC_PT_INIT;     /* next unless jump */

            if (nav_suspend_flag)
            {
                nav_suspend_flag = FALSE;
                cmd_index = resume_cmd_index;
            }
            else
            {
                cmd_index = 0;
            }

            while (cmd_index < pgc_cmdti.pre_cmd_n)
            {
                if (fKillNavTasks == TRUE)
                {
                    return;
                }

                if (OS_MsgQNumMsgs(queue_nav) == 80)
                {
                    OS_MsgQReset(queue_nav);
                }

                nav_cmd = dvd_cmd((UBYTE *) & pre_cmd_buff[cmd_index++][0], PRE_CMD);
                if ((nav_cmd & 0xff00) == NAV_STOP)
                {
#if DBG_ON(DBG_VERBOSE)
                    DbgPrint(("pgc_play.cpp, Line %d, Set pgc_mode to PGC_STOP\n", __LINE__));
#endif
                    pgc_mode = PGC_STOP;
                    break;
                }

                /* execute new program chain */
                if ((nav_cmd & 0xff00) == NAV_BRANCH)
                {
#if DBG_ON(DBG_VERBOSE)
                    DbgPrint(("pgc_play.cpp, Line %d, NAV_BRANCH\n", __LINE__));
#endif
                    /*
                     * when branching to a new program chain, the post-command phase of the current PGC
                     * is not executed, and execution of the target PGC starts from the pre-command phase
                     */
                    pgc_init();
                    break;
                }

                if ((nav_cmd & 0xff00) == NAV_PRE_CMD)
                {
#if DBG_ON(DBG_VERBOSE)
                    DbgPrint(("pgc_play.cpp, Line %d, NAV_PRE_CMD\n", __LINE__));
#endif
                    pgc_mode = PGC_PRE_CMD;
                    break;
                }

                if ((nav_cmd & 0xff00) == NAV_POST_CMD)
                {
#if DBG_ON(DBG_VERBOSE)
                    DbgPrint(("pgc_play.cpp, Line %d, NAV_POST_CMD\n", __LINE__));
#endif
                    pgc_mode = PGC_POST_CMD;
                    break;
                }

                if ((nav_cmd & 0xff00) == NAV_BREAK)
                {
#if DBG_ON(DBG_VERBOSE)
                    DbgPrint(("pgc_play.cpp, Line %d, NAV_BREAK\n", __LINE__));
#endif
                    /*
                     * terminate pre-command phase and proceed with
                     * presentation initialization phase
                     */
                    break;
                }

                if ((nav_cmd & 0xff00) == NAV_LOOP_COUNT)
                {
#if DBG_ON(DBG_VERBOSE)
                    DbgPrint(("pgc_play.cpp, Line %d, NAV_LOOP_COUNT\n", __LINE__));
#endif
                    pgc_mode = PGC_LOOP_COUNT;
                    break;
                }

                if (((nav_cmd & 0xff00) == NAV_PGC_PT_INIT) || ((nav_cmd & 0xff00) == NAV_CELL_PLAY))
                {
#if DBG_ON(DBG_VERBOSE)
                    DbgPrint(("pgc_play.cpp, Line %d, NAV_PGC_PT_INIT\n", __LINE__));
#endif
                    pgc_mode = PGC_PT_INIT;
                    break;
                }

                /* HAS TO BE here in last item */
                if ((nav_cmd & 0xff00) == NAV_GOTO)
                {
#if DBG_ON(DBG_VERBOSE)
                    DbgPrint(("pgc_play.cpp, Line %d, NAV_GOTO\n", __LINE__));
#endif
                    cmd_index = (nav_cmd & 0xff) - 1;
                }

                if ((nav_cmd & 0xff00) == NAV_SUSPEND)
                {
#if DBG_ON(DBG_VERBOSE)
                    DbgPrint(("pgc_play() -- NAV_SUSPEND 1\n"));
#endif
                    nav_suspend_flag = TRUE;
                    pgc_mode = PGC_PRE_CMD;
                    suspending_cmd_index = cmd_index;
                    return;
                }
            }
            break;

        case PGC_PT_INIT:
#if DBG_ON(DBG_VERBOSE)
            DbgPrint(("pgc_play() - case PGC_PT_INIT\n"));
#endif
            /* look at PGC Contents to see if we have a VOB to play back */
            num_programs = pgc_gi.pgc_cnt[2] & 0x7F;
            if (num_programs == 0)
            {
                /* this is a dummy PGC, therefore just execute the Post Cmds */
                pgc_mode = PGC_POST_CMD;
            }
            else
            {
                if (2 == power_on_flag)
                {
                    /* Setup 020 for AV playback */
                    setup_video_playback();
                    power_on_flag = 0;
                }
                if (repeat_mode == REPEAT_TT)
                {
                   if (repeat_ttn != get_sprm(SPRM_TTN_TT_DOM))
                   {
                       retval = title_play( (UBYTE)(repeat_ttn) );
                       if (retval)
                       {
#if LOADER_ERROR_RECOVER == TRUE
                           if ( (0xff != retval) && !parental_prohibit)
                           {
                               disc_error_flag = 1;
                           }
#endif

#if DBG_ON(DBG_VERBOSE)
                           DbgPrint(("pgc_play.cpp, Line %d, Set pgc_mode to PGC_STOP\n", __LINE__));
#endif
                           pgc_mode = PGC_STOP;
                       }

                       pgc_play();
                       return;
                   }
                }

                if ((continuous_skip_tt != get_sprm(SPRM_TTN_TT_DOM)) && search_on)
                {
                    search_on = 0;
                    search_mode = 0;
                    out_msg[0] = VDVD_STATUS_GOTO;
                    out_msg[1] = 0;
                    if (UsrEventHandler(out_msg) != USR_SUCCESS)
                    {
                        DbgPrint(("\nUsrEventHandler FAILURE, %s, %d\n\n", __FILE__, __LINE__));
                    }
                }

                if (continuous_skip_tt && (continuous_skip_tt != get_sprm(SPRM_TTN_TT_DOM)))
                {
                    block_continuous_skip = 1;
                }

                vob_init();
                pb_mode_init();

                if (playback_mode == PG_SEQUENTIAL)
                {
                    pgc_mode = PGC_PG_PLAY;
                }
                else
                {
                    pgc_mode = PGC_LOOP_COUNT;
                }
            }
            break;

        case PGC_PG_PLAY:
#if DBG_ON(DBG_VERBOSE)
            DbgPrint(("pgc_play() - case PGC_PG_PLAY\n"));
#endif

            /* DAK: This call to "cell_play()" tells the DR/Loader what cell start & end   */
            /*      addresses are required for data retreival for the cell to be played.   */
            /*      This case is called upon for each cell played (ie., therefore it is    */
            /*      called throughout an entire DVD disc).                                 */
            /*      The PE "run" function is a high level function (ie., it is called one  */
            /*      time to commence disc play (provided no pausing, trick play, etc) and  */
            /*      is not a "cell play" command.  A "cell play" is a DR requirement.      */

            cell_play(1);

#if DBG_ON(DBG_VERBOSE)
            DbgPrint(("after cell_play()...\n"));
            DbgPrint(("pgc_play() - set pgc_mode = PGC_POST_CMD\n"));
#endif
            pgc_mode = PGC_POST_CMD;
            return;

⌨️ 快捷键说明

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