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

namespace skyscraper5.Mpeg2.Descriptors
{
	[SkyscraperPlugin]
	[TsDescriptor(0x0b,"PMT")]
    [BannedTable("TSDT")]
    class SystemClockDescriptor : TsDescriptor
    {
        public SystemClockDescriptor(byte[] buffer)
        {
            MemoryStream ms = new MemoryStream(buffer, false);
            byte readUInt8 = ms.ReadUInt8();
            ExternalClockReferenceIndicator = (readUInt8 & 0x80) != 0;
            ClockAccuracyInteger = (readUInt8 & 0x3f);
            ClockAccuracyExponent = (ms.ReadUInt8() & 0xe0) >> 5;
        }

        public int ClockAccuracyExponent { get; private set; }

        public int ClockAccuracyInteger { get; private set; }
        public bool ExternalClockReferenceIndicator { get; private set; }
    }
}
