📄 nav_task.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 nav_task.c
*
* Act on DVD Cell-Commands, Button Commands, Pre-Commands and Post-Commands.
*
* $Id: nav_task.c,v 1.223 2007/01/26 22:52:37 rbehe Exp $
*/
#include <stdlib.h>
#include "vdvd_types.h"
#include "osapi.h"
#include "loader_app.h"
#include "dr_app.h"
#include "pe_app.h"
#include "nav_task.h"
#include "disctask.h"
#include "dvd_vmgi.h"
#include "dvd_vtsi.h"
#include "dvdnvpck.h"
#include "dvd_pgci.h"
#include "pgc_play.h"
#include "dvd_prm.h"
#include "readdir.h"
#include "dvd_menu.h"
#include "init.h"
#include "karaoke.h"
#include "timer.h"
#include "nav_xtra.h"
#include "parstask.h"
#include "timer.h"
#include "dvd_cmd.h"
#include "hw_init.h"
#include "trickmode.h"
#include "spu_con.h"
#include "dbgprint.h"
#include "but_hl.h"
#include "usrapi.h"
#include "dvd_app.h"
#ifdef DMALLOC
#include "dmalloc.h"
#endif
/* MACROS */
#define DEBUG_NAV_TASK DBG_ERROR /* set the debug level for prints, 0 for no prints */
#define DBG_ON(x) (DEBUG_NAV_TASK >= x) /* local macro for deciding if should print */
#define NUM_LOOPS_PER_SECOND 10 /* don't change this! */
#define KEY_WAIT_TIMEOUT 2 /* timeout in seconds */
extern TITLE_SET_FILE_STRUCT vts_file[99];
extern DVD_SYSTEM_PARAMS dvd_system_params;
extern LOADER_HANDLE tLoader;
extern DR_HANDLE tDR;
extern PE_HANDLE tPE;
extern BOOLEAN fKillNavTasks;
extern OS_SEM_ID nvpck_sem;
extern OS_SEM_ID prm_sem;
extern BOOLEAN fAngleReady;
#define START 0
#define RESTART 1
extern rsm_info_struct rsm_info;
extern UBYTE AGAP_FLG;
extern USHORT timer_count, timer_count1, hli_count;
extern UBYTE button_cmd_buff[MAX_CEL_CMD_NS][SIZEOF_CMD];
extern UBYTE freeze_frame_flag;
extern UBYTE trick_mode_skip;
extern UBYTE temp_pml;
extern UBYTE nav_suspend_flag;
extern USHORT suspending_nav_cmd;
extern USHORT suspending_cmd_index;
extern USHORT resume_cmd_index;
extern UBYTE change_hl_forbidden;
extern ULONG hli_end_ptm;
extern USHORT repeat_ttn;
extern INT P_H_SIZE;
extern INT P_V_SIZE;
extern UBYTE title_play_enter;
extern UBYTE button_num;
extern UBYTE clear_search;
extern UBYTE IPP_TRICK_MODE;
extern UBYTE which_sp;
extern UBYTE read_in_progress;
extern ULONG rsm_nv_pck_lbn;
static USHORT rsm_stop_pgc_mode = PGC_STOP; /* Variable used to remember pgc_mode after prestop */
extern BOOLEAN fStartNavTimerCounter;
extern BOOLEAN fNopTimerEnabled;
extern VMG_FILE_STRUCT video_ts;
extern UBYTE timedisp_on;
extern UBYTE timedisp_resume;
extern USHORT lang_index;
extern UBYTE trick_rsm_cell;
extern UBYTE trick_rsm;
UBYTE DISK_TYPE;
UBYTE TV_TYPE;
UBYTE TV_Type_Changed;
UBYTE disc_type; /* physical type of disc in drive */
UBYTE audio_mode[2];
UBYTE video_mode[2];
UBYTE WAIT_NEXT_CMD = 0;
int timeout_wait_next_cmd;
UBYTE stepDir = STEP_FORWARD_DIRECTION; /* Added for step backward support JPM 12/17/01 */
ULONG lbuf[LBUFSIZE];
UBYTE * sbuf;
UBYTE S_DISP = 0;
UBYTE S_VIDEO = 0;
UBYTE S_AUDIO = 0;
UBYTE AGAP_FLG;
UBYTE modify_video_mode = 0;
UBYTE forcedly_reset_scr;
UBYTE player_state;
UBYTE reset_scr_flag;
INT LX, LY, P_V_SIZE, P_H_SIZE;
/*** End of "placeholder variables" ***/
USHORT user_program[2][99][2];
UBYTE user_program_enable = 0, last_program[2], current_program, user_program_start = 0;
UBYTE which_program_set = 0, program_set_changed = FALSE;
UBYTE power_on_flag = FALSE;
UBYTE continuous_skip_tt;
UBYTE track_buffer_empty = 0;
UBYTE during_search = 0;
OS_MSG_Q_ID queue_nav;
NAV_STATE nav_state = FULL_STOPPED /* STOPPED */ ; /* navigation state variable */
ULONG highlight_expire, cell_still_expire, button_sl_expire, prev_ptt_expire, skip_expire;
ULONG pgc_still_expire, nav_timer_counter, nv_tmr_100, nv_tmr_set;
UBYTE adjust_nv_tmr;
USHORT num_of_times, vobu_button_hl;
int reset_scr_count;
USHORT cell_play_counter;
UBYTE angle_change = 0;
UBYTE goto_angle; /* number key select angle */
USHORT angle_cell_start = 1;
ULONG prev_ptt_time, A_addr, B_addr;
USHORT prev_ptt_count = 0;
UBYTE skip_flag = 0, block_continuous_skip = 0, kara_freeze = 0, prev_pg_prohibited = 0;
UBYTE repeat_mode, A_B_count, repeat_count;
UBYTE wait_first_nvpck = 0;
ULONG program_on = FALSE; /* flag to indicate if the program menu is on */
ULONG search_on = FALSE; /* flag to indicate if the search menu is on */
ULONG shuffle_on = FALSE; /* flag to indicate if the shuffle mode is on */
ULONG search_mode = 0;
ULONG echomenu_on = FALSE;
ULONG keymenu_on = FALSE;
#if SUBTITLE_MODE == SUBTITLE_1
ULONG subtitle_menu = FALSE;
#endif
UBYTE button_number_on = FALSE; /* flag to indicate if the button select state is TRUE */
UBYTE settmppml_on = FALSE;
UBYTE parental_prohibit = 0; /* flag to indicate the DVD plv is too low */
BOOLEAN fParental_Play = FALSE; /* flag to indicate override parental prohibit */
UBYTE tmp_disc_type;
UBYTE angle_flag = 0; /* flag to indicate if there is angle or not in the current VOBU */
UBYTE zoom_on = FALSE; /* flag to indicate if the zoom mode is turned on */
PE_ICONFIGURE_ZOOM_PARAMETERS peZoomRestoreInfo;
#ifdef LAST_MEMO
LAST_MEMO_STRUCT last_memo[5];
UBYTE last_memo_index = 0xff;
void read_last_memo (void);
void write_last_memo (void);
#endif
#ifdef CONDITION
CONDITION_STRUCT condition[5];
UBYTE condition_index = 0xff;
void read_condition(void);
void write_condition(void);
#endif
#if REGION_CHECK == TRUE
UBYTE invalid_region;
#endif
UBYTE prev_apstb = 0xff;
#ifdef VDVD_PORT_TL_COMPILE
UBYTE CAPTION;
#else
extern UBYTE CAPTION;
#endif
void set_cc_state(UBYTE state);
UBYTE get_cc_state(void);
void disable_venc_cc(void);
void enable_venc_cc(void);
USHORT next_cell_v1, last_vobu_mode, send_another_cell_request;
UBYTE next_pgn_v1, last_vobu_flag = 0;
ULONG ptt_v1, tt_v1, vts_tt_v1;
UBYTE program_ending;
USHORT wait_for_button_hl;
UBYTE resume_from_stop_prohibited;
NAV_STATE resume_prev_state;
#ifdef SCRSAVER
extern UBYTE scrsaver_flg;
#endif
#if ZOOM_MODE == ZOOM_MODE_1
/* cursor movement flag; 0: no movement, 1: left, 2: right, 3: up, 4: down */
UBYTE zoom_cursor_flg = 0;
#endif
NAV_COMMAND prev_menu_key;
UBYTE nv_pck_ready = 0;
USHORT astn_in_pre_stop;
#if LOADER_ERROR_RECOVER == TRUE
void disc_error_handle(void);
UBYTE disc_error_count, disc_error_flag;
ULONG nv_pck_buf[5];
#endif
/*
* Parental play location. This is used to keep track of location attempted to be played
* whenever a pgc is parental prohibited.
*/
NAV_DVD_LOCATION parental_play_location;
/*
* DVD stop location. This is used to keep track of location where playback
* was stopped on a single stop.
*/
NAV_DVD_LOCATION dvd_stop_location;
/* Nvpck with reference pictures available so that */
/* bitstream with still picure and audio can use it */
/* to do resume from menu */
ULONG valid_lbn_for_rsm;
USHORT angle_num_tt; /* copy of sprm[3] */
USHORT last_vobu_c_idn;
UBYTE last_vobu_vob_idn;
UBYTE pre_menu_next_pgn;
UBYTE nav_pack_abort = 0; /* flag to stop incoming nav_pack processing until new BEG_STREAM */
UBYTE nav_pack_suspend = 0;
static BOOLEAN fTrackEmpty = FALSE;
/*
* PRIVATE FUNCTION PROTOTYPES
*****************************************************************************/
static void load_shuffle_list(void);
static void Enter_shuffle_mode(void);
static void Exit_shuffle_mode(void);
static void playback_next_user_program(UBYTE);
static void next_user_program(void);
static void sus_for_zoom(void);
static BOOLEAN next_cell_play_v1(void);
static USHORT ilvu_last_cell_v1(void);
static void cell_play_v1(void);
static USHORT get_prev_cell_v1(void);
static BOOLEAN do_cell_still(void);
static BOOLEAN navIsTrickCmd(NAV_COMMAND key_cmd);
static void queue_control(UBYTE mode);
#if defined(CONDITION) || defined (LAST_MEMO)
static UBYTE get_max_index(UBYTE);
#endif
static UCHAR navProcessTrackBufferEmpty(void);
static void navtaskSplashScreenShow(void);
static void navtaskSplashScreenHide(void);
static void navtaskCheckPtlCtyCdMatch(void);
static void navtaskKeyActivateButton(void);
static void navtaskKeyPause(void);
static void navtaskKeyStillOff(void);
/*
* get_nav_state()
*
* FILENAME: inter_fc.c
*
* PARAMETERS: None
*
* DESCRIPTION: Get the current navigate state
*
* RETURNS: The current navigate state;
* The enum VDVD_NAV_STATE is defined in the file "vdvd_types.h"
*
*/
NAV_STATE get_nav_state(void)
{
return (nav_state);
}
ULONG get_scr(void)
{
TIME45k time45k_STC;
PEiStreamCtrlGetSCR(tPE, &time45k_STC);
return (time45k_STC * 2);
}
void audio_gap(ULONG* A_S_PTM1, ULONG* A_S_PTM2, ULONG* A_GAP_LEN1, ULONG* A_GAP_LEN2)
{
DBGPRINT(DBG_ON(DBG_TRACE), ("audio_gap() STUB\n"));
start_scr();
}
void reset_scr(ULONG scr_value)
{
DBGPRINT(DBG_ON(DBG_TRACE), ("reset_scr() STUB, scr_value=%d\n", scr_value));
}
void play_ni(void)
{
PE_ISTREAMCTRL_STATE State;
DBGPRINT(DBG_ON(DBG_TRACE), ("play_ni: ENTER\n"));
WAIT_NEXT_CMD = 1;
timeout_wait_next_cmd = 0;
AGAP_FLG = 0; /* reset the audio gap state machine */
S_AUDIO = 0; /* reset A-decoder start FLG */
S_VIDEO = 0; /* reset V-decoder start FLG */
S_DISP = 1; /* reset Display start FLG */
unpause_spu();
EnableNavCmdTimer();
/* disable any trickmodes */
PEiStreamCtrlResume(tPE);
/* Get the PE run state */
PEiStreamCtrlGetState(tPE, &State);
/* If PE is not stopped, do it now */
if (State == PE_ISTREAMCTRL_STATE_RUN)
{
/* stop the decoder */
PEiStreamCtrlStop(tPE, TRUE);
}
/* Prefill the PE */
DBGPRINT(DBG_ON(DBG_TRACE), ("play_ni() -- PEiStreamCtrlPrefill\n"));
PEiStreamCtrlPrefill(tPE, INPUT_MAIN, FALSE);
}
void clear_nav_timers(void)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -