using skyscraper5.Mpeg2;
using skyscraper5.Skyscraper.IO;
using skyscraper5.Skyscraper.Plugins;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace skyscraper5.src.InteractionChannel.Model.Descriptors
{
	[SkyscraperPlugin]
	[TsDescriptor(0xb1,"TIM")]
	public class _0xb1_CorrectionMessageExtensionDescriptor : TsDescriptor
	{
		public _0xb1_CorrectionMessageExtensionDescriptor(byte[] buffer)
		{
			MemoryStream ms = new MemoryStream(buffer, false);
			SuperframeId = ms.ReadUInt8();
			SuperframeCount = ms.ReadUInt16BE();
			FrameNumber = ms.ReadUInt8() & 0x1f;
			SlotNumber = (ms.ReadUInt16BE() & 0x07ff);
			Valid = true;
		}

		public byte SuperframeId { get; }
		public ushort SuperframeCount { get; }
		public int FrameNumber { get; }
		public int SlotNumber { get; }

		public override string ToString()
		{
			return String.Format("Correction Message Extension for Superframe {0}", SuperframeId);
		}
	}
}
