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.Mhp.Descriptors
{
	[SkyscraperPlugin]
	[TsDescriptor(0x03,"AIT")]
    class DvbJApplicationDescriptor : TsDescriptor
    {
        public DvbJApplicationDescriptor(byte[] buffer)
        {
            MemoryStream ms = new MemoryStream(buffer, false);
            List<string> result = new List<string>();
            while (ms.GetAvailableBytes() > 0)
            {
                byte parameterLength = ms.ReadUInt8();
                result.Add(Encoding.ASCII.GetString(ms.ReadBytes(parameterLength)));
            }

            Args = result.ToArray();
            Valid = true;
        }

        public string[] Args { get; private set; }
    }
}
