📄 dvd_vtsi.c
字号:
#endif
USHORT tmp_vtsm_lu_n;
DBGPRINT(DBG_ON(DBG_TRACE), ("Parse_VTSM_PGCI_UT: ENTER\n"));
offset = vtsm_pgci_ut;
/* Parse the vtsm_pgci_uti */
/* store the number of Video Title Set Menu Language Units */
store((UBYTE *) & vtsm_pgci_uti.vtsm_lu_n, offset, 2, STORE_LITTLE_ENDIAN);
/* back up the real number for calculating the next tables offset */
tmp_vtsm_lu_n = vtsm_pgci_uti.vtsm_lu_n;
/* we are clamping the number of languages at MAX_NUM_LANG */
if (vtsm_pgci_uti.vtsm_lu_n > MAX_NUM_LANG)
{
DbgPrint(("Parse_VTSM_PGCI_UT: vtsm_lu_n=%d, clamping to MAX_NUM_LANG!!!!\n", vtsm_pgci_uti.vtsm_lu_n));
vtsm_pgci_uti.vtsm_lu_n = MAX_NUM_LANG;
}
/* store the end address of VTSM_PGCI_UT */
store((UBYTE *) & vtsm_pgci_uti.vtsm_pgci_ut_ea, (offset + 4), 4, STORE_LITTLE_ENDIAN);
offset += 8; /* move past the vtsm_pgci_uti */
/* store the vtsm_lu_srp data */
for (index = 0; index < vtsm_pgci_uti.vtsm_lu_n; index++)
{
/* store the Video Title Set Menu Lannguage Code */
store((UBYTE *) & vtsm_lu_srp[index].vtsm_lcd[0], (offset), 2, STORE_BIG_ENDIAN);
/* store the Video Title Set Menu existence */
store((UBYTE *) & vtsm_lu_srp[index].vtsm_exst, (offset + 3), 1, STORE_LITTLE_ENDIAN);
/* store the start address of VTSM_LU */
store((UBYTE *) & vtsm_lu_srp[index].vtsm_lu_sa, (offset + 4), 4, STORE_LITTLE_ENDIAN);
offset += 8;
}
/* store the vtsm_lu data */
offset = vtsm_pgci_ut + 8 + (tmp_vtsm_lu_n * 8);
for (index = 0; index < vtsm_pgci_uti.vtsm_lu_n; index++)
{
offset = vtsm_pgci_ut + vtsm_lu_srp[index].vtsm_lu_sa;
/* store the vtsm_lui structure */
/* store the number of VTSM_PGCI_SRP s */
store((UBYTE *) & vtsm_lui[index].vtsm_pgci_srp_n, offset, 2, STORE_LITTLE_ENDIAN);
/* store the end address of VTSM_LU */
store((UBYTE *) & vtsm_lui[index].vtsm_lu_ea, (offset + 4), 4, STORE_LITTLE_ENDIAN);
offset += 8;
#ifdef FIXED_PGC
/* store the VTSM_PGCI_SRP for the language unit */
for (index2 = 0; (index2 < vtsm_lui[index].vtsm_pgci_srp_n) && (index2 < MAX_VTSM_PGCI_SRP_j); index2++)
#else
/* Prepare a boundary size protection to prevent writing
* past the vtsm_pgci_srp_buf buffer */
vtsm_pgci_srp[index] = (vts_pgci_srp_struct *) vtsm_pgci_srp_ptr;
ERROR_CHECK(((ULONG) vtsm_pgci_srp_ptr - (ULONG) vtsm_pgci_srp_buf + (ULONG) vtsm_lui[index].vtsm_pgci_srp_n),
sizeof(vts_pgci_srp_struct)*MAX_VTSM_PGCI_BUF, "MAX_VTSM_PGCI_BUF");
for (index2 = 0; (index2 < vtsm_lui[index].vtsm_pgci_srp_n) &&
( (ULONG)&vtsm_pgci_srp[index][index2+1] < (ULONG)vtsm_pgci_buf_end_adr); index2++)
#endif
{
/* store the VTS_PGC Category information */
store((UBYTE *) &vtsm_pgci_srp[index][index2].vts_pgc_cat[0], offset, 4, STORE_BIG_ENDIAN);
/* store the Start Address of the VTS_PGCI */
store((UBYTE *) & vtsm_pgci_srp[index][index2].vts_pgci_sa, (offset + 4), 4, STORE_LITTLE_ENDIAN);
offset += 8;
}
#ifdef FIXED_PGC
ERROR_CHECK(index2, MAX_VTSM_PGCI_SRP_j, "MAX_VTSM_PGCI_SRP_j");
#else
vtsm_pgci_srp_ptr += index2;
#endif
}
ERROR_CHECK(index, MAX_VTSM_PGCI_SRP_i, "MAX_VTSM_PGCI_SRP_i");
}
/**
** Name: Parse_VTS_TMAPT
**
** Description: Parses the Video Title Set Time Map Table (VTS_TMAPT)
** DVD Part 3:Video Spec Version 1.0 section 4.2.5
**
** Arguments: vts_tmapt_sa start address of VTS_TMAPT
**
** Returns: Fills in structures
**
** Structures: vts_tmapti
** VTS_TMAP_SRP
**
**/
void Parse_VTS_TMAPT(ULONG vts_tmapt_sa)
{
ULONG tmap_index = 0;
ULONG offset = vts_tmapt_sa;
/* Parse the vts_tmapti */
/* store the number of VTS_TMAPs */
store((UBYTE *) & vts_tmapti.vts_tmap_n, offset, 2, STORE_LITTLE_ENDIAN);
/* store the end address of VTS_TMAPT */
store((UBYTE *) & vts_tmapti.vts_tmapt_ea, (offset + 4), 4, STORE_LITTLE_ENDIAN);
/* Move past the vts_tmapti */
offset += 8;
/* store the VTS_TMAP_SRP */
for (tmap_index = 0; tmap_index < vts_tmapti.vts_tmap_n; tmap_index++)
{
/* store the VTS_TMAP_SA */
store((UBYTE *) & vts_tmap_srp[tmap_index], offset, 4, STORE_LITTLE_ENDIAN);
offset += 4;
}
/* store the VTS_TMAP entries */
for (tmap_index = 0; (tmap_index < vts_tmapti.vts_tmap_n) && (tmap_index < MAX_NUM_TMAP); tmap_index++)
{
/* Set the offset to the starting address for the current index number */
offset = vts_tmap_srp[tmap_index] + vts_tmapt_sa;
/* store the Time Unit (seconds) */
store((UBYTE *) & vts_tmap[tmap_index].tmu, offset, 1, STORE_LITTLE_ENDIAN);
/* store the Number of Map entries MAP_EN_Ns */
store((UBYTE *) & vts_tmap[tmap_index].map_en_n, (offset + 2), 2, STORE_LITTLE_ENDIAN);
}
ERROR_CHECK(tmap_index, MAX_NUM_TMAP, "\nMAX_NUM_TMAP\n");
}
/**
** Name: Parse_VTSM_C_ADT
**
** Description: Parses the Video Title Set Menu Cell Address Table (VTSM_C_ADT)
** DVD Part 3:Video Spec Version 1.0 section 4.2.6
**
** Arguments: vtsm_c_adt_sa start address of VTSM_C_ADT
**
** Returns: Fills in structures
**
** Structures: vtsm_c_adti
** vtsm_cpi
**
**/
#ifdef NOT_USED
void Parse_VTSM_C_ADT(ULONG vtsm_c_adt_sa)
{
ULONG index = 0;
ULONG offset = 0;
offset = vtsm_c_adt_sa;
/* Parse the vtsm_c_adti */
/* store the number of VTSM_VOB_N */
store((UBYTE *) & vtsm_c_adti.vtsm_vob_n, offset, 2, STORE_LITTLE_ENDIAN);
/* store the end address of VTSM_C_ADT */
store((UBYTE *) & vtsm_c_adti.vtsm_c_adt_ea, (offset + 4), 4, STORE_LITTLE_ENDIAN);
offset += 8; /* move past the vtsm_c_adti */
/* store the vtsm_cpi */
for (index = 0; (index < vtsm_c_adti.vtsm_vob_n) && (index < MAX_VTSM_CPI); index++)
{
/* store the vtsm_cpi */
/* store the VTSM_VOB_IDN */
store((UBYTE *) & vtsm_cpi[index].vtsm_vob_idn, offset, 2, STORE_LITTLE_ENDIAN);
/* store the VTSM_C_IDN */
store((UBYTE *) & vtsm_cpi[index].vtsm_c_idn, (offset + 2), 1, STORE_LITTLE_ENDIAN);
/* store the VTSM_CP_SA */
store((UBYTE *) & vtsm_cpi[index].vtsm_cp_sa, (offset + 4), 4, STORE_LITTLE_ENDIAN);
/* store the VTSM_CP_EA */
store((UBYTE *) & vtsm_cpi[index].vtsm_cp_ea, (offset + 8), 4, STORE_LITTLE_ENDIAN);
offset += 12;
}
ERROR_CHECK(index, MAX_VTSM_CPI, "MAX_VTSM_CPI");
}
#endif
/**
** Name: Parse_VTSM_VOBU_ADMAP
**
** Description: Parses the Video Title Set Menu Object Unit Address Map (VTSM_VOBU_ADMAP)
** DVD Part 3:Video Spec Version 1.0 section 4.2.7
**
** Arguments: vtsm_vobu_admap_sa start address of VTSM_VOUBU_ADMAP
**
** Returns: Fills in VTSM_VOBU_ADMAPI information
**
** Structures: VTSM_VOBU_ADMAP_EA
** VTSM_VOBU-SA
**
**/
#ifdef NOT_USED
void Parse_VTSM_VOBU_ADMAP(ULONG vtsm_vobu_admap_sa)
{
ULONG index = 0;
ULONG offset = 0;
offset = vtsm_vobu_admap_sa;
/* Parse the VSTM_VOBU_ADMAPI */
/* The only thing here is the VTSM_VOBU_ADMAP_EA (End address) */
store((UBYTE *) & vtsm_vobu_admap_ea, offset, 4, STORE_LITTLE_ENDIAN);
offset += 4; /* move past the VSTM_VOBU_ADMAPI */
/* store the Start Adress of VTSM_VOBU for VOBU #n */
for (index = 0; (index < vtsm_c_adti.vtsm_vob_n) && (index < MAX_VTSM_VOBU_SA); index++)
{
/* store the VTSM_VOBU_SA for VOBU #index */
store((UBYTE *) & vtsm_vobu_sa[index], offset, 4, STORE_LITTLE_ENDIAN);
offset += 4;
}
ERROR_CHECK(index, MAX_VTSM_VOBU_SA, "MAX_VTSM_VOBU_SA");
}
#endif
/**
** Name: Parse_VTS_C_ADT
**
** Description: Parses the Video Title Set Cell Address Table
** (VTS_C_ADT)
** DVD Part 3:Video Spec Version 1.0 section 4.2.8
**
** Arguments: vts_c_adt_sa start address of VTS_C_ADT
**
** Returns: Fills in structures
**
** Structures: VTS_C_ADTI
** vts_cpi
**
**
* Pseudocode:
*
**/
void Parse_VTS_C_ADT(ULONG vts_c_adt_sa)
{
ULONG index = 0;
ULONG offset = 0;
ULONG Relative_Address;
offset = vts_c_adt_sa;
/* Parse the VTSM_VOBU_ADMAPI */
/* store the VTS_VOB_N Number of VOBs in the VTSTT_VOBS */
store((UBYTE *) & vts_c_adti.vts_vob_n, offset, 2, STORE_LITTLE_ENDIAN);
/* store the VTS_C_ADT_EA End address of the VTS_C_ADT */
store((UBYTE *) & vts_c_adti.vts_c_adt_ea, (offset + 4), 4, STORE_LITTLE_ENDIAN);
offset += 8; /* move past the VTS_C_ADTI */
Relative_Address = offset;
index = 0;
/* store the vts_cpi */
while ( (Relative_Address <= vts_c_adti.vts_c_adt_ea) && (index < MAX_VTS_CPI) )
{
/* store the vts_cpi */
/* store the VTS_VOB_IDN */
offset = store((UBYTE *) & vts_cpi[index].vts_vob_idn, offset, 2, STORE_LITTLE_ENDIAN);
offset += 2;
DBGPRINT(DBG_ON(DBG_VERBOSE), ("\n\nParse_VTS_C_ADT() vts_cpi[%i].vts_vob_idn: %u\n", index, vts_cpi[index].vts_vob_idn));
/* store the VTS_C_IDN */
offset = store((UBYTE *) & vts_cpi[index].vts_c_idn, offset, 1, STORE_LITTLE_ENDIAN);
offset += 2;
DBGPRINT(DBG_ON(DBG_VERBOSE), ("Parse_VTS_C_ADT() vts_cpi[%i].vts_c_idn: %u\n", index, vts_cpi[index].vts_c_idn));
/* store the VTS_CP_SA */
offset = store((UBYTE *) & vts_cpi[index].vts_cp_sa, offset, 4, STORE_LITTLE_ENDIAN);
offset += 4;
/* store the VTS_CP_EA */
offset = store((UBYTE *) & vts_cpi[index].vts_cp_ea, offset, 4, STORE_LITTLE_ENDIAN);
offset += 4;
Relative_Address += 12;
index++;
}
ERROR_CHECK(index, MAX_VTS_CPI, "MAX_VTS_CPI");
}
/**
** Name: Parse_VTS_VOBU_ADMAP
**
** Description: Parses the Video Title Set Object Unit Address Map
** (VTS_VOBU_ADMAP)
** DVD Part 3:Video Spec Version 1.0 section 4.2.9
**
** Arguments: vts_vobu_admap_sa start address of vts_vobu_admap_sa
**
** Returns: Fills in VTS_VOBU_ADMAPI information
**
** Structures: VTS_VOBU_SA
**
* Pseudocode:
*
**/
void Parse_VTS_VOBU_ADMAP(ULONG vts_vobu_admap_sa)
{
ULONG index = 0;
ULONG offset = 0;
ULONG Relative_Address;
offset = vts_vobu_admap_sa;
/* Parse the VST_VOBU_ADMAPI */
/* The only thing here is the VTS_VOBU_ADMAP_EA (End address) */
offset = store((UBYTE *)&vts_vobu_admap_ea, offset, 4, STORE_LITTLE_ENDIAN);
offset += 4; /* move past the VST_VOBU_ADMAPI */
Relative_Address = offset;
/* store the Start Adress of VTS_VOBU for VOBU #n */
index = 0;
while ( (Relative_Address <= vts_vobu_admap_ea) && (index < VTS_VOBU_SIZE) )
{
/* store the VTS_VOBU_SA for VOBU #index */
offset = store((UBYTE *) & vts_vobu_sa[index], offset, 4, STORE_LITTLE_ENDIAN);
offset += 4;
Relative_Address += 4;
index++;
}
vts_vobu_ad_size = index - 1;
DBGPRINT(DBG_ON(DBG_VERBOSE), ("\nParse_VTS_VOBU_ADMAP() vts_vobu_sa[0]: %x\n", vts_vobu_sa[10]));
DBGPRINT(DBG_ON(DBG_VERBOSE), ("Parse_VTS_VOBU_ADMAP() vts_vobu_sa[vts_vobu_ad_size]: %x\n", vts_vobu_sa[vts_vobu_ad_size]));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -