using System.Text;
using skyscraper5.Dvb;
using skyscraper5.Skyscraper.Plugins;

namespace skyscraper5.Mpeg2.Descriptors
{
	[SkyscraperPlugin]
	[TsDescriptor(10, "PMT")]
    [BannedTable("TSDT","SDT")]
    class Iso639LanguageDescriptor : TsDescriptor
    {
        public Iso639LanguageDescriptor(byte[] buffer)
        {
            if (buffer.Length != 4)
                return;

            Iso639LanguageCode = Encoding.ASCII.GetString(buffer, 0, 3);
            AudioType = (AudioType)buffer[3];
            this.Valid = true;
        }

        public string Iso639LanguageCode { get; private set; }

        public AudioType AudioType { get; private set; }
    }

    public enum AudioType : byte
    {
        Undefined = 0,
        CleanEffects = 1,
        HearingImpaired = 2,
        VisualImpairedCommentary = 3
    }
}
