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

📄 dvd_cmd.c

📁 这是DVD中伺服部分的核心代码
💻 C
📖 第 1 页 / 共 5 页
字号:
            else
            {
                time_info->chapter_valid = TRUE;
            }
            if (!done)
            {
                time_info->chapter_valid = FALSE;
            }
        }

        next_cell = pgc_pgmap[0];
    }

    return (retval);
}

/**
 **  Name:           go_up_pgc (user function GoUp () )
 **
 **  Arguments:      None
 **
 **  Returns:        pgc_play status
 **
 **  Functionality:
 *    1) Stop the current presentation
 *    2) The HL_BTNN described in the argument (bit field from b15 to b10) is
 *       assigned to SPRM(8)
 *    3) If GoUp_PGCN is (FFFFh)
 *          This Instruction is the same as RSM Instruction
 *       Otherwise,
 *          Start the execution of the GoUp PGC (or PGC Block)
 */

USHORT go_up_pgc(void)
{
    USHORT retval;        /* goto pre_cmd phase */

#if DBG_ON(DBG_TRACE)
    DbgPrint(("go_up_pgc: ENTER\n"));
#endif

    if (pgc_gi.pgc_nv_ctl.goup_pgcn == 0xffff)
    {
        retval = resume();
        if (NAV_PGC_PT_INIT != retval)
        {
            retval = NAV_STOP;
        }
        return (retval);
    }

    retval = NAV_PRE_CMD;        /* goto pre_cmd phase */

    if (pgc_gi.pgc_nv_ctl.goup_pgcn & 0x7fff)
    {
        /* any PGCN between 1 and 32767 in same domain */
        next_pgcn = pgc_gi.pgc_nv_ctl.goup_pgcn & 0x7fff;
        retval = get_pgc();
    }
    else
    {
        /* go to stop state */
        retval = NAV_STOP;
    }

    return (retval);
}

/**
 *  Name:           link_pttn (user function PTT_Search (PTT number) )
 *
 *  Arguments:      pttn - part of title number from 1 to 99 or 999
 *
 *  Returns:        pgc_play status
 *
 *  Functionality:
 *    1) Stop the current presentation, leaving any Post-Commands in the PGCI unprocessed.
 *    2) The HL_BTNN described in the argument (bit field from b15 to b10) is assigned to SPRM(8)
 *    3) Start the presentation of the PTT specified in the argument (bit field b9 to b0)
 *       from the Presentation Initialization phase. Even if the PTT exists in a different PGC
 *       from the current PGC, any Pre-Commands in the PGC which includes the PTT are not executed.
 */

USHORT link_pttn(USHORT pttn)
{
    USHORT retval = NAV_PGC_PT_INIT;
    USHORT pgcn;

#if DBG_ON(DBG_TRACE)
    DbgPrint(("link_pttn: pttn=%d\n", pttn));
#endif

    /* update sprm(7) PTTN */
    set_sprm(SPRM_PTTN_ONE_SEQ_PGC, pttn);

    /* update sprm(6) TT_PGCN if PTT is in different PGC */
    pgcn = ptt_srp[get_sprm(SPRM_VTS_TTN_TT_DOM) - 1][pttn - 1].pgcn;
    if (next_pgcn != pgcn)
    {
        next_pgcn = pgcn;
        set_sprm(SPRM_TT_PGCN_TT_DOM, pgcn);

        if (parse_pgci(&next_pgcn))
        {
            retval = NAV_STOP;
        }
    }

    if (playback_mode == PG_SEQUENTIAL)
    {
        next_pgn = ptt_srp[get_sprm(SPRM_VTS_TTN_TT_DOM) - 1][pttn - 1].pgn;
    }
    else
    {
        next_pgn = 1 + rand() % (pgc_gi.pgc_cnt[2] & 0x7f);
    }

    next_cell = pgc_pgmap[next_pgn - 1];

    return (retval);
}

/**
 **  Name:           link_prev_pg (user function PrevPG_Search () )
 **
 **  Arguments:      None
 **
 **  Returns:        pgc_play status
 **
 **  Functionality:
 *    1) Stop the current presentation.
 *    2) The HL_BTNN described in the argument (bit field from b15 to b10) is
 *       assigned to SPRM(8)
 *    3) Start the presentation of the previous Program.
 */

USHORT link_prev_pg(void)
{
    USHORT retval;
    USHORT done = 0;
    USHORT tt;
    USHORT ptt;

#if DBG_ON(DBG_TRACE)
    DbgPrint(("link_prev_pg: ENTER\n"));
#endif

    /*
     * Skip to the previous Program is the instruction to start the
     * presentation of the previous Program of the current PGC and optionally
     * to assign the HL_BTNN to SPRM(8). When this instruction is executed in
     * the first Program of the PGC or the Program of the PGC whose PG
     * Playback mode is set to Random or Shuffle playback, this instruction
     * shall be interpreted as LinkPrevPGC (SINS_LINK_PREV_PGC) Instruction.
     */

    if ((playback_mode == PG_SEQUENTIAL) && (next_pgn != 1))
    {
        /*
         * if this is not the first program in PGC, playback first cell in
         * previous program
         */
        next_cell = pgc_pgmap[next_pgn - 2];
        next_pgn--;

        if (pgc_domain == TT_PGC)
        {
            done = 0;
            /* update sprm(7) PTTN if target PG is PTT */
            for (tt = 0; (tt < ptt_srpti.vts_ttu_n) && !done; tt++)
            {
                for (ptt = 0; (ptt < ttu_srp_num[tt]) && !done; ptt++)
                {
                    if ((ptt_srp[tt][ptt].pgcn == next_pgcn) &&
                        (ptt_srp[tt][ptt].pgn == next_pgn))
                    {
                        set_sprm(SPRM_PTTN_ONE_SEQ_PGC, (USHORT) (ptt + 1));
                        done = 1;
                    }
                }
            }

#if CHAP_DISP_MODE == CHAP_DISP_1
            if ((tt_srp[get_sprm(SPRM_TTN_TT_DOM) - 1].tt_pb_ty & 0x40) &&  /* One_Random_PGC_Title or Multi_PGC_Title */
                (tt_srp[get_sprm(SPRM_TTN_TT_DOM) - 1].tt_pb_ty & 0x02))    /* ptt search is prohibited */
#else
            if (tt_srp[get_sprm(SPRM_TTN_TT_DOM) - 1].tt_pb_ty & 0x40)      /* One_Random_PGC_Title or Multi_PGC_Title */
#endif
            {
                time_info->chapter_valid = FALSE;
            }
            else
            {
                time_info->chapter_valid = TRUE;
            }

            if (!done)
            {
                time_info->chapter_valid = FALSE;
            }
        }

        retval = NAV_PGC_PT_INIT;
    }
    else
    {

        /*
         * if this is the first program in PGC, and if previous PGC exists,
         * playback previous PGC.
         */

        if (pgc_gi.pgc_nv_ctl.previous_pgcn)
        {
            next_pgcn = pgc_gi.pgc_nv_ctl.previous_pgcn;
            next_pgn = 1;

            if (parse_pgci(&next_pgcn))
            {
                retval = NAV_STOP;      /* goto stop phase */
            }
            else
            {
                if (pgc_domain == TT_PGC)
                {
                    set_sprm(SPRM_TT_PGCN_TT_DOM, next_pgcn);

                    done = 0;
                    /* update sprm(7) PTTN if target PG is PTT */
                    for (tt = 0; (tt < ptt_srpti.vts_ttu_n) && !done; tt++)
                    {
                        for (ptt = 0; (ptt < ttu_srp_num[tt]) && !done; ptt++)
                        {
                            if ((ptt_srp[tt][ptt].pgcn == next_pgcn) &&
                                (ptt_srp[tt][ptt].pgn == next_pgn))
                            {
                                set_sprm(SPRM_PTTN_ONE_SEQ_PGC, (USHORT) (ptt + 1));
                                /* time_info->chapter_valid = TRUE; */
                                done = 1;
                            }
                        }
                    }

#if CHAP_DISP_MODE == CHAP_DISP_1
                    if ((tt_srp[get_sprm(SPRM_TTN_TT_DOM) - 1].tt_pb_ty & 0x40) && /* One_Random_PGC_Title or Multi_PGC_Title */
                        (tt_srp[get_sprm(SPRM_TTN_TT_DOM) - 1].tt_pb_ty & 0x02))   /* ptt search is prohibited */
#else
                    if (tt_srp[get_sprm(SPRM_TTN_TT_DOM) - 1].tt_pb_ty & 0x40)     /* One_Random_PGC_Title or Multi_PGC_Title */
#endif
                    {
                        time_info->chapter_valid = FALSE;
                    }
                    else
                    {
                        time_info->chapter_valid = TRUE;
                    }
                    if (!done)
                    {
                        time_info->chapter_valid = FALSE;
                    }
                }

                next_cell = pgc_pgmap[0];
                retval = NAV_BRANCH;
            }
        }
        else
        {
            retval = NAV_CONTINUE;
        }
    }

    return (retval);
}


/**
 *  Name:           link_top_pg (user function TopPG_Search () )
 *
 *  Arguments:      None
 *
 *  Returns:        pgc_play status
 *
 *  Functionality:
 *    1) Stop the current presentation.
 *    2) The HL_BTNN described in the argument (bit field from b15 to b10) is assigned to SPRM(8)
 *    3) Restart the presentation of the current Program from the top.
 */

USHORT link_top_pg(void)
{
#if DBG_ON(DBG_TRACE)
    DbgPrint(("link_top_pg: ENTER, next_cell=%d, next_pgn=%d\n", next_cell, next_pgn));
#endif

    /*
     * Skip to the top of the current Program is the instruction to restart
     * the presentation of the current Program, and optionally to assign the
     * HL_BTNN to SPRM(8).
     */

    /* next_pgn - 1 since next_pgn is 1-base */
    next_cell = pgc_pgmap[next_pgn - 1];

#if DBG_ON(DBG_TRACE)
    DbgPrint(("link_top_pg: ENTER, next_cell=%d, next_pgn=%d\n", next_cell, next_pgn));
#endif

    return (NAV_PG_PLAY);
}

/**
 *  Name:           link_next_pg (user function NextPG_Search () )
 *
 *  Arguments:      None
 *
 *  Returns:        pgc_play status
 *
 *  Functionality:
 *    1) Stop the current presentation.
 *    2) The HL_BTNN described in the argument (bit field from b15 to b10) is assigned to SPRM(8)
 *    3) Start the presentation of the next Program
 */

USHORT link_next_pg(void)
{
    USHORT retval = 0xffff;
    USHORT done   = 0;
    USHORT tt;
    USHORT ptt;

#if DBG_ON(DBG_TRACE)
    DbgPrint(("link_next_pg: ENTER, next_cell=%d, next_pgn=%d\n", next_cell, next_pgn));
#endif

    /*
     * Skip to the next Program is the instruction to start the presentation of the
     * next Program of the current PGC and optionally to assign the HL_BTNN to SPRM(8).
     */

    if (playback_mode == PG_SEQUENTIAL)
    {
        if (next_pgn++ != (pgc_gi.pgc_cnt[2] & 0x7f))
        {
            /*
             * if this is not last program in PGC, present the first cell of the next program
             */
            next_cell = pgc_pgmap[next_pgn - 1];

            if (pgc_domain == TT_PGC)
            {
                done = 0;
                /* update sprm(7) PTTN if target PG is PTT */
                for (tt = 0; (tt < ptt_srpti.vts_ttu_n) && !done; tt++)
                {
                    for (ptt = 0; (ptt < ttu_srp_num[tt]) && !done; ptt++)
                    {
                        if ((ptt_srp[tt][ptt].pgcn == next_pgcn) &&
                            (ptt_srp[tt][ptt].pgn == next_pgn))
                        {
                            set_sprm(SPRM_PTTN_ONE_SEQ_PGC, (USHORT) (ptt + 1));
                            done = 1;
                        }
                    }
                }

#if CHAP_DISP_MODE == CHAP_DISP_1
                if ((tt_srp[get_sprm(SPRM_TTN_TT_DOM) - 1].tt_pb_ty & 0x40) && /* One_Random_PGC_Title or Multi_PGC_Title */
                    (tt_srp[get_sprm(SPRM_TTN_TT_DOM) - 1].tt_pb_ty & 0x02))   /* ptt search is prohibited */
#else
                if (tt_srp[get_sprm(SPRM_TTN_TT_DOM) - 1].tt_pb_ty & 0x40)     /* One_Random_PGC_Title or Multi_PGC_Title */
#endif
                {
                    time_info->chapter_valid = FALSE;
                }
                else
                {
                    time_info->chapter_valid = TRUE;
                }
                if (!done)
                {
                    time_info->chapter_valid = FALSE;
                }
            }

            retval = NAV_PGC_PT_INIT;
        }
        else
        {
            /*
             * if this is the last program in PGC, and if next pgc exist,
             * goto the next phase
             */
            next_pgn--;

            if (pgc_gi.pgc_nv_ctl.next_pgcn)
            {
                retval = NAV_POST_CMD;
            }
            else
            {
                retval = NAV_CONTINUE;
            }
        }
    }
    else        /* Random or shuffle */
    {
        if (pg_repeat_count)
        {
            retval = NAV_LOOP_COUNT;
        }
        else if (pgc_gi.pgc_nv_ctl.next_pgcn)
        {
            retval = NAV_POST_CMD;
        }
    }

    if (retval == 0xffff)
    {
        DbgPrint(("Execution Path ERROR, %s, %d\n", __FILE__, __LINE__));
    }

#if DBG_ON(DBG_TRACE)
    DbgPrint(("link_next_pg: EXIT, next_cell=%d, next_pgn=%d\n", next_cell, next_pgn));

⌨️ 快捷键说明

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