📄 dvd_app.cpp
字号:
case VDVD_COMMAND_RIGHT:
msg[0] = KEY_RIGHT_BUTTON_SELECT;
break;
case VDVD_COMMAND_NUMERIC_BUTTON_SELECT:
msg[0] = KEY_GOTO_BUTTON;
break;
case VDVD_COMMAND_AUDIO_SELECT:
msg[0] = KEY_AUDIO_SELECT;
ulInfo = ulInfo - 1;
break;
case VDVD_COMMAND_MENU:
msg[0] = KEY_VTSM;
ulInfo = VTSM_DOM;
break;
case VDVD_COMMAND_TITLE:
msg[0] = KEY_VMGM;
ulInfo = VMGM_DOM;
break;
case VDVD_COMMAND_ANGLE:
msg[0] = KEY_ANGLE_CHANGE;
break;
case VDVD_COMMAND_INFO:
msg[0] = KEY_STEP; // Added for use in testing Step functionality
break;
case VDVD_COMMAND_PARENTAL_PLAY:
msg[0] = KEY_SETTMPPML;
break;
case VDVD_COMMAND_GOTO_CHAPTER:
msg[0] = KEY_PTT_SEARCH;
break;
case VDVD_COMMAND_GOTO_TITLE:
msg[0] = KEY_TITLE_PLAY;
break;
case VDVD_COMMAND_GOTO_TIME:
msg[0] = KEY_TIME_SEARCH;
break;
case VDVD_COMMAND_SUBTITLE_SELECT:
msg[0] = KEY_SUB_PICTURE_STREAM_CHANGE;
if (ulInfo == 0)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("DvdAppCommandHandler: Invalid subtitle stream number!\n"));
bSendMsg = FALSE;
}
else
{
ulInfo = ulInfo - 1;
}
break;
case VDVD_COMMAND_SUBTITLE_ON_OFF:
msg[0] = KEY_SUB_PICTURE_STREAM_ON_OFF;
break;
case VDVD_COMMAND_ZOOM:
msg[0] = KEY_ZOOM;
break;
default:
DBGPRINT(DBG_ON(DBG_TRACE), ("DvdAppCommandHandler: Command not supported\n"));
bSendMsg = FALSE;
break;
}
if (bSendMsg)
{
msg[1] = ulInfo;
/* Send message to nav task */
if ( OS_MsgQSend(queue_nav, (char *)&msg[0], NAV_MSG_SIZE, OS_NO_WAIT, OS_MSG_PRI_NORMAL) )
{
DbgPrint(("DvdAppUIHandler: Send message to nav failed!"));
return (DVDAPP_FAILURE);
}
}
else
{
/* notifiy unsupported command */
UsrSendProhibitedEvent(VDVD_INFO_PROH_CMD_NOT_SUPPORTED, ulCommand);
}
return (DVDAPP_SUCCESS);
}
/**
* Initialize the navigator, create threads, semaphores, timers, queues, etc.
*/
void DvdAppStartNav(void)
{
ULONG msg[4];
/* start playback */
msg[0] = KEY_PLAY;
OS_MsgQSend(queue_nav, (char *)&msg[0], NAV_MSG_SIZE, OS_WAIT_FOREVER, OS_MSG_PRI_NORMAL);
}
/*
* Functions for setting dvd system parameters
******************************************************************************/
/**
* DvdAppSetMenuLanguage -- Set the default dvd menu language
*
* @param
* ucLangCode - language code for dvd menu
*
* @retval
* none.
*/
void DvdAppSetMenuLanguage(UCHAR ucLangCode)
{
/* update the system parameter */
if (0 == ucLangCode)
{
dvd_system_params.dvd_menu_language = 139;
}
else
{
dvd_system_params.dvd_menu_language = ucLangCode;
}
if (fDVDAppStarted == TRUE)
{
/* update the sprm */
sprm_init_from_system_params();
}
}
/**
* DvdAppSetAudioLanguage -- Set the default audio language
*
* @param
* ucLangCode - language code for audio
*
* @retval
* none.
*/
void DvdAppSetAudioLanguage(UCHAR ucLangCode)
{
/* update the system parameter */
if (0 == ucLangCode)
{
dvd_system_params.audio = 139;
}
else
{
dvd_system_params.audio = ucLangCode;
}
if (fDVDAppStarted == TRUE)
{
/* update the sprm */
sprm_init_from_system_params();
}
}
/**
* DvdAppSetSubtitleLanguage -- Set the default subtitle language
*
* @param
* ucLangCode - language code for subtitles
*
* @retval
* none.
*/
void DvdAppSetSubtitleLanguage(UCHAR ucLangCode)
{
/* update the system parameter */
if(0 == ucLangCode)
{
dvd_system_params.subtitle = 139;
}
else
{
dvd_system_params.subtitle = ucLangCode;
}
if (fDVDAppStarted == TRUE)
{
/* update the sprm */
sprm_init_from_system_params();
}
}
/**
* DvdAppSetCountry -- Set the country code
*
* @param
* ucCountryCode - country code
*
* @retval
* none.
*/
void DvdAppSetCountry(UCHAR ucCountryCode)
{
/* update the system parameter */
dvd_system_params.country = ucCountryCode;
if (fDVDAppStarted == TRUE)
{
/* update the sprm */
sprm_init_from_system_params();
}
}
/**
* DvdAppSetParentalLevel -- Set the parental level
*
* @param
* ucLevel - parental level (1 - 8); 0 = off
*
* @retval
* none.
*/
void DvdAppSetParentalLevel(UCHAR ucLevel)
{
if (ucLevel <= 8)
{
if (ucLevel == 0)
{
/* parental control off */
ucLevel = 0x0f;
}
/* update the system parameter */
dvd_system_params.parental = ucLevel;
if (fDVDAppStarted == TRUE)
{
/* update the sprm */
sprm_init_from_system_params();
}
}
}
/**
* DvdAppSetVideoFormat -- Set the video format
*
* @param
* ucVideoFormat - video format
*
* @retval
* none.
*/
void DvdAppSetVideoFormat(UCHAR ucVideoFormat)
{
/* update the system parameter */
dvd_system_params.video_mode = ucVideoFormat;
if (fDVDAppStarted == TRUE)
{
/* update the sprm */
sprm_init_from_system_params();
}
}
/**
* DvdAppSetAspectRatio -- Set the aspect ratio
*
* @param
* ucAspectRatio - aspect ratio
*
* @retval
* none.
*/
void DvdAppSetAspectRatio(UCHAR ucAspectRatio)
{
/* update the system parameter */
dvd_system_params.video_mode2 = ucAspectRatio;
if (fDVDAppStarted == TRUE)
{
/* update the sprm */
sprm_init_from_system_params();
/* set flag to indicate tv type changed */
TV_Type_Changed = 1;
}
}
/**
* DvdAppSetDigitalAudioOutput -- Set the audio output
*
* @param
* ucDigOut - digital audio output
*
* @retval
* none.
*/
void DvdAppSetDigitalAudioOutput(UCHAR ucDigOut)
{
/* update the system parameter */
dvd_system_params.digital_out = ucDigOut;
if (fDVDAppStarted == TRUE)
{
/* update the sprm */
sprm_init_from_system_params();
}
}
/*
* This API is used to set the player region code.
*
* The players default region is configurable by defining the following variables in
* the make file or build environment. If not defined the player is hard coded
* to be Region 1.
*
* Environment settings to override the hard coded region:
* add -D "DVD_SPRM_REGION_DEFAULT=X" - where X is the desired region for DVD
*/
void DvdAppSetPlayerRegionCode(UCHAR ucRegionCode)
{
set_sprm(SPRM_REGION_COD, (USHORT)ucRegionCode);
}
/*
* Functions for querying the dvd nav for state information
******************************************************************************/
/**
* DvdAppGetLocationHandleSize -- Get size of dvd location handle
*
* @param
* none
*
* @retval
* size in bytes
*/
ULONG DvdAppGetLocationHandleSize(void)
{
return (sizeof(NAV_DVD_LOCATION));
}
/**
* DvdAppGetLocation -- Get location of dvd playback
*
* @param
* pvLocation - location handle
* ulSize -- size of buffer pointed to by location handle
*
* @retval
* DVDAPP_STATUS
*/
DVDAPP_STATUS DvdAppGetLocation(PVOID pvLocation, ULONG ulSize)
{
if (pvLocation == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("DvdAppGetLocation: NULL pointer!\n"));
return (DVDAPP_NULL_PTR);
}
if (ulSize < sizeof(NAV_DVD_LOCATION) )
{
DBGPRINT(DBG_ON(DBG_ERROR), ("DvdAppGetLocation: Invalid size!\n"));
return (DVDAPP_INVALID_PARAM);
}
if (fDVDAppStarted == FALSE)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("DvdAppGetLocation: dvd nav not started!\n"));
return (DVDAPP_FAILURE);
}
/*
* Setting a bookmark is prohibited in the following cases
* 1. Current title is a random or multi-title pgc.
* 2. Current PGC type is menu.
* 3. Full-stop state.
*/
if ( (tt_srp[get_sprm(SPRM_TTN_TT_DOM) - 1].tt_pb_ty & 0x40) ||
(pgc_domain == VMGM_PGC) || (pgc_domain == VTSM_PGC) ||
(DvdAppGetPlayState() == VDVD_STATUS_FULLSTOP) )
{
return (DVDAPP_PROHIBITED);
}
/* set location handle size */
((NAV_DVD_LOCATION *)pvLocation)->ulSize = ulSize;
/* load location info into location handle */
set_location((NAV_DVD_LOCATION *)pvLocation);
return (DVDAPP_SUCCESS);
}
/**
* DvdAppGetPlayRate -- Get play rate of the nav
*
* @param
* none
*
* @retval
* play rate
*/
int32 DvdAppGetPlayRate(void)
{
if (fDVDAppStarted == FALSE)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("DvdAppGetPlayRate: dvd nav not running!\n"));
return (0);
}
return (TMGetPlayRate());
}
/**
* DvdAppGetPlayState -- Get play state of the nav
*
* @param
* none
*
* @retval
* play state
*/
USHORT DvdAppGetPlayState(void)
{
if (fDVDAppStarted == TRUE)
{
USHORT usNavStatus;
NAV_STATE state;
/* Get the dvd nav state */
state = get_nav_state();
if (pgc_domain != TT_PGC)
{
switch (state)
{
case STOPPED:
usNavStatus = VDVD_STATUS_STOP;
break;
case FULL_STOPPED:
usNavStatus = VDVD_STATUS_FULLSTOP;
break;
default:
usNavStatus = VDVD_STATUS_UNKNOWN;
break;
}
}
else
{
switch (state)
{
case STOPPED:
usNavStatus = VDVD_STATUS_STOP;
break;
case FULL_STOPPED:
usNavStatus = VDVD_STATUS_FULLSTOP;
break;
case NORMAL_PLAYING:
usNavStatus = VDVD_STATUS_PLAY;
break;
case SLOW_FORWARD:
usNavStatus = VDVD_STATUS_SLOW_F;
break;
case FAST_FORWARD:
usNavStatus = VDVD_STATUS_FAST_F;
break;
case PAUSED:
usNavStatus = VDVD_STATUS_PAUSE;
break;
case FAST_REVERSE:
usNavStatus = VDVD_STATUS_FAST_B;
break;
case CELL_STILL:
usNavStatus = VDVD_STATUS_STILL;
break;
default:
usNavStatus = VDVD_STATUS_UNKNOWN;
break;
}
}
return (usNavStatus);
}
else
{
DBGPRINT(DBG_ON(DBG_ERROR), ("DvdAppGetPlayState: dvd nav not running!\n"));
return (VDVD_STATUS_UNKNOWN);
}
}
/**
* DvdAppGetNumberOfTitles -- Get number of titles on the disc
*
* @param
* none
*
* @retval
* Number of titles
*/
USHORT DvdAppGetNumberOfTitles(void)
{
if (fDVDAppStarted == TRUE)
{
return (tt_srpti.tt_srp_n);
}
else
{
DBGPRINT(DBG_ON(DBG_ERROR), ("DvdAppGetNumberOfTitles: dvd nav not running!\n"));
return (0);
}
}
/**
* DvdAppGetNumberOfChapters -- Get number of chapters on the current title
*
* @param
* none
*
* @retval
* Number of chapters
*/
USHORT DvdAppGetNumberOfChapters(void)
{
if (fDVDAppStarted == TRUE)
{
return (tt_srp[sprm[SPRM_TTN_TT_DOM] - 1].ptt_n);
}
else
{
DBGPRINT(DBG_ON(DBG_ERROR), ("DvdAppGetNumberOfChapters: dvd nav not running!\n"));
return (0);
}
}
/**
* DvdAppGetCurrentTitle -- Get the current title number
*
* @param
* none
*
* @retval
* Current title number
*/
USHORT DvdAppGetCurrentTitle(void)
{
if (fDVDAppStarted == TRUE)
{
return (sprm[SPRM_TTN_TT_DOM]);
}
else
{
DBGPRINT(DBG_ON(DBG_ERROR), ("DvdAppGetCurrentTitle: dvd nav not running!\n"));
return (0);
}
}
/**
* DvdAppGetCurrentChapter -- Get current chapter number
*
* @param
* none
*
* @retval
* Current chapter number
*/
USHORT DvdAppGetCurrentChapter(void)
{
if (fDVDAppStarted == TRUE)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -