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

namespace skyscraper5.Mpeg2.Descriptors
{
	[SkyscraperPlugin]
	[TsDescriptor(0x1d,"PMT")]
    [BannedTable("TSDT")]
    class IodDescriptor : TsDescriptor
    {
        public IodDescriptor(byte[] buffer)
        {
            ScopeOfIodLabel = buffer[0];
            IodLabel = buffer[1];

            if (buffer[2] == 0x02)
            {
                byte[] iodBuffer = new byte[buffer.Length - 3];
                Array.Copy(buffer, 3, iodBuffer, 0, buffer.Length - 3);
                InitialObjectDescriptor = new InitialObjectDescriptor(iodBuffer);
            }
        }

        public byte IodLabel { get; private set; }

        public byte ScopeOfIodLabel { get; private set; }

        public InitialObjectDescriptor InitialObjectDescriptor { get; private set; }
    }
}
