internal void ParseHeader(BinaryReader br) { long startPos = br.BaseStream.Position; br.ReadUInt16(); _programCount = br.ReadByte(); _cellCount = br.ReadByte(); PlaybackTime = new DvdTime(br.ReadBytes(4)); ProhibitedUserOperations = (UserOperation)br.ReadUInt32(); AudioStreamControl = br.ReadBytes(16); SubpictureStreamControl = br.ReadBytes(128); _nextProgramNumber = br.ReadUInt16(); _prevProgramNumber = br.ReadUInt16(); _goupProgramNumber = br.ReadUInt16(); StillTime = br.ReadByte(); byte pbMode = br.ReadByte(); if (pbMode == 0) { PlaybackMode = ProgramPlaybackMode.Sequential; } else { PlaybackMode = ((pbMode & 0x80) == 0) ? ProgramPlaybackMode.Random : ProgramPlaybackMode.Shuffle; } ProgramCount = (uint)(pbMode & 0x7F); Palette = br.ReadBytes(64); _commandTableOffset = br.ReadUInt16(); _programMapOffset = br.ReadUInt16(); _cellPlaybackOffset = br.ReadUInt16(); _cellPositionOffset = br.ReadUInt16(); // read position info br.BaseStream.Seek(startPos + _cellPositionOffset, SeekOrigin.Begin); for (int cellNum = 0; cellNum < _cellCount; cellNum++) { Cell c = new Cell(); c.ParsePosition(br); Cells.Add(c); } br.BaseStream.Seek(startPos + _cellPlaybackOffset, SeekOrigin.Begin); for (int cellNum = 0; cellNum < _cellCount; cellNum++) { Cells[cellNum].ParsePlayback(br); } br.BaseStream.Seek(startPos + _programMapOffset, SeekOrigin.Begin); List <int> cellNumbers = new List <int>(); for (int progNum = 0; progNum < _programCount; progNum++) { cellNumbers.Add(br.ReadByte() - 1); } for (int i = 0; i < cellNumbers.Count; i++) { int max = (i + 1 == cellNumbers.Count) ? _cellCount : cellNumbers[i + 1]; Programs.Add(new Program(Cells.Where((c, idx) => idx >= cellNumbers[i] && idx < max).ToList())); } }
internal CellPlaybackInfo(BinaryReader br) { br.BaseStream.Seek(0x4, SeekOrigin.Current); PlaybackTime = new DvdTime(br.ReadBytes(4)); br.BaseStream.Seek(0x10, SeekOrigin.Current); }