2020-04-21 04:33:41 -04:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
2019-01-13 14:54:44 -05:00
|
|
|
using System.Collections.Generic;
|
2016-10-26 15:29:56 -04:00
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
namespace DvdLib.Ifo
|
|
|
|
{
|
|
|
|
public class Title
|
|
|
|
{
|
|
|
|
public uint TitleNumber { get; private set; }
|
|
|
|
public uint AngleCount { get; private set; }
|
|
|
|
public ushort ChapterCount { get; private set; }
|
|
|
|
public byte VideoTitleSetNumber { get; private set; }
|
|
|
|
|
|
|
|
private ushort _parentalManagementMask;
|
|
|
|
private byte _titleNumberInVTS;
|
|
|
|
private uint _vtsStartSector; // relative to start of entire disk
|
|
|
|
|
|
|
|
public ProgramChain EntryProgramChain { get; private set; }
|
|
|
|
public readonly List<ProgramChain> ProgramChains;
|
|
|
|
|
2019-01-07 18:27:46 -05:00
|
|
|
public readonly List<Chapter> Chapters;
|
2016-10-26 15:29:56 -04:00
|
|
|
|
|
|
|
public Title(uint titleNum)
|
|
|
|
{
|
|
|
|
ProgramChains = new List<ProgramChain>();
|
|
|
|
Chapters = new List<Chapter>();
|
|
|
|
Chapters = new List<Chapter>();
|
|
|
|
TitleNumber = titleNum;
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsVTSTitle(uint vtsNum, uint vtsTitleNum)
|
|
|
|
{
|
|
|
|
return (vtsNum == VideoTitleSetNumber && vtsTitleNum == _titleNumberInVTS);
|
|
|
|
}
|
|
|
|
|
|
|
|
internal void ParseTT_SRPT(BinaryReader br)
|
|
|
|
{
|
|
|
|
byte titleType = br.ReadByte();
|
|
|
|
// TODO parse Title Type
|
|
|
|
|
|
|
|
AngleCount = br.ReadByte();
|
|
|
|
ChapterCount = br.ReadUInt16();
|
|
|
|
_parentalManagementMask = br.ReadUInt16();
|
|
|
|
VideoTitleSetNumber = br.ReadByte();
|
|
|
|
_titleNumberInVTS = br.ReadByte();
|
|
|
|
_vtsStartSector = br.ReadUInt32();
|
|
|
|
}
|
|
|
|
|
|
|
|
internal void AddPgc(BinaryReader br, long startByte, bool entryPgc, uint pgcNum)
|
|
|
|
{
|
|
|
|
long curPos = br.BaseStream.Position;
|
|
|
|
br.BaseStream.Seek(startByte, SeekOrigin.Begin);
|
|
|
|
|
2019-01-13 15:37:13 -05:00
|
|
|
var pgc = new ProgramChain(pgcNum);
|
2016-10-26 15:29:56 -04:00
|
|
|
pgc.ParseHeader(br);
|
|
|
|
ProgramChains.Add(pgc);
|
|
|
|
if (entryPgc) EntryProgramChain = pgc;
|
|
|
|
|
|
|
|
br.BaseStream.Seek(curPos, SeekOrigin.Begin);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|