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

namespace skyscraper5.Dvb.Descriptors
{
	[SkyscraperPlugin]
	[TsDescriptor(0x54,"EIT")]
    [BannedTable("SDT","PMT","BAT","TSDT")]
    class ContentDescriptor : TsDescriptor
    {
        public ContentDescriptor(byte[] buffer)
        {
            if (buffer.Length % 2 != 0)
                return;

            Content = new Tuple<int, int, byte>[buffer.Length / 2];
            for (int i = 0; i < buffer.Length; i += 2)
            {
                Content[i / 2] = new Tuple<int, int, byte>((buffer[i] & 0xf0) >> 4, buffer[i] & 0x0f, buffer[i + 1]);
            }

            this.Valid = true;
        }
        
        public Tuple<int,int,byte>[] Content { get; }
    }
}
