📄 dvd_cmd.c
字号:
/*****************************************************************************
******************************************************************************
** **
** Copyright (c) 2002 Videon Central, Inc. **
** All rights reserved. **
** **
** The computer program contained herein contains proprietary information **
** which is the property of Videon Central, Inc. The program may be used **
** and/or copied only with the written permission of Videon Central, Inc. **
** or in accordance with the terms and conditions stipulated in the **
** agreement/contract under which the programs have been supplied. **
** **
******************************************************************************
*****************************************************************************/
/**
* @file dvd_cmd.c
*
* Act on DVD Cell-Commands, Button Commands, Pre-Commands and Post-Commands.
*
* $Id: dvd_cmd.c,v 1.55 2007/01/26 22:52:37 rbehe Exp $
*/
#include <stdlib.h>
#include "vdvd_types.h"
#include "loader_app.h"
#include "dr_app.h"
#include "pe_app.h"
#include "nav_task.h"
#include "dvd_prm.h"
#include "dvd_cmd.h"
#include "dvd_menu.h"
#include "dvd_pgci.h"
#include "dvd_vmgi.h"
#include "dvd_vtsi.h"
#include "pgc_play.h"
#include "dvdnvpck.h"
#include "timer.h"
#include "parstask.h"
#include "init.h"
#include "trickmode.h"
#include "dbgprint.h"
#include "usrapi.h"
#include "readdir.h"
#ifdef DMALLOC
#include "dmalloc.h"
#endif
#define DEBUG_DVD_CMD DBG_ERROR
#define DBG_ON(x) (DEBUG_DVD_CMD >= x)
UBYTE jump_tt_flag;
rsm_info_struct rsm_info;
ULONG rsm_nv_pck_lbn;
UBYTE temp_pml;
extern ULONG nv_tmr_100, nv_tmr_set;
extern USHORT suspending_nav_cmd;
extern UBYTE settmppml_on;
extern UBYTE title_play_enter;
extern UBYTE adjust_nv_tmr;
extern UBYTE repeat_mode, A_B_count;
extern ULONG valid_lbn_for_rsm;
extern UBYTE angle_change, goto_angle;
extern PE_HANDLE tPE;
extern TITLE_SET_FILE_STRUCT vts_file[99];
/* PRIVATE FUNCTION PROTOTYPES */
static USHORT random_number(USHORT);
/* dummy here */
void stop_nv_tmr(void)
{
set_sprm(SPRM_NV_TMR, 0);
}
/**
* Name: jump
*
* Arguments: pttn - part of title number
* vts_ttn - VTS title number
*
* Returns: SUCCESS or FAILURE
*
* Functionality:
*/
BOOLEAN jump(USHORT pttn, USHORT vts_ttn, UBYTE vtsn)
{
USHORT pgcn; /* PGCN within the TT_PGC */
UBYTE ret;
#if DBG_ON(DBG_TRACE)
DbgPrint(("enter jump()...\n"));
#endif
jump_tt_flag = 1;
set_sprm(SPRM_NV_TMR, 0); /* Reg 9 */
rsm_info.valid = 0;
if (vtsn != next_vtsn)
{
ret = get_vtsi_ifo(next_vts_sa);
if (ret != SUCCESS)
{
/* if there was a parse error retry */
if (ret == FAILURE)
{
int index;
/* find the index */
for (index = 0; index < tt_srpti.tt_srp_n && index < MAX_NUM_TT; index++)
{
if (tt_srp[index].vts_sa == next_vts_sa)
{
/* try new address found by readdir */
next_vts_sa = vts_file[tt_srp[index].vtsn - 1].ifo_address;
ret = get_vtsi_ifo(next_vts_sa);
break;
}
}
}
if (ret != SUCCESS)
{
return (FAILURE);
}
}
next_vtsn = vtsn;
/* get the PGCN for VTS_TTN within the VTSN */
pgcn = ptt_srp[vts_ttn - 1][pttn - 1].pgcn;
pgc_domain = TT_PGC; /* title PGC */
if (parse_pgci(&pgcn))
{
DbgPrint(("dvd_cmd.c - LINE %d, FAILURE\n", __LINE__));
return (FAILURE);
}
}
else
{
/* get the PGCN for VTS_TTN within the VTSN */
pgcn = ptt_srp[vts_ttn - 1][pttn - 1].pgcn;
if ((pgc_domain != TT_PGC) ||
(pgcn != next_pgcn))
{
pgc_domain = TT_PGC; /* title PGC */
if (parse_pgci(&pgcn))
{
DbgPrint(("dvd_cmd.c - LINE %d, FAILURE\n", __LINE__));
return (FAILURE);
}
}
}
next_pgcn = pgcn;
next_pgn = ptt_srp[vts_ttn - 1][pttn - 1].pgn;
next_cell = pgc_pgmap[next_pgn - 1]; /* make it 0-base */
time_info->title_valid = 1;
/* update sprm(6) TT_PGCN */
set_sprm(SPRM_TT_PGCN_TT_DOM, pgcn);
return (SUCCESS);
}
/**
** Name: jump_tt (user function Title_Play (title_number) )
**
** Arguments: ttn - title number from 1 to 99
**
** Returns: pgc_play status
**
** Functionality:
* 1) Stop the current presentation
* 2) Discard the RSM Information (if it exists), the value in the Navi-
* gation Timer and the TT_PGCN for Navigation Timer in System Para-
* meters. Assign '0' to SPRM(9) to stop the Naviation Timer.
* 3) Set SPRM(1) and SPRM(2) according to 3.3.9.1 of DVD Part 3, Rev. 1.0.
* 4) Start the presentation of the specified Title from Pre-command phase.
*/
USHORT jump_tt(USHORT ttn)
{
USHORT retval = NAV_STOP;
UBYTE vtsn;
UBYTE vts_ttn;
vtsn = tt_srp[ttn - 1].vtsn;
vts_ttn = tt_srp[ttn - 1].vts_ttn;
next_vts_sa = tt_srp[ttn - 1].vts_sa;
set_sprm(SPRM_TTN_TT_DOM, ttn); /* Reg 4 */
set_sprm(SPRM_VTS_TTN_TT_DOM, vts_ttn); /* Reg 5 */
set_sprm(SPRM_PTTN_ONE_SEQ_PGC, 1); /* Reg 7 */
#if CHAP_DISP_MODE == CHAP_DISP_1
if ((tt_srp[ttn - 1].tt_pb_ty & 0x40) && /* One_Random_PGC_Title or Multi_PGC_Title */
(tt_srp[ttn - 1].tt_pb_ty & 0x02)) /* ptt search is prohibited */
#else
if (tt_srp[ttn - 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 (jump(1, vts_ttn, vtsn) == SUCCESS)
{
retval = NAV_PRE_CMD;
}
return (retval);
}
/**
** Name: jump_vts_ptt (user function PTT_Play (title number, ptt number) )
**
** Arguments: vts_ttn - VTS title number from 1 to 99
** pttn - part of title number from 1 to 99 or 999
**
** Returns: pgc_play status
**
** Functionality:
* 1) Stop the current presentation
* 2) Discard the RSM Information (if it exists), the value in the Navi-
* gation Timer and the TT_PGCN for Navigation Timer in System Para-
* meters. Assign '0' to SPRM(9) to stop the Naviation Timer.
* 3) Set SPRM(1) and SPRM(2) according to 3.3.9.1 (setting and changing
* audio and sub-picture stream for title presentation).
* 4) Execute the command in the pre-command area of the PGC in which
* the PTTN is found.
* 5) Start the presentation of the PTT which is specified by PTTN and
* VTS_TTN within the current VTS-space.
*/
USHORT jump_vts_ptt(UBYTE vts_ttn, USHORT pttn)
{
USHORT i;
USHORT retval = NAV_STOP;
#if DBG_ON(DBG_TRACE)
DbgPrint(("jump_vts_ptt: ENTER\n"));
#endif
set_sprm(SPRM_PTTN_ONE_SEQ_PGC, pttn);
set_sprm(SPRM_VTS_TTN_TT_DOM, vts_ttn);
for (i = 0; i < tt_srpti.tt_srp_n; i++)
{
if ((tt_srp[i].vts_ttn == vts_ttn) &&
(tt_srp[i].vtsn == next_vtsn))
{
set_sprm(SPRM_TTN_TT_DOM, (USHORT) (i + 1));
break;
}
}
#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 (jump(pttn, vts_ttn, next_vtsn) == SUCCESS)
{
retval = NAV_PRE_CMD;
}
return (retval);
}
USHORT resume(void)
{
USHORT pgcn;
USHORT vts_ttn;
USHORT pttn;
UBYTE ret;
#if DBG_ON(DBG_TRACE)
DbgPrint(("resume: ENTER\n"));
#endif
if (0 == rsm_info.valid)
{
return (0);
}
if (1 == rsm_info.valid) /* CallSS being called in normal playback */
{
menu_rsm = 1;
}
rsm_info.valid = 0;
next_vts_sa = rsm_info.next_vts_sa;
next_vtsn = rsm_info.vtsn;
vts_ttn = rsm_info.sprm5;
pgcn = rsm_info.sprm6;
pttn = rsm_info.sprm7;
rsm_nv_pck_lbn = rsm_info.nv_pck_lbn;
set_sprm(SPRM_TTN_TT_DOM, rsm_info.sprm4);
set_sprm(SPRM_VTS_TTN_TT_DOM, vts_ttn);
set_sprm(SPRM_TT_PGCN_TT_DOM, pgcn);
set_sprm(SPRM_PTTN_ONE_SEQ_PGC, pttn);
set_sprm(SPRM_HL_BTNN, rsm_info.sprm8);
#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;
}
pgc_domain = rsm_info.pgc_domain;
if (pgc_domain == TT_PGC)
{
time_info->title_valid = TRUE;
}
ret = get_vtsi_ifo(next_vts_sa);
if (ret != SUCCESS)
{
/* if there was a parse error retry */
if (ret == FAILURE)
{
int index;
/* find the index */
for (index = 0; index < tt_srpti.tt_srp_n && index < MAX_NUM_TT; index++)
{
if (tt_srp[index].vts_sa == next_vts_sa)
{
/* try new address found by readdir */
next_vts_sa = vts_file[tt_srp[index].vtsn - 1].ifo_address;
ret = get_vtsi_ifo(next_vts_sa);
break;
}
}
}
if (ret != SUCCESS)
{
return (FAILURE);
}
}
if (parse_pgci(&pgcn))
{
return (9);
}
next_pgcn = pgcn;
next_pgn = ptt_srp[vts_ttn - 1][pttn - 1].pgn;
next_cell = rsm_info.cell_num;
return (NAV_PGC_PT_INIT);
}
USHORT get_pgc(void)
{
USHORT retval = NAV_PRE_CMD; /* goto pre_cmd phase */
USHORT done = 0;
USHORT tt;
USHORT ptt;
#if DBG_ON(DBG_TRACE)
DbgPrint(("get_pgc: ENTER\n"));
#endif
if (parse_pgci(&next_pgcn))
{
retval = NAV_STOP; /* goto stop phase */
}
else
{
next_pgn = 1; /* presents from the 1st program in PGC */
if (pgc_domain == TT_PGC)
{
set_sprm(SPRM_TT_PGCN_TT_DOM, next_pgcn);
done = 0;
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;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -