From f85adda24c667060d1edf33b8687b1f24765f5e1 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Thu, 12 Jan 2023 23:38:09 -0800 Subject: [PATCH] Add some DVD models --- .../DVD/AudioSubPictureAttributesTable.cs | 31 ++++ .../AudioSubPictureAttributesTableEntry.cs | 23 +++ BurnOutSharp.Models/DVD/CellAddressTable.cs | 26 +++ .../DVD/CellAddressTableEntry.cs | 31 ++++ BurnOutSharp.Models/DVD/Constants.cs | 9 + BurnOutSharp.Models/DVD/Enums.cs | 56 ++++++ BurnOutSharp.Models/DVD/LanguageUnitTable.cs | 32 ++++ .../DVD/LanguageUnitTableEntry.cs | 26 +++ .../DVD/ParentalManagementMasksTable.cs | 37 ++++ .../DVD/ParentalManagementMasksTableEntry.cs | 21 +++ BurnOutSharp.Models/DVD/ProgramChainTable.cs | 27 +++ .../DVD/ProgramChainTableEntry.cs | 26 +++ BurnOutSharp.Models/DVD/TitlesTable.cs | 26 +++ BurnOutSharp.Models/DVD/TitlesTableEntry.cs | 42 +++++ BurnOutSharp.Models/DVD/VOBUAddressMap.cs | 16 ++ BurnOutSharp.Models/DVD/VideoManagerIFO.cs | 150 ++++++++++++++++ BurnOutSharp.Models/DVD/VideoTitleSetIFO.cs | 160 ++++++++++++++++++ 17 files changed, 739 insertions(+) create mode 100644 BurnOutSharp.Models/DVD/AudioSubPictureAttributesTable.cs create mode 100644 BurnOutSharp.Models/DVD/AudioSubPictureAttributesTableEntry.cs create mode 100644 BurnOutSharp.Models/DVD/CellAddressTable.cs create mode 100644 BurnOutSharp.Models/DVD/CellAddressTableEntry.cs create mode 100644 BurnOutSharp.Models/DVD/Constants.cs create mode 100644 BurnOutSharp.Models/DVD/Enums.cs create mode 100644 BurnOutSharp.Models/DVD/LanguageUnitTable.cs create mode 100644 BurnOutSharp.Models/DVD/LanguageUnitTableEntry.cs create mode 100644 BurnOutSharp.Models/DVD/ParentalManagementMasksTable.cs create mode 100644 BurnOutSharp.Models/DVD/ParentalManagementMasksTableEntry.cs create mode 100644 BurnOutSharp.Models/DVD/ProgramChainTable.cs create mode 100644 BurnOutSharp.Models/DVD/ProgramChainTableEntry.cs create mode 100644 BurnOutSharp.Models/DVD/TitlesTable.cs create mode 100644 BurnOutSharp.Models/DVD/TitlesTableEntry.cs create mode 100644 BurnOutSharp.Models/DVD/VOBUAddressMap.cs create mode 100644 BurnOutSharp.Models/DVD/VideoManagerIFO.cs create mode 100644 BurnOutSharp.Models/DVD/VideoTitleSetIFO.cs diff --git a/BurnOutSharp.Models/DVD/AudioSubPictureAttributesTable.cs b/BurnOutSharp.Models/DVD/AudioSubPictureAttributesTable.cs new file mode 100644 index 00000000..175b0b1d --- /dev/null +++ b/BurnOutSharp.Models/DVD/AudioSubPictureAttributesTable.cs @@ -0,0 +1,31 @@ +namespace BurnOutSharp.Models.DVD +{ + /// + public sealed class AudioSubPictureAttributesTable + { + /// + /// Number of title sets + /// + public ushort NumberOfTitleSets; + + /// + /// Reserved + /// + public byte[] Reserved; + + /// + /// End address (last byte of last VTS_ATRT) + /// + public uint EndAddress; + + /// + /// Offset to VTS_ATRT n + /// + public uint[] Offsets; + + /// + /// Entries + /// + public AudioSubPictureAttributesTableEntry[] Entries; + } +} \ No newline at end of file diff --git a/BurnOutSharp.Models/DVD/AudioSubPictureAttributesTableEntry.cs b/BurnOutSharp.Models/DVD/AudioSubPictureAttributesTableEntry.cs new file mode 100644 index 00000000..f468b4c5 --- /dev/null +++ b/BurnOutSharp.Models/DVD/AudioSubPictureAttributesTableEntry.cs @@ -0,0 +1,23 @@ +namespace BurnOutSharp.Models.DVD +{ + /// + public sealed class AudioSubPictureAttributesTableEntry + { + /// + /// End address (EA) + /// + public uint EndAddress; + + /// + /// VTS_CAT (copy of offset 022-025 of the VTS IFO file) + /// 0=unspecified, 1=Karaoke + /// + public uint Category; + + /// + /// Copy of VTS attributes (offset 100 and on from the VTS IFO + /// file, usually 0x300 bytes long) + /// + public byte[] AttributesCopy; + } +} \ No newline at end of file diff --git a/BurnOutSharp.Models/DVD/CellAddressTable.cs b/BurnOutSharp.Models/DVD/CellAddressTable.cs new file mode 100644 index 00000000..f86ab01e --- /dev/null +++ b/BurnOutSharp.Models/DVD/CellAddressTable.cs @@ -0,0 +1,26 @@ +namespace BurnOutSharp.Models.DVD +{ + /// + public sealed class CellAddressTable + { + /// + /// Number of VOB IDs + /// + public ushort NumberOfVOBIDs; + + /// + /// Reserved + /// + public byte[] Reserved; + + /// + /// End address (last byte of last entry) + /// + public uint EndAddress; + + /// + /// 12-byte entries + /// + public CellAddressTableEntry[] Entries; + } +} \ No newline at end of file diff --git a/BurnOutSharp.Models/DVD/CellAddressTableEntry.cs b/BurnOutSharp.Models/DVD/CellAddressTableEntry.cs new file mode 100644 index 00000000..f1921364 --- /dev/null +++ b/BurnOutSharp.Models/DVD/CellAddressTableEntry.cs @@ -0,0 +1,31 @@ +namespace BurnOutSharp.Models.DVD +{ + /// + public sealed class CellAddressTableEntry + { + /// + /// VOBidn + /// + public ushort VOBIdentity; + + /// + /// CELLidn + /// + public byte CellIdentity; + + /// + /// Reserved + /// + public byte Reserved; + + /// + /// Starting sector within VOB + /// + public uint StartingSectorWithinVOB; + + /// + /// Ending sector within VOB + /// + public uint EndingSectorWithinVOB; + } +} \ No newline at end of file diff --git a/BurnOutSharp.Models/DVD/Constants.cs b/BurnOutSharp.Models/DVD/Constants.cs new file mode 100644 index 00000000..917f3d75 --- /dev/null +++ b/BurnOutSharp.Models/DVD/Constants.cs @@ -0,0 +1,9 @@ +namespace BurnOutSharp.Models.DVD +{ + public static class Constants + { + public const string VideoManagerIFOSignature = "DVDVIDEO-VMG"; + + public const string VideoTitleSetIFOSignature = "DVDVIDEO-VTS"; + } +} \ No newline at end of file diff --git a/BurnOutSharp.Models/DVD/Enums.cs b/BurnOutSharp.Models/DVD/Enums.cs new file mode 100644 index 00000000..dfc77e31 --- /dev/null +++ b/BurnOutSharp.Models/DVD/Enums.cs @@ -0,0 +1,56 @@ +using System; + +namespace BurnOutSharp.Models.DVD +{ + [Flags] + public enum ProgramChainCategory : byte + { + MenuTypeTitle = 0x02, + Entry = 0x80, + } + + [Flags] + public enum TitleType : byte + { + /// + /// Uop0 Time play or search + /// + Uop0TimePlayOrSearch = 0x01, + + /// + /// Uop1 PTT play or search + /// + Uop1PTTPlayOrSearch = 0x02, + + /// + /// Jump/Link/Call commands - exist + /// + JumpLinkCallExist = 0x04, + + /// + /// Jump/Link/Call commands - button + /// + JumpLinkCallButton = 0x08, + + /// + /// Jump/Link/Call commands - pre/post + /// + JumpLinkCallPrePost = 0x10, + + /// + /// Jump/Link/Call commands - cell + /// + JumpLinkCallCell = 0x20, + + /// + /// 0=one_sequential_pgc + /// 1=not one_sequential (random, shuffle, stills, loops, or more than one pgc) + /// + ComplexPGC = 0x40, + + /// + /// Reserved + /// + Reserved = 0x80, + } +} \ No newline at end of file diff --git a/BurnOutSharp.Models/DVD/LanguageUnitTable.cs b/BurnOutSharp.Models/DVD/LanguageUnitTable.cs new file mode 100644 index 00000000..498ca4e4 --- /dev/null +++ b/BurnOutSharp.Models/DVD/LanguageUnitTable.cs @@ -0,0 +1,32 @@ +namespace BurnOutSharp.Models.DVD +{ + /// + public sealed class LanguageUnitTable + { + /// + /// Number of Language Units + /// + public ushort NumberOfLanguageUnits; + + /// + /// Reserved + /// + public byte[] Reserved; + + /// + /// End address (last byte of last PGC in last LU) + /// relative to VMGM_PGCI_UT + /// + public uint EndAddress; + + /// + /// Language Units + /// + public LanguageUnitTableEntry[] Entries; + + /// + /// Program Chains + /// + public ProgramChainTable[] ProgramChains; + } +} \ No newline at end of file diff --git a/BurnOutSharp.Models/DVD/LanguageUnitTableEntry.cs b/BurnOutSharp.Models/DVD/LanguageUnitTableEntry.cs new file mode 100644 index 00000000..948c27e5 --- /dev/null +++ b/BurnOutSharp.Models/DVD/LanguageUnitTableEntry.cs @@ -0,0 +1,26 @@ +namespace BurnOutSharp.Models.DVD +{ + /// + public sealed class LanguageUnitTableEntry + { + /// + /// ISO639 language code + /// + public ushort ISO639LanguageCode; + + /// + /// Reserved for language code extension + /// + public byte Reserved; + + /// + /// Menu existence flag [80 = title] + /// + public byte MenuExistenceFlag; + + /// + /// Offset to VMGM_LU, relative to VMGM_PGCI_UT + /// + public uint LanguageUnitOffset; + } +} \ No newline at end of file diff --git a/BurnOutSharp.Models/DVD/ParentalManagementMasksTable.cs b/BurnOutSharp.Models/DVD/ParentalManagementMasksTable.cs new file mode 100644 index 00000000..9cd6942f --- /dev/null +++ b/BurnOutSharp.Models/DVD/ParentalManagementMasksTable.cs @@ -0,0 +1,37 @@ +namespace BurnOutSharp.Models.DVD +{ + /// + /// The VMG_PTL_MAIT is searched by country, and points to + /// the table for each country. + /// + /// + public sealed class ParentalManagementMasksTable + { + /// + /// Number of countries + /// + public ushort NumberOfCountries; + + /// + /// Number of title sets (NTs) + /// + public ushort NumberOfTitleSets; + + /// + /// End address (last byte of last PTL_MAIT) + /// + public uint EndAddress; + + /// + /// Entries + /// + public ParentalManagementMasksTableEntry[] Entries; + + /// + /// The PTL_MAIT contains the 16-bit masks for the VMG and + /// all title sets for parental management level 8 followed + /// by the masks for level 7, and so on to level 1. + /// + public byte[][] BitMasks; + } +} \ No newline at end of file diff --git a/BurnOutSharp.Models/DVD/ParentalManagementMasksTableEntry.cs b/BurnOutSharp.Models/DVD/ParentalManagementMasksTableEntry.cs new file mode 100644 index 00000000..49d4e9d6 --- /dev/null +++ b/BurnOutSharp.Models/DVD/ParentalManagementMasksTableEntry.cs @@ -0,0 +1,21 @@ +namespace BurnOutSharp.Models.DVD +{ + /// + public sealed class ParentalManagementMasksTableEntry + { + /// + /// Country code + /// + public ushort CountryCode; + + /// + /// Reserved + /// + public byte[] Reserved; + + /// + /// Offset to PTL_MAIT + /// + public uint Offset; + } +} \ No newline at end of file diff --git a/BurnOutSharp.Models/DVD/ProgramChainTable.cs b/BurnOutSharp.Models/DVD/ProgramChainTable.cs new file mode 100644 index 00000000..be02d62f --- /dev/null +++ b/BurnOutSharp.Models/DVD/ProgramChainTable.cs @@ -0,0 +1,27 @@ +namespace BurnOutSharp.Models.DVD +{ + /// + public sealed class ProgramChainTable + { + /// + /// Number of Program Chains + /// + public ushort NumberOfProgramChains; + + /// + /// Reserved + /// + public byte[] Reserved; + + /// + /// End address (last byte of last PGC in this LU) + /// relative to VMGM_LU + /// + public uint EndAddress; + + /// + /// Program Chains + /// + public ProgramChainTableEntry[] Entries; + } +} \ No newline at end of file diff --git a/BurnOutSharp.Models/DVD/ProgramChainTableEntry.cs b/BurnOutSharp.Models/DVD/ProgramChainTableEntry.cs new file mode 100644 index 00000000..0602e180 --- /dev/null +++ b/BurnOutSharp.Models/DVD/ProgramChainTableEntry.cs @@ -0,0 +1,26 @@ +namespace BurnOutSharp.Models.DVD +{ + /// + public sealed class ProgramChainTableEntry + { + /// + /// PGC category + /// + public ProgramChainCategory Category; + + /// + /// Unknown + /// + public byte Unknown; + + /// + /// Parental management mask + /// + public ushort ParentalManagementMask; + + /// + /// Offset to VMGM_PGC, relative to VMGM_LU + /// + public uint Offset; + } +} \ No newline at end of file diff --git a/BurnOutSharp.Models/DVD/TitlesTable.cs b/BurnOutSharp.Models/DVD/TitlesTable.cs new file mode 100644 index 00000000..299b6230 --- /dev/null +++ b/BurnOutSharp.Models/DVD/TitlesTable.cs @@ -0,0 +1,26 @@ +namespace BurnOutSharp.Models.DVD +{ + /// + public sealed class TitlesTable + { + /// + /// Number of titles + /// + public ushort NumberOfTitles; + + /// + /// Reserved + /// + public byte[] Reserved; + + /// + /// End address (last byte of last entry) + /// + public uint EndAddress; + + /// + /// 12-byte entries + /// + public TitlesTableEntry[] Entries; + } +} \ No newline at end of file diff --git a/BurnOutSharp.Models/DVD/TitlesTableEntry.cs b/BurnOutSharp.Models/DVD/TitlesTableEntry.cs new file mode 100644 index 00000000..e56bf79a --- /dev/null +++ b/BurnOutSharp.Models/DVD/TitlesTableEntry.cs @@ -0,0 +1,42 @@ +namespace BurnOutSharp.Models.DVD +{ + /// + public sealed class TitlesTableEntry + { + /// + /// Title type + /// + public TitleType TitleType; + + /// + /// Number of angles + /// + public byte NumberOfAngles; + + /// + /// Number of chapters (PTTs) + /// + public ushort NumberOfChapters; + + /// + /// Parental management mask + /// + public ushort ParentalManagementMask; + + /// + /// Video Title Set number (VTSN) + /// + public byte VideoTitleSetNumber; + + /// + /// Title number within VTS (VTS_TTN) + /// + public byte TitleNumberWithinVTS; + + /// + /// Start sector for VTS, referenced to whole disk + /// (video_ts.ifo starts at sector 00000000) + /// + public uint VTSStartSector; + } +} \ No newline at end of file diff --git a/BurnOutSharp.Models/DVD/VOBUAddressMap.cs b/BurnOutSharp.Models/DVD/VOBUAddressMap.cs new file mode 100644 index 00000000..381d8e42 --- /dev/null +++ b/BurnOutSharp.Models/DVD/VOBUAddressMap.cs @@ -0,0 +1,16 @@ +namespace BurnOutSharp.Models.DVD +{ + /// + public sealed class VOBUAddressMap + { + /// + /// End address (last byte of last entry) + /// + public uint EndAddress; + + /// + /// Starting sector within VOB of nth VOBU + /// + public uint[] StartingSectors; + } +} \ No newline at end of file diff --git a/BurnOutSharp.Models/DVD/VideoManagerIFO.cs b/BurnOutSharp.Models/DVD/VideoManagerIFO.cs new file mode 100644 index 00000000..8b660c54 --- /dev/null +++ b/BurnOutSharp.Models/DVD/VideoManagerIFO.cs @@ -0,0 +1,150 @@ +namespace BurnOutSharp.Models.DVD +{ + /// + public sealed class VideoManagerIFO + { + /// + /// "DVDVIDEO-VMG" + /// + public string Signature; + + /// + /// Last sector of VMG set (last sector of BUP) + /// + public uint LastVMGSetSector; + + /// + /// Last sector of IFO + /// + public uint LastIFOSector; + + /// + /// Version number + /// - Byte 0 - Reserved, should be 0 + /// - Byte 1, Bits 7-4 - Major version number + /// - Byte 1, Bits 3-0 - Minor version number + /// + public ushort VersionNumber; + + /// + /// VMG category + /// + /// byte1=prohibited region mask + public uint VMGCategory; + + /// + /// Number of volumes + /// + public ushort NumberOfVolumes; + + /// + /// Volume number + /// + public ushort VolumeNumber; + + /// + /// Side ID + /// + public byte SideID; + + /// + /// Number of title sets + /// + public ushort NumberOfTitleSets; + + /// + /// Provider ID + /// + public byte[] ProviderID; + + /// + /// VMG POS + /// + public ulong VMGPOS; + + /// + /// End byte address of VMGI_MAT + /// + public uint InformationManagementTableEndByteAddress; + + /// + /// Start address of FP_PGC (First Play program chain) + /// + public uint FirstPlayProgramChainStartAddress; + + /// + /// Start sector of Menu VOB + /// + public uint MenuVOBStartSector; + + /// + /// Sector pointer to TT_SRPT (table of titles) + /// + public uint TableOfTitlesSectorPointer; + + /// + /// Sector pointer to VMGM_PGCI_UT (Menu Program Chain table) + /// + public uint MenuProgramChainTableSectorPointer; + + /// + /// Sector pointer to VMG_PTL_MAIT (Parental Management masks) + /// + public uint ParentalManagementMasksSectorPointer; + + /// + /// Sector pointer to VMG_VTS_ATRT (copies of VTS audio/sub-picture attributes) + /// + public uint AudioSubPictureAttributesSectorPointer; + + /// + /// Sector pointer to VMG_TXTDT_MG (text data) + /// + public uint TextDataSectorPointer; + + /// + /// Sector pointer to VMGM_C_ADT (menu cell address table) + /// + public uint MenuCellAddressTableSectorPointer; + + /// + /// Sector pointer to VMGM_VOBU_ADMAP (menu VOBU address map) + /// + public uint MenuVOBUAddressMapSectorPointer; + + /// + /// Video attributes of VMGM_VOBS + /// + public byte[] VideoAttributes; + + /// + /// Number of audio streams in VMGM_VOBS + /// + public ushort NumberOfAudioStreams; + + /// + /// Audio attributes of VMGM_VOBS + /// + public byte[][] AudioAttributes; + + /// + /// Unknown + /// + public byte[] Unknown; + + /// + /// Number of subpicture streams in VMGM_VOBS (0 or 1) + /// + public ushort NumberOfSubpictureStreams; + + /// + /// Subpicture attributes of VMGM_VOBS + /// + public byte[] SubpictureAttributes; + + /// + /// Reserved + /// + public byte[] Reserved; + } +} \ No newline at end of file diff --git a/BurnOutSharp.Models/DVD/VideoTitleSetIFO.cs b/BurnOutSharp.Models/DVD/VideoTitleSetIFO.cs new file mode 100644 index 00000000..591546f7 --- /dev/null +++ b/BurnOutSharp.Models/DVD/VideoTitleSetIFO.cs @@ -0,0 +1,160 @@ +namespace BurnOutSharp.Models.DVD +{ + /// + public sealed class VideoTitleSetIFO + { + /// + /// "DVDVIDEO-VTS" + /// + public string Signature; + + /// + /// Last sector of title set (last sector of BUP) + /// + public uint LastTitleSetSector; + + /// + /// Last sector of IFO + /// + public uint LastIFOSector; + + /// + /// Version number + /// - Byte 0 - Reserved, should be 0 + /// - Byte 1, Bits 7-4 - Major version number + /// - Byte 1, Bits 3-0 - Minor version number + /// + public ushort VersionNumber; + + /// + /// VTS category + /// + /// 0=unspecified, 1=Karaoke + public uint VMGCategory; + + /// + /// Number of volumes + /// + public ushort NumberOfVolumes; + + /// + /// Volume number + /// + public ushort VolumeNumber; + + /// + /// Side ID + /// + public byte SideID; + + /// + /// Number of title sets + /// + public ushort NumberOfTitleSets; + + /// + /// Provider ID + /// + public byte[] ProviderID; + + /// + /// VMG POS + /// + public ulong VMGPOS; + + /// + /// End byte address of VTS_MAT + /// + public uint InformationManagementTableEndByteAddress; + + /// + /// Start address of FP_PGC (First Play program chain) + /// + public uint FirstPlayProgramChainStartAddress; + + /// + /// Start sector of Menu VOB + /// + public uint MenuVOBStartSector; + + /// + /// Start sector of Title VOB + /// + public uint TitleVOBStartSector; + + /// + /// Sector pointer to VTS_PTT_SRPT (table of Titles and Chapters) + /// + public uint TableOfTitlesAndChaptersSectorPointer; + + /// + /// Sector pointer to VTS_PGCI (Title Program Chain table) + /// + public uint TitleProgramChainTableSectorPointer; + + /// + /// Sector pointer to VTSM_PGCI_UT (Menu Program Chain table) + /// + public uint MenuProgramChainTableSectorPointer; + + /// + /// Sector pointer to VTS_TMAPTI (time map) + /// + public uint TimeMapSectorPointer; + + /// + /// Sector pointer to VTSM_C_ADT (menu cell address table) + /// + public uint MenuCellAddressTableSectorPointer; + + /// + /// Sector pointer to VTSM_VOBU_ADMAP (menu VOBU address map) + /// + public uint MenuVOBUAddressMapSectorPointer; + + /// + /// Sector pointer to VTS_C_ADT (title set cell address table) + /// + public uint TitleSetCellAddressTableSectorPointer; + + /// + /// Sector pointer to VTS_VOBU_ADMAP (title set VOBU address map) + /// + public uint TitleSetVOBUAddressMapSectorPointer; + + /// + /// Video attributes of VTSM_VOBS + /// + public byte[] VideoAttributes; + + /// + /// Number of audio streams in VTSM_VOBS + /// + public ushort NumberOfAudioStreams; + + /// + /// Audio attributes of VTSM_VOBS + /// + public byte[][] AudioAttributes; + + /// + /// Unknown + /// + public byte[] Unknown; + + /// + /// Number of subpicture streams in VTSM_VOBS (0 or 1) + /// + public ushort NumberOfSubpictureStreams; + + /// + /// Subpicture attributes of VTSM_VOBS + /// + public byte[] SubpictureAttributes; + + /// + /// Reserved + /// + public byte[] Reserved; + } +} \ No newline at end of file