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.Descriptors.Extension
{
	[SkyscraperPlugin]
	[ExtensionDescriptor(0x0B,"SDT")]
    class ServiceRelocatedDescriptor : Dvb.ExtensionDescriptor
    {
        public ServiceRelocatedDescriptor(byte[] buffer)
        {
            if (buffer.Length != 6)
                throw new DvbDescriptorBrokenException("expected 6 bytes");

            MemoryStream ms = new MemoryStream(buffer,false);
            OldOriginalNetworkId = ms.ReadUInt16BE();
            OldTransportStreamId = ms.ReadUInt16BE();
            OldServiceId = ms.ReadUInt16BE();
        }

        public ushort OldServiceId { get; private set; }

        public ushort OldTransportStreamId { get; private set; }

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