📄 dvd_pgci.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_pgci.c
*
* Functions to parse through PGCI DVD information files.
*
* $Id: dvd_pgci.c,v 1.42 2006/10/17 14:13:08 rbehe Exp $
*/
#include "vdvd_types.h"
#include "osapi.h"
#include "loader_app.h"
#include "pe_app.h"
#include "nav_task.h"
#include "dvd_cmd.h"
#include "dvd_vmgi.h"
#include "dvd_pgci.h"
#include "nav_xtra.h"
#include "dvd_vtsi.h"
#include "pgc_play.h"
#include "dvd_prm.h"
#include "readdir.h"
#include "init.h"
#include "store.h"
#include "dbgprint.h"
#include "usrapi.h"
#ifdef DMALLOC
#include "dmalloc.h"
#endif
//#define DEBUG_DVD_PGCI
/*---------- Variables -----------*/
/* PGC program map */
UBYTE pgc_pgmap[MAX_NUM_PG];
/* Cell Playback Information Table (C_PBI) */
c_pbi_struct c_pbi[MAX_NUM_CELLS];
/* Cell Position Information Table (C_POSI) */
c_posi_struct c_posi[MAX_NUM_CELLS];
/* Struct containing the Program Chain Gerneral Information */
pgc_gi_struct pgc_gi;
/* Struct containing the Program Chain Command Table Info */
pgc_cmdti_struct pgc_cmdti;
/* Buffers to store Pre, Post, and Cell Commands from Program Chain */
UBYTE pre_cmd_buff[MAX_PRE_CMD_NS][SIZEOF_CMD];
UBYTE post_cmd_buff[MAX_PST_CMD_NS][SIZEOF_CMD];
UBYTE c_cmd_buff[MAX_CEL_CMD_NS][SIZEOF_CMD];
ULONG last_sector_address; /* Prevents unnecessary disc_fread in parse_pgci */
ULONG last_start_address; /* Prevents unnecessary parse in parse_pgci */
extern LOADER_HANDLE tLoader;
extern DR_HANDLE tDR;
extern PE_HANDLE tPE;
extern ULONG next_vts_sa;
extern USHORT pgc_domain;
extern UBYTE nv_pck_ready;
extern UBYTE power_on_flag;
extern UBYTE *sbuf;
extern VMG_FILE_STRUCT video_ts;
extern TITLE_SET_FILE_STRUCT vts_file[99];
extern USHORT lang_index;
extern USHORT country_index;
/**
* Name: parse_fp_pgci
*
* Description: Parses the First Play Program Chain Information
*
*
* Arguments:
*
*
* Returns: nothing
*
* Structures:
*
* Pseudocode:
*
*/
void parse_fp_pgci(void)
{
/* Parse the FP PGCI GI */
parse_pgci_gi(vmgi_mat.fp_pgci_sa);
/* Parse Program Chain Command Table */
parse_pgc_cmdti(pgc_gi.pgc_cmdt_sa, vmgi_mat.fp_pgci_sa);
/* Parse Program Chain Program Map */
parse_pgc_pgmap(pgc_gi.pgc_pgmap_sa, vmgi_mat.fp_pgci_sa);
/* Parse the Cell Playback Information Table */
parse_c_pbi(pgc_gi.c_pbit_sa, vmgi_mat.fp_pgci_sa);
/* Parse the Cell Position Information Table */
parse_c_posit(pgc_gi.c_posit_sa, vmgi_mat.fp_pgci_sa);
}
UBYTE check_parental(USHORT * pgci_num)
{
USHORT pgc_ptl_id; /* parental control ID */
USHORT ptl_id;
USHORT i, level;
(*pgci_num)--; /* make it zero based */
parental_prohibit = 0;
switch (pgc_domain)
{
case VMGM_PGC:
if ((vmgi_mat.ptl_mait_sa) && (get_sprm(SPRM_PTL_LVL) != PARENTAL_OFF))
{
if ((ptl_mai_srp[0].cty_cd[0] == 'Z') && (ptl_mai_srp[0].cty_cd[1] == 'Z'))
{
country_index = 0;
}
else
{
for (i = 0; i < ptl_maiti.cty_n; i++)
{
if (compare_code(ptl_mai_srp[i].cty_cd[0], ptl_mai_srp[i].cty_cd[1], get_sprm(12)))
{
break;
}
}
country_index = i;
if (i == ptl_maiti.cty_n)
{
country_index = 0;
}
}
/* get parental level from SPRM */
level = get_sprm(SPRM_PTL_LVL) - 1;
/* search only in parental block */
if (vmgm_pgci_srp[lang_index][*pgci_num].vmgm_pgc_cat[1] & 0x30)
{
ptl_id = ptl_lvli[country_index][level][0];
/*
* parental control available Search until the last PGC in the block
*/
i = *pgci_num;
do
{
pgc_ptl_id = ((vmgm_pgci_srp[lang_index][i].vmgm_pgc_cat[2] << 8) |
vmgm_pgci_srp[lang_index][i].vmgm_pgc_cat[3]);
if (ptl_id & pgc_ptl_id)
{
break;
}
if (++i == vmgm_lui[lang_index].vmgm_pgci_srp_n)
{
i = 0;
break;
}
} while ((vmgm_pgci_srp[lang_index][i].vmgm_pgc_cat[1] & 0xc0) != 0xc0);
*pgci_num = i;
}
else
{
ptl_id = ptl_lvli[country_index][level][0];
pgc_ptl_id = ((vmgm_pgci_srp[lang_index][*pgci_num].vmgm_pgc_cat[2] << 8) |
vmgm_pgci_srp[lang_index][*pgci_num].vmgm_pgc_cat[3]);
if (!(ptl_id & pgc_ptl_id))
{
/* Output warning OSD if level is not high enough */
parental_prohibit = 1;
(*pgci_num)++; /* make it one based */
return (9);
}
}
}
break;
case VTSM_PGC:
if ( (vmgi_mat.ptl_mait_sa) && (get_sprm(SPRM_PTL_LVL) != PARENTAL_OFF) )
{
if ( (ptl_mai_srp[0].cty_cd[0] == 'Z') && (ptl_mai_srp[0].cty_cd[1] == 'Z') )
{
country_index = 0;
}
else
{
for (i = 0; i < ptl_maiti.cty_n; i++)
{
if (compare_code(ptl_mai_srp[i].cty_cd[0], ptl_mai_srp[i].cty_cd[1], get_sprm(12)))
{
break;
}
}
country_index = i;
if (i == ptl_maiti.cty_n)
{
country_index = 0;
}
}
/* get parental level from SPRM */
level = get_sprm(SPRM_PTL_LVL) - 1;
/* search only in parental block */
if (vtsm_pgci_srp[lang_index][*pgci_num].vts_pgc_cat[1] & 0x30)
{
ptl_id = ptl_lvli[country_index][level][next_vtsn];
/*
* parental control available Search until the last PGC in the block
*/
i = *pgci_num;
do
{
pgc_ptl_id = ((vtsm_pgci_srp[lang_index][i].vts_pgc_cat[2] << 8) |
vtsm_pgci_srp[lang_index][i].vts_pgc_cat[3]);
if (ptl_id & pgc_ptl_id)
{
break;
}
if (++i == vtsm_lui[lang_index].vtsm_pgci_srp_n)
{
i = 0;
break;
}
} while ((vtsm_pgci_srp[lang_index][i].vts_pgc_cat[1] & 0xc0) != 0xc0);
*pgci_num = i;
}
else
{
ptl_id = ptl_lvli[country_index][level][next_vtsn];
pgc_ptl_id = ((vtsm_pgci_srp[lang_index][*pgci_num].vts_pgc_cat[2] << 8) |
vtsm_pgci_srp[lang_index][*pgci_num].vts_pgc_cat[3]);
if (!(ptl_id & pgc_ptl_id))
{
/* Output warning OSD if level is not high enough */
parental_prohibit = 2;
(*pgci_num)++; /* make it one based */
return (9);
}
}
}
break;
case TT_PGC:
if ( (vmgi_mat.ptl_mait_sa) && (get_sprm(SPRM_PTL_LVL) != PARENTAL_OFF) )
{
if ((ptl_mai_srp[0].cty_cd[0] == 'Z') && (ptl_mai_srp[0].cty_cd[1] == 'Z'))
{
country_index = 0;
}
else
{
for (i = 0; i < ptl_maiti.cty_n; i++)
{
if (compare_code(ptl_mai_srp[i].cty_cd[0], ptl_mai_srp[i].cty_cd[1], get_sprm(12)))
{
break;
}
}
country_index = i;
if (i == ptl_maiti.cty_n)
{
country_index = 0;
}
}
/* get parental level from SPRM */
level = get_sprm(SPRM_PTL_LVL) - 1;
if (vts_pgci_srp[*pgci_num].vts_pgc_cat[1] & 0x30)
{
ptl_id = ptl_lvli[country_index][level][next_vtsn];
/*
* parental control available Search until the last PGC in the block
*/
i = *pgci_num;
do
{
pgc_ptl_id = ((vts_pgci_srp[i].vts_pgc_cat[2] << 8) |
vts_pgci_srp[i].vts_pgc_cat[3]);
if (ptl_id & pgc_ptl_id)
{
break;
}
if (++i == vts_pgciti.vts_pgci_srp_n)
{
i = 0;
break;
}
} while ((vts_pgci_srp[i].vts_pgc_cat[1] & 0xc0) != 0xc0);
*pgci_num = i;
}
else
{
ptl_id = ptl_lvli[country_index][level][next_vtsn];
pgc_ptl_id = ((vts_pgci_srp[*pgci_num].vts_pgc_cat[2] << 8) |
vts_pgci_srp[*pgci_num].vts_pgc_cat[3]);
if (!(ptl_id & pgc_ptl_id))
{
/* Output warning OSD if level is not high enough */
parental_prohibit = 3;
(*pgci_num)++; /* make it one based */
return (9);
}
}
}
break;
}
(*pgci_num)++; /* make it one based */
return (0);
}
/**
* parse_pgci
* Parses specific Program Chain Information
*
* @param pgci_num - PGCI number
*
* @return 0 Success, non-zero Failure
*/
UBYTE parse_pgci(USHORT * pgci_num)
{
ULONG start_address = 0; /* Start address of the pgci info */
ULONG sector_address;
BOOLEAN same_pgci = FALSE; /* same sector */
USHORT times;
UBYTE ret = 0;
ULONG out_msg[4]; /* outgoing message */
#ifdef DEBUG_DVD_PGCI
DbgPrint(("parse_pgci()\n"));
#endif
if (get_sprm(SPRM_PTL_LVL) != PARENTAL_OFF)
{
ret = check_parental(pgci_num);
if (0 != ret)
{
#ifdef DEBUG_DVD_PGCI
DbgPrint(("parse_pgci() -- (check_parental != 0)\n"));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -