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

namespace skyscraper5.Dvb.SystemSoftwareUpdate.Descriptors
{
	[SkyscraperPlugin]
	[TsDescriptor(0x03,"UNT")]
    class SsuLocationDescriptor : TsDescriptor
    {
        public SsuLocationDescriptor(byte[] buffer)
        {
            MemoryStream ms = new MemoryStream(buffer, false);
            DataBroadcastId = ms.ReadUInt16BE();
            if (DataBroadcastId == 0x000a)
            {
                AssociationTag = ms.ReadUInt16BE();
            }

            PrivateData = ms.ReadBytes(ms.GetAvailableBytes());
        }

        public byte[] PrivateData { get; private set; }

        public ushort? AssociationTag { get; private set; }

        public ushort DataBroadcastId { get; private set; }
    }
}
