jellyfin/DvdLib/Ifo/Title.cs

71 lines
2.0 KiB
C#
Raw Normal View History

#pragma warning disable CS1591
using System.Collections.Generic;
using System.IO;
namespace DvdLib.Ifo
{
public class Title
{
public uint TitleNumber { get; private set; }
2020-06-15 14:43:52 -07:00
public uint AngleCount { get; private set; }
2020-06-15 14:43:52 -07:00
public ushort ChapterCount { get; private set; }
2020-06-15 14:43:52 -07:00
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; }
2020-06-15 14:43:52 -07:00
public readonly List<ProgramChain> ProgramChains;
2019-01-07 16:27:46 -07:00
public readonly List<Chapter> Chapters;
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 13:37:13 -07:00
var pgc = new ProgramChain(pgcNum);
pgc.ParseHeader(br);
ProgramChains.Add(pgc);
2020-06-20 01:35:29 -07:00
if (entryPgc)
{
EntryProgramChain = pgc;
}
br.BaseStream.Seek(curPos, SeekOrigin.Begin);
}
}
}