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

📄 nav_task.c

📁 这是DVD中伺服部分的核心代码
💻 C
📖 第 1 页 / 共 5 页
字号:
                parental_play_location.rsm.valid = 0;
                resume_cmd_index = suspending_cmd_index;
                power_on_flag = 0;     /* enable LOGO display */
                pgc_play();
            }
            else if (message[1] == 1)
            {
                /*
                 * This is a parental play after a parental "challenge"
                 */
                DbgPrint(("nav_task() - parental play (1)\n"));
                set_sprm(SPRM_PTL_LVL, temp_pml);
                resume_cmd_index = (suspending_nav_cmd & 0xff) - 1;
                pgc_play();
            }
            else if (message[1] == 2)
            {
                /*
                 * This is a parental play after a parental "prohibit".
                 */
                fParental_Play = TRUE;

                /*
                 * Check if stored location information for parental play is valid.  If it is
                 * valid, then that means that pgc was parental prohibited when attempting to
                 * play at a specific location.  So now, we should play at that location.
                 */
                if (parental_play_location.rsm.valid)
                {
                    /* start playing at stored location */
                    parental_play_location.rsm.valid = 0;
                    play_location(&parental_play_location);
                }
                else
                {
                    /*
                     * This does not resume from where play was stopped,
                     * it starts playing from the beginning.
                     */
                    DbgPrint(("nav_task() - parental play (2)\n"));
                    out_msg[0] = KEY_PLAY;
                    if ( OS_MsgQSend(queue_nav, (char *)&out_msg[0], NAV_MSG_SIZE, OS_NO_WAIT, OS_MSG_PRI_NORMAL) != OS_OK)
                    {
                        DbgPrint(("\nOS_MsgQSend FAILURE, %s, %d\n\n", __FILE__, __LINE__));
                    }
                }
            }
            break;

/**************************************************************************
 * TITLE DOMAINS                                                          *
 **************************************************************************/
        case KEY_PLAY:
            DBGPRINT(DBG_ON(DBG_TRACE), ("%s, %d, KEY_PLAY -- param %d\n", __FILE__, __LINE__, message[1]));

            /* temporarily lock out trick keys until previous has activated */
            if ( (WAIT_NEXT_CMD) && (nav_state != STOPPED) && (nav_state != FULL_STOPPED) )
            {
                DBGPRINT(DBG_ON(DBG_TRACE), ("%s, %d, Play key is locked out\n", __FILE__, __LINE__));
                break;
            }

            /* Display 'Insert disc' if there is not disc in the drive */
            if (nav_state == DRIVE_EMPTY)
            {
                uop_prohibited_msg(2);
                break;
            }

            /* menu detection
             *
             * The parameter is used to modify the behavior of the play button.
             * It is a bitfield used as follows.
             *
             * 0    - play key is always treated like a play key
             * bit0 - play key is interpreted as select when in a menu
             * bit1 - play key is interpreted as pause when in normal play mode (not in menu)
             */
            if (( (nvpck[CURRENT].hl_gi.btn_ns != 0) && (nvpck[CURRENT].hl_gi.hli_ss != 0) ) &&
                ( (pgc_domain == VMGM_PGC) || (pgc_domain == VTSM_PGC) || (nav_state == CELL_STILL) ) &&
                ( (nav_state != STOPPED) && (nav_state != FULL_STOPPED) ) &&
                ( (player_state != FORWARD) || (player_state != REVERSE) ) )
            {
                if (message[1] & 0x01) /* if bit0 is set then interpret as select button */
                {
                    /* if we are in a menu interpret play as select */
                    navtaskKeyActivateButton();
                }
                else
                {
                    /* if we are in a menu ignore this command */
                    DBGPRINT(DBG_ON(DBG_TRACE), ("%s(%d): uop_prohibited_msg\n", __FILE__, __LINE__));
                    uop_prohibited_msg(0);
                }
                break;
            }

            /* play/pause detection
             *
             * The parameter is used to modify the behavior of the play button.
             * It is a bitfield used as follows.
             *
             * 0    - play key is always treated like a play key
             * bit0 - play key is interpreted as select when in a menu
             * bit1 - play key is interpreted as pause when in normal play mode (not in menu)
             */
            if ( (nav_state == NORMAL_PLAYING) && (player_state == NORMAL_PLAY) )
            {
                if (message[1] & 0x02) /* if bit1 is set then interpret as pause button */
                {
                    /* interpret play as pause */
                    navtaskKeyPause();
                    break;
                }
            }

            if ( (nav_state == STOPPED) || (nav_state == FULL_STOPPED) || (nav_state == PAUSED) )
            {
                EnableNavCmdTimer();
            }

            prev_apstb = 0xff;

            if ( (nav_state == UNLOADED) || (nav_state == FULL_STOPPED) )
            {
                BOOLEAN sp_disp_flag;

                /* Temp save old state */
                tNavState = nav_state;

                EnableNavTimer();

                /* get current subtitle display enable state */
                sp_disp_flag = (get_sprm(SPRM_SPSTN_TT_DOM) & 0x40) != 0;

                nav_state = POWER_ON_FP;
                tmp_disc_type = init_nav();
                sprm_init();
                gprm_init();

                /*
                 * If we are doing a parental play, with parenal level temporarily set,
                 * then set the parental level to "off".  This will allow the disc to
                 * play without being prohibited again.
                 */
                if (fParental_Play == TRUE)
                {
                    set_sprm(SPRM_PTL_LVL, PARENTAL_OFF);
                }

#if LOADER_ERROR_RECOVER == TRUE
                if (tmp_disc_type == DISC_READ_ERROR)
                {
                    disc_error_handle();
                    continue;
                }
                else
#endif
                {
                    if (check_invalid_disc(tmp_disc_type) == TRUE)
                    {
                        DBGPRINT(DBG_ON(DBG_TRACE), ("%s, %d, invalid disc\n", __FILE__, __LINE__));
                        continue;
                    }
                }

                next_vtsn    = 0;
                nav_state    = NORMAL_PLAYING;
                pgc_domain   = FP_PGC;
                num_of_times = vobu_button_hl = 0;
                cell_play_counter = 0;
                num_of_times = reset_scr_count = 0;

                /* If we we have a valid DVD disc ready in the drive */
                if ( (tmp_disc_type != 0xFF) && (disc_type == DISC_DVD) )
                {
                    player_state = NORMAL_PLAY;

#ifdef LAST_MEMO
                    tmp_disc_type = check_last_memo();
                    if (tmp_disc_type == SUCCESS)
                    {
                        break;
                    }
#if LOADER_ERROR_RECOVER == TRUE
                    else if (tmp_disc_type == DISC_READ_ERROR)
                    {
                        disc_error_handle();
                        continue;
                    }
#endif
#endif

#ifdef CONDITION
                    check_condition();
#endif

                    /*
                     * If there is a first play stream then start it else stop player
                     */
                    if ( (vmgi_mat.fp_pgci_sa) && (tNavState == UNLOADED) )
                    {
                        nav_state  = POWER_ON_FP;
                        out_msg[0] = KEY_PLAY;
                        if ( OS_MsgQSend(queue_nav, (char *)&out_msg[0], NAV_MSG_SIZE, OS_NO_WAIT, OS_MSG_PRI_NORMAL) != OS_OK)
                        {
                            DbgPrint(("\nOS_MsgQSend FAILURE, %s, %d\n\n", __FILE__, __LINE__));
                        }
                    }
                    else
                    {
                        /*
                         * If subpicture display was enabled before re-initializing sprm's then
                         * enable subpicture display.
                         */
                        if (sp_disp_flag)
                        {
                            set_sprm(SPRM_SPSTN_TT_DOM, get_sprm(SPRM_SPSTN_TT_DOM) | 0x40);
                        }

                        /* Setup AV playback */
                        out_msg[0] = VDVD_STATUS_PLAY;
                        if (UsrEventHandler(out_msg) != USR_SUCCESS)
                        {
                            DbgPrint(("\nUsrEventHandler FAILURE, %s, %d\n\n", __FILE__, __LINE__));
                        }

                        /* Hide splash screen */
                        navtaskSplashScreenHide();

                        retval = title_play(1);
                        if (retval)
                        {
#if LOADER_ERROR_RECOVER == TRUE
                            if ( (0xff != retval) && !parental_prohibit )
                            {
                                disc_error_flag = 1;
                            }
#endif
                            pgc_mode = PGC_STOP;
                        }
                        else
                        {
                            /* Setup AV playback */
                            setup_video_playback();
                            power_on_flag = 0;
                        }
                        pgc_play();
                    }
                }
                break;
            }

            if ( (nav_state != FULL_STOPPED) && !( (nav_state == STOPPED) && (1 == resume_from_stop_prohibited) ) )
            {
                /* Display PLAY icon (if not already in NORMAL_PLAYING mode */
                if (nav_state != NORMAL_PLAYING)
                {
                    DBGPRINT(DBG_ON(DBG_TRACE), ("%s(%d): Display PLAY icon\n", __FILE__, __LINE__));
                    out_msg[0] = VDVD_STATUS_PLAY;
                    if (UsrEventHandler(out_msg) != USR_SUCCESS)
                    {
                        DbgPrint(("\nUsrEventHandler FAILURE, %s, %d\n\n", __FILE__, __LINE__));
                    }
                }
            }

            /*
             * Play button will release stills
             */
            if ( (pgc_gi.pgc_nv_ctl.still_time_value) ||                                                            /* pgc still */
                (c_pbi[next_cell - 1].c_cat[2] && (nav_state == CELL_STILL) && !user_program_start) ||              /* cell still */
                ((c_pbi[next_cell - 1].c_cat[1] & 0x40) && ((nav_state == PAUSED) || (nav_state == CELL_STILL))) )  /* infinate vobu still */
            {
                navtaskKeyStillOff();
            }
            else   /* no stills... release trick modes */
            {
                switch (nav_state)      /* KEY_PLAY */
                {
                case FAST_FORWARD:
                case FAST_REVERSE:
                case SLOW_REVERSE:
                    if (last_vobu_flag == 1)
                    {
                        last_vobu_flag = 4;
                    }
                    /* fall through */

                case SLOW_FORWARD:
                case CELL_STILL:
                case PAUSED:
                    TMForwardPlay(PLAY_RATE_NORMAL);
                    nav_state = NORMAL_PLAYING;
                    break;

                case NORMAL_PLAYING:
                case DRIVE_EMPTY:
                    break;

                case STOPPED:
                    /* If resume_from_stop_prohibited go to FULL_STOP state */
                    if (0 == resume_from_stop_prohibited)
                    {
                        /* if (!shuffle_on)  *//* Li 12/11/98 */
                        if (get_sprm(SPRM_PTL_LVL) != PARENTAL_OFF)
                        {
                            if (check_parental(&next_pgcn))
                            {
                                nav_state = FULL_STOPPED;       /* POWER_ON_FP; */
                                pgc_domain = FP_PGC;

                                /* stop disc drive */
                                if (DRStop(tDR) != DR_SUCCESS)
                                {
                                    DbgPrint(("%s,%d: DRStop FAILED\n", __FILE__, __LINE__));
                                }
                                continue;
                            }
                        }
                        nav_state = NORMAL_PLAYING;
                        if (pgc_domain == TT_PGC)
                        {
                            if (((spu_get_id() & SPU_STREAM_AVAILABLE) && (get_sprm(SPRM_SPSTN_TT_DOM) & 0x40)) ||
                                (0 != nvpck[CURRENT].hl_gi.btn_ns))
                            {
                                check_spu_changed();

                                /* spu stream select enable and spu display enable*/

                                if (!zoom_on)
                                {
                                    spu_disp_force_on();
                                }
                            }

                            check_audio_changed();

                            /* re-config video mode if differ from previous one */
                            if (TV_Type_Changed)
                            {
                                TV_Type_Changed = 0;
                                change_video_mode();
                            }

                            /* We are not calling pgc_play. Restore pgc_mode. This */
                            /* fixes a bug with pre-stop disabling angle changes. */

                            pgc_mode = rsm_stop_pgc_mode;

                            EnableNavCmdTimer();

#ifdef CONDITIONAL_RESUME_FROM_STOP
                            /*
                             * If we were in a still whenever we stopped, then resume back to the
                             * still state and do not issue a new play.
                             */
                            if ( pgc_gi.pgc_nv_ctl.still_time_value && (resume_prev_state == PAUSED) )
                            {
                                DBGPRINT(DBG_ON(DBG_TRACE), ("CONDITIONAL_RESUME_FROM_STOP: pgc still\n"));
                                nav_state = PAUSED;
                            }
                            else if (c_pbi[next_cell - 1].c_cat[2] && (resume_prev_state == CELL_STILL))
                            {
                                DBGPRINT(DBG_ON(DBG_TRACE), ("CONDITIONAL_RESUME_FROM_STOP: cell still\n"));
                                nav_state = CELL_STILL;
                            }
                            else if ( (c_pbi[next_cell - 1].c_cat[1] & 0x40) && (resume_prev_state == PAUSED) )
                            {
                                DBGPRINT(DBG_ON(DBG_TRACE), ("CONDITIONAL_RESUME_FROM_STOP: vobu still\n"));
                     

⌨️ 快捷键说明

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