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

namespace skyscraper5.Dvb.Descriptors
{
	[SkyscraperPlugin]
	[TsDescriptor(0x52,"PMT")]
    [BannedTable("TSDT","EIT")]
    class StreamIdentifierDescriptor : TsDescriptor
    {
        public StreamIdentifierDescriptor(byte[] buffer)
        {
            if (buffer.Length != 1)
            {
                Valid = false;
                return;
            }

            ComponentTag = buffer[0];
            Valid = true;
        }

        public StreamIdentifierDescriptor(byte componentTag)
        {
	        ComponentTag = componentTag;
        }

        public byte ComponentTag { get; private set; }

        public override byte[] Serialize()
        {
	        return new byte[] { ComponentTag };
        }
    }
}
