mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-23 03:33:18 +01:00
32 lines
1.0 KiB
C#
32 lines
1.0 KiB
C#
using System;
|
|
|
|
namespace Nikse.SubtitleEdit.Core.VobSub
|
|
{
|
|
public class SpHeader
|
|
{
|
|
public const int SpHeaderLength = 14;
|
|
|
|
public string Identifier { get; private set; }
|
|
public TimeSpan StartTime { get; private set; }
|
|
public int NextBlockPosition { get; private set; }
|
|
public int ControlSequencePosition { get; private set; }
|
|
public SubPicture Picture { get; private set; }
|
|
|
|
public SpHeader(byte[] buffer)
|
|
{
|
|
Identifier = System.Text.Encoding.ASCII.GetString(buffer, 0, 2);
|
|
int startMilliseconds = (int)Helper.GetLittleEndian32(buffer, 2) / 90;
|
|
StartTime = TimeSpan.FromMilliseconds(startMilliseconds);
|
|
NextBlockPosition = Helper.GetEndianWord(buffer, 10) - 4;
|
|
ControlSequencePosition = Helper.GetEndianWord(buffer, 12) - 4;
|
|
}
|
|
|
|
public SubPicture AddPicture(byte[] buffer)
|
|
{
|
|
Picture = new SubPicture(buffer, ControlSequencePosition, -4);
|
|
return Picture;
|
|
}
|
|
|
|
}
|
|
}
|