📄 nav_task.c
字号:
{
highlight_expire = 0xffffffff;
cell_still_expire = 0xffffffff;
button_sl_expire = 0xffffffff;
pgc_still_expire = 0xffffffff;
prev_ptt_expire = 0xffffffff;
}
void clear_all_timers(void)
{
clear_nav_timers();
skip_expire = 0xffffffff;
}
/**
* nav_task
* This is the navigation task which should never end
*
* @param argv - not used
*
* @return NONE
*/
ULONG nav_task(PVOID argv)
{
ULONG message[4]; /* what was the message */
ULONG out_msg[4]; /* outgoing message */
NAV_COMMAND key_cmd; /* incoming button command */
USHORT i; /* counter */
UBYTE new_ttn;
USHORT angle_num;
UBYTE current_cc_state;
NAV_STATE tNavState;
UCHAR retval = 0; /* function return value */
PE_ISTREAMCTRL_DVD_BUTTON Button;
PE_ICONFIGURE_VIDEO_FORMAT videoFormat;
/* Initialize */
disc_type = DISC_DVD;
power_on_flag = 0;
read_in_progress = 0;
prev_menu_key = KEY_PLAY;
#if LOADER_ERROR_RECOVER == TRUE
disc_error_count = 0;
disc_error_flag = 0;
#endif
parental_play_location.rsm.valid = 0;
dvd_stop_location.rsm.valid = 0;
/* Get video format from the PE */
PEiConfigureGetVideoOutput(tPE, &videoFormat);
/* set the video mode */
dvd_system_params.video_mode = videoFormat;
/* Initialize tv type */
if (dvd_system_params.video_mode == VIDEO_FORMAT_NTSC)
{
DBGPRINT(DBG_ON(DBG_TRACE), ("nav_task: TV_TYPE=0\n"));
TV_TYPE = 0;
}
else if (dvd_system_params.video_mode == VIDEO_FORMAT_PAL)
{
DBGPRINT(DBG_ON(DBG_TRACE), ("nav_task: TV_TYPE=1\n"));
TV_TYPE = 1;
}
while (fKillNavTasks == FALSE) /* task execution not exit this function unless we are closing the ap */
{
#ifdef SCRSAVER
switch (nav_state)
{
case STOPPED:
case FULL_STOPPED:
case CELL_STILL:
case PAUSED:
case DRIVE_EMPTY:
case UNLOADED:
/* check if the screen saver timer is already turned on, if standby is on,
* and if screen saver is set to on by the user in the setup menu. */
if ( (scrsaver_flg == FALSE) && (dvd_system_params.scr_saver == FALSE) )
{
NU_Control_Timer(&timer_screensaver, NU_ENABLE_TIMER);
}
break;
default:
break;
}
#endif
/* DAK: This is the ONLY place to receive messages from queue_nav! */
DBGPRINT(DBG_ON(DBG_VERBOSE), ("nav_task() -- Wait for message\n"));
if (OS_MsgQReceive(queue_nav, (char *)&message[0], NAV_MSG_SIZE, OS_WAIT_FOREVER) == OS_OK)
{
if (message[0] == NAV_TASK_EXIT)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("nav_task() -- NAV_TASK_EXIT\n"));
stop_spu_decode();
nav_state = UNLOADED;
continue;
}
if (message[0] == NAV_BEG_STREAM)
{
DBGPRINT(DBG_ON(DBG_TRACE), ("nav_task() -- NAV_BEG_STREAM\n"));
if (nav_pack_abort == 1)
{
nav_pack_abort = 0;
}
if (nav_pack_suspend == 1)
{
nav_pack_suspend = 0;
}
if (modify_video_mode == 1)
{
/* change the aspect ratio */
change_video_mode();
modify_video_mode = 0;
}
/* If video is muted unmute */
PEiConfigureSetVideoMute(tPE, VIDEO_MUTE_OFF);
/* in case we told the pe to go idle */
PEiStreamCtrlResumeFromIdle(tPE, INPUT_MAIN);
continue;
}
if (message[0] == NAV_END_STREAM)
{
DBGPRINT(DBG_ON(DBG_TRACE), ("nav_task() -- NAV_END_STREAM\n"));
if (last_vobu_mode == CELL_STILL_CELL_CMD)
{
uint32 uiDRStatus;
/* get the current status */
DRGetStatus(tDR, DR_STREAM_MAIN, DR_STATCMD_BUFFERS, &uiDRStatus);
/* if the dr is idle send a track buffer empty message to the nav */
fTrackEmpty = ( (uiDRStatus & DR_STATUS_TRACK_BUFFER_EMPTY) &&
((uiDRStatus & DR_STATUS_QUEUE_BUFFER) == 0) );
}
else
{
BOOLEAN fEndOfPGC = (BOOLEAN)(message[1]);
/* If this is the last pg and cell of the program chain,
* check for track buffer empty.
* The DR returns this state with the end of stream event. */
if (fEndOfPGC)
{
uint32 uiDRStatus;
/* get the current status */
DRGetStatus(tDR, DR_STREAM_MAIN, DR_STATCMD_BUFFERS, &uiDRStatus);
/* if the dr is idle send a track buffer empty message to the nav */
fTrackEmpty = ( (uiDRStatus & DR_STATUS_TRACK_BUFFER_EMPTY) &&
((uiDRStatus & DR_STATUS_QUEUE_BUFFER) == 0) );
}
else
{
fTrackEmpty = FALSE;
}
}
if (fTrackEmpty)
{
PEiStreamCtrlRequestDecodeDoneEvent(tPE, INPUT_MAIN);
}
/* If video is muted unmute.
* Don't unmute if the nav is STOPPED, this is necessary for the single-stop condition */
if ((isVideoMuted()) && (nav_state != STOPPED) )
{
PEiConfigureSetVideoMute(tPE, VIDEO_MUTE_OFF);
}
continue;
}
if (message[0] == NAV_DEC_DONE)
{
DBGPRINT(DBG_ON(DBG_TRACE), ("nav_task(): NAV_DEC_DONE\n"));
if (fTrackEmpty == TRUE)
{
fTrackEmpty = FALSE;
/*
* Do not stop the PE here. The PE is stopped at the start of the next
* playback stream, or when the navigator goes into the full-stop state.
*/
DBGPRINT(DBG_ON(DBG_TRACE), ("nav_task(): navProcessTrackBufferEmpty()\n"));
retval = navProcessTrackBufferEmpty();
}
continue;
}
key_cmd = (NAV_COMMAND)message[0];
DBGPRINT(DBG_ON(DBG_VERBOSE), ("nav_task() -- Processing key_cmd = %d (0x%x)\n", key_cmd, key_cmd));
}
else
{
DBGPRINT(DBG_ON(DBG_ERROR), ("nav_task() -- OS_MsgQReceive FAILED\n"));
continue;
}
#ifdef SCRSAVER
NU_Control_Timer(&timer_screensaver, NU_DISABLE_TIMER);
NU_Reset_Timer(&timer_screensaver, (void *) screensaver_timer, SCRSAVER_TIME, 0, NU_DISABLE_TIMER);
if (scrsaver_flg != 0)
{
scrsaver_flg = 0;
stop_screensaver();
if (!((key_cmd == KEY_TRAY) && (1 == message[1])))
{
continue;
}
}
#endif
#if LOADER_ERROR_RECOVER == TRUE
if (1 == disc_error_flag)
{
continue;
}
#endif
if (disc_type == DISC_UNKNOWN)
{
DBGPRINT(DBG_ON(DBG_TRACE), ("nav_task() -- DISC_UNKNOWN\n"));
continue;
}
#if REGION_CHECK == TRUE
if (invalid_region != 0)
{
continue;
}
#endif
/*
* If incoming message is not one of the following, check for wait_for button_hl flag
*/
if ( (key_cmd != LOADER_TRACK_BUFFER_EMPTY) &&
(key_cmd != NAV_CELL_STILL_EXPIRED) &&
(key_cmd != NAV_PREV_PG_EXPIRED) &&
(key_cmd != KEY_PREV_PG) &&
(key_cmd != KEY_NEXT_PG) &&
(key_cmd != NAV_TIMER_EXPIRED) &&
(key_cmd != NAV_BTN_SL_EXPIRED) &&
(key_cmd != NAV_PGC_STILL_EXPIRED) &&
(key_cmd != NAV_HLI_EXPIRED) &&
(key_cmd != NAV_UPDATE_AUDIO) &&
(key_cmd != KEY_TOP_PG_SEARCH) &&
(key_cmd != NV_PCK_READY) &&
(key_cmd != KEY_ANGLE_CHANGE) &&
(key_cmd != KEY_STOP) &&
(player_state == NORMAL_PLAY) &&
(navIsTrickCmd(key_cmd) == FALSE)
)
{
if (1 == wait_for_button_hl)
{
DBGPRINT(DBG_ON(DBG_TRACE), ("nav_task() -- wait_for_button_hl\n"));
continue;
}
}
/*
* Enable only the following keys during disc loading
*/
if ((nav_state == POWER_ON_FP) && (key_cmd != KEY_PLAY))
{
continue;
}
/* Reset out message */
out_msg[0] = out_msg[1] = out_msg[2] = out_msg[3] = 0;
/*
* Navigator State Machine
*/
switch (key_cmd)
{
case KEY_PLAY_LOCATION:
DBGPRINT(DBG_ON(DBG_TRACE), ("nav_task() - case KEY_PLAY_LOCATION\n"));
if (message[1] && ( ((NAV_DVD_LOCATION *)message[1])->ulSize >= sizeof(NAV_DVD_LOCATION)) )
{
play_location((NAV_DVD_LOCATION *)message[1]);
}
else
{
DbgPrint(("Invalid location handle or size, %s, %d\n", __FILE__, __LINE__));
}
break;
case KEY_STOP:
DBGPRINT(DBG_ON(DBG_TRACE), ("nav_task() - case KEY_STOP\n"));
if ( ( (message[1] != VDVD_STOP_MODE_FORCED) &&
( (pgc_gi.pgc_uop_ctl[3] & 0x08) ||
( (nvpck[CURRENT].pci_gi.vobu_uop_ctl[3] & 0x08) && (pgc_mode >= PGC_PG_PLAY) ) ) ) ||
(nav_state == FULL_STOPPED) || (nav_state == DRIVE_EMPTY) )
{
uop_prohibited_msg(0);
continue;
}
if (WAIT_NEXT_CMD) /* temporarily lock out trick keys until previous has activated */
{
break;
}
if (read_in_progress || (0 == nv_pck_ready))
{
continue;
}
if (skip_flag)
{
update_timedisp(0);
}
DisableNavCmdTimer();
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__));
}
}
prev_apstb = 0xff;
adjust_nv_tmr = 0;
during_search = 0;
if (nav_state == STOPPED)
{
DBGPRINT(DBG_ON(DBG_TRACE), ("nav_task: case KEY_STOP: if (nav_state == STOPPED)\n"));
if (!dvd_stop_location.rsm.valid)
{
clear_nav_timers();
nav_timer_counter = 0;
prev_menu_key = KEY_PLAY; /* Initialize prev_menu_key */
/*******************************************/
if (repeat_mode != REPEAT_OFF)
{
repeat_count = A_B_count = 0;
repeat_mode = REPEAT_OFF;
UsrSendRepeatEvent(VDVD_INFO_REPEAT_OFF);
}
A_B_count = repeat_count = 0;
DBGPRINT(DBG_ON(DBG_TRACE), ("nav_task() -- , Line=%d\n", __LINE__));
stop_spu_decode();
/* CELL_V1 */
if (last_vobu_flag == 1)
{
last_vobu_flag = 2;
}
clear_loader_queue();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -