📄 dvd_menu.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_menu.c
*
* A DVD system menu is pre-defined on the disc. Buttons for the menu are made
* up of the sub-picture and highlight information. The button command is
* executed when activated by user operation. Each system menu shall have only
* one entry point (Entry PGC).
*
* $Id: dvd_menu.c,v 1.19 2007/01/26 22:52:37 rbehe Exp $
*/
#include "vdvd_types.h"
#include "dvd_prm.h"
#include "dvd_cmd.h" /* DVD button, cell, pre and post command macros */
#include "dvd_vtsi.h"
#include "dvd_vmgi.h"
#include "dvd_pgci.h"
#include "pgc_play.h"
#include "loader_app.h"
#include "readdir.h"
#include "timer.h"
#include "usrapi.h"
#include "dbgprint.h"
#ifdef DMALLOC
#include "dmalloc.h"
#endif
//#define DEBUG_DVD_MENU
/*extern ULONG vob_handle; jat tl I don't think this is used any where */
extern USHORT pgc_domain;
extern UBYTE next_vtsn;
extern ULONG next_vts_sa;
extern UBYTE disc_error_flag;
extern USHORT lang_index;
extern TITLE_SET_FILE_STRUCT vts_file[99];
/**
** Name: menu_ptl_check
**
** Description: check parental level before menu playback
**
** Arguments: ptl_id_field - pointer to 2 byte Parental_ID_Field
**
** Returns: SUCCESS or FAILURE
**
* Structures:
*
* Functionality: When starting to play back a PGC in Menu-space;
* 1) When Player_Parental_ID has "Not specified" value;
* Start to play back the Menu PGC or the first PGC of the Parental
* Block. The Player may not check the Parental_ID_Field value of this
* PGCI.
* 2) In case of a Parental Block;
* The Player selects and executes the appropriate Menu PGC for which the
* corresponding Parental ID (bit) of the Parental_ID_Field matches the
* Player_Parental_ID. The player shall bitwise compare each Menu PGC
* in a Parental Block. If there is no match, do not start to play back.
* 3) In all other cases;
* The Player checks whether the Parental_ID_Field value in the Menu PGCI
* specifies the same Parental ID as the VTS_Player_Parental_ID, which is
* based on a bitwise compare operation. If there is no match, do not
* start to play back.
*
**/
BOOLEAN
menu_ptl_check(UBYTE * ptl_id_field)
{
return (SUCCESS);
}
/**
** Name: save_resume_menu
**
** Description: save the RSM information by Menu_Call() operation
**
** Arguments:
**
** Returns:
**
* Structures:
*
* Pseudocode:
*
* Functionality: RSM information to save:
* - The cell number where title playback was interrupted.
* - The navigation pack address to resume.
* - PGC playback control status (loop, random, shuffle playback)
* - VTSN
* - SPRM(4): title number for title domain (TTN for TT_DOM)
* - SPRM(5): VTS title number for TT_DOM (VTS_TTN for TT_DOM)
* - SPRM(6): title PGC number for TT_DOM (TT_PGCN for TT_DOM)
* - SPRM(7): PTTN for One_Sequential_PGC_Title
* - SPRM(8): hilite button number for selection state (HL_BTNN)
*
**/
void
save_resume_menu(void)
{
}
/**
** Name: dvd_title_menu
**
** Description: call the Video Manager Menu (title menu) PGC from
** VTSM_DOM, TT_DOM and stop state for title selection
**
** Arguments: none
**
** Returns:
**
* Structures:
*
* Pseudocode:
*
* Functionality: Start execution of the entry PGC (or entry PGC block) of
* the title menu in the VMGM_DOM. When there are several titles in a VTS,
* the title menu may have a VOB, or it may be a PGC without a VOB for link
* by title number. If it has a VOB, the file will be opened and the
* decoder started in the presentation initialization phase of the PGC.
*
* got here by JumpSS or Menu_Call(TITLE_MENU)
*
**/
BOOLEAN dvd_title_menu(USHORT * pgcn)
{
USHORT temp_pgcn;
USHORT lang;
UBYTE ret;
temp_pgcn = *pgcn ? *pgcn : 1;
for (lang = 0; lang < vmgm_pgci_uti.vmgm_lu_n; lang++)
{
if (compare_code(vmgm_lu_srp[lang].vmgm_lcd[0],
vmgm_lu_srp[lang].vmgm_lcd[1],
get_sprm(SPRM_M_LCD)))
break;
else if (compare_code(vmgm_lu_srp[lang].vmgm_lcd[0],
vmgm_lu_srp[lang].vmgm_lcd[1],
0xffff))
break;
}
/*
* If none of the language matches with player setup, pick the first
* language available.
*/
if (lang == vmgm_pgci_uti.vmgm_lu_n)
lang = 0;
lang_index = lang;
{
pgc_domain = VMGM_PGC;
time_info->title_valid = time_info->chapter_valid = FALSE;
/* if entry PGC of title menu exists in this LU */
ret = parse_pgci(&temp_pgcn);
if (ret)
return (ret);
*pgcn = temp_pgcn;
return (SUCCESS);
}
}
/**
** Name: dvd_vts_menu
**
** Description: call the menu PGC from menu-space, TT_DOM and stop state
**
** Arguments: menu_id - Menu ID from button command operand
** vtsn - the video title set number:
** 0: current VTS-space
** 1 - 99: VTSN value
** vts_ttn - the title number:
** 1 - 99: VTS_TTN value
** Returns:
**
* Structures:
*
* Pseudocode:
*
* Functionality:
*
*
* Theory of Operation: Start execution of the Entry PGC (or Entry PGC
* Block) of the Menu in the VTSM_DOM which is specified by the Menu ID
* and the VTSN.
*
* got here from Menu_Call(menu_id) or JumpSS
*
**/
BOOLEAN dvd_vts_menu(UBYTE menu_id, UBYTE vtsn, UBYTE vts_ttn, USHORT * pgcn)
{
USHORT i;
USHORT lang;
BOOLEAN retval = SUCCESS;
if ((vtsn != next_vtsn) && vtsn)
{
for (i = 0; i < tt_srpti.tt_srp_n; i++)
{
if ((vtsn == tt_srp[i].vtsn) && (vts_ttn == tt_srp[i].vts_ttn))
{
break;
}
}
if (tt_srpti.tt_srp_n == i)
{
return (FAILURE);
}
set_sprm(SPRM_TTN_TT_DOM, (USHORT)(i + 1) );
next_vts_sa = tt_srp[i].vts_sa;
retval = get_vtsi_ifo(next_vts_sa);
if (retval != SUCCESS)
{
/* if there was a parse error retry */
if (retval == 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;
retval = get_vtsi_ifo(next_vts_sa);
break;
}
}
}
if (retval != SUCCESS)
{
/* Send status event that there is a disc error */
ULONG message[4];
message[0] = VDVD_STATUS_DISC_TYPE;
message[1] = MEDIA_FORMAT_CANNOT_PLAY;
UsrEventHandler(message);
return (FAILURE);
}
}
next_vtsn = vtsn;
}
for (lang = 0; lang < vtsm_pgci_uti.vtsm_lu_n; lang++)
{
if (compare_code(vtsm_lu_srp[lang].vtsm_lcd[0], vtsm_lu_srp[lang].vtsm_lcd[1], get_sprm(SPRM_M_LCD)))
{
break;
}
else if (compare_code(vtsm_lu_srp[lang].vtsm_lcd[0], vtsm_lu_srp[lang].vtsm_lcd[1], 0xffff))
{
break;
}
}
/*
* If none of the language matches with player setup, pick the first language available.
*/
if (lang == vtsm_pgci_uti.vtsm_lu_n)
{
lang = 0;
}
lang_index = lang;
pgc_domain = VTSM_PGC;
time_info->title_valid = time_info->chapter_valid = FALSE;
switch (menu_id)
{
case ROOT_MENU:
#ifdef DEBUG_DVD_MENU
DbgPrint(("dvd_vts_menu: ROOT_MENU\n"));
#endif
/*
* A Root Menu is defined by contents provider, however, it shall
* include the link function to audio, spu, angle and ptt menu if
* they exist.
*/
if (vtsm_lu_srp[lang].vtsm_exst & ROOTM_EXST)
{
/* if entry PGC of root menu exists in this LU */
for (i = 0; i < vtsm_lui[lang].vtsm_pgci_srp_n; i++)
{
if ((vtsm_pgci_srp[lang][i].vts_pgc_cat[0] & 0x0f) == ROOT_MENU)
{
break;
}
}
*pgcn = ++i;
retval = parse_pgci(pgcn);
}
break;
case SPU_MENU:
#ifdef DEBUG_DVD_MENU
DbgPrint(("dvd_vts_menu: SPU_MENU\n"));
#endif
/* VTS menu for sub-picture selection */
if (vtsm_lu_srp[lang].vtsm_exst & SPM_EXST)
{
/* if entry PGC of SPU menu exists in this LU */
for (i = 0; i < vtsm_lui[lang].vtsm_pgci_srp_n; i++)
{
if ((vtsm_pgci_srp[lang][i].vts_pgc_cat[0] & 0x0f) == SPU_MENU)
{
break;
}
}
*pgcn = ++i;
retval = parse_pgci(pgcn);
}
break;
case AUDIO_MENU: /* VTS menu for audio selection */
#ifdef DEBUG_DVD_MENU
DbgPrint(("dvd_vts_menu: AUDIO_MENU\n"));
#endif
if (vtsm_lu_srp[lang].vtsm_exst & AM_EXST)
{
/* if entry PGC of audio menu exists in this LU */
for (i = 0; i < vtsm_lui[lang].vtsm_pgci_srp_n; i++)
{
if ((vtsm_pgci_srp[lang][i].vts_pgc_cat[0] & 0x0f) == AUDIO_MENU)
{
break;
}
}
*pgcn = ++i;
retval = parse_pgci(pgcn);
}
break;
case ANGLE_MENU: /* VTS menu for angle selection */
#ifdef DEBUG_DVD_MENU
DbgPrint(("dvd_vts_menu: ANGLE_MENU, lang=%x, vtsm_lu_srp[lang].vtsm_exst=%x, vtsm_lui[lang].vtsm_pgci_srp_n=%x\n",
(int)lang, (int)vtsm_lu_srp[lang].vtsm_exst, (int)vtsm_lui[lang].vtsm_pgci_srp_n));
#endif
if (vtsm_lu_srp[lang].vtsm_exst & AGLM_EXST)
{
/* if entry PGC of angle menu exists in this LU */
for (i = 0; i < vtsm_lui[lang].vtsm_pgci_srp_n; i++)
{
#ifdef DEBUG_DVD_MENU
DbgPrint(("dvd_vts_menu: ANGLE_MENU, vtsm_pgci_srp[lang][%d].vts_pgc_cat[0] = %x\n",
(int)i, (int)vtsm_pgci_srp[lang][i].vts_pgc_cat[0]));
#endif
if ((vtsm_pgci_srp[lang][i].vts_pgc_cat[0] & 0x0f) == ANGLE_MENU)
{
break;
}
}
*pgcn = ++i;
retval = parse_pgci(pgcn);
}
break;
case PTT_MENU: /* VTS menu for part-of-title selection and start to play back. */
#ifdef DEBUG_DVD_MENU
DbgPrint(("dvd_vts_menu: PTT_MENU\n"));
#endif
if (vtsm_lu_srp[lang].vtsm_exst & PTTM_EXST)
{
/* if entry PGC of PTT menu exists in this LU */
for (i = 0; i < vtsm_lui[lang].vtsm_pgci_srp_n; i++)
{
if ((vtsm_pgci_srp[lang][i].vts_pgc_cat[0] & 0x0f) == PTT_MENU)
{
break;
}
}
*pgcn = ++i;
retval = parse_pgci(pgcn);
}
break;
default:
DbgPrint(("%s, %d, Invalid menu_id!\n", __FILE__, __LINE__));
break;
}
return (retval);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -