using System.ComponentModel.DataAnnotations;
using skyscraper5.Dvb;
using skyscraper5.Skyscraper.Plugins;

namespace skyscraper5.Mpeg2.Descriptors
{
	[SkyscraperPlugin]
	[TsDescriptor(3,"PMT")]
    [BannedTable("BAT","TSDT")]
    class AudioStreamDescriptor : TsDescriptor
    {
        public AudioStreamDescriptor(byte[] buffer)
        {
            if (buffer.Length != 1)
                return;

            byte uint8 = buffer[0];

            FreeFormat = (uint8 & 0x8000) != 0;
            ID = (uint8 & 0x4000) != 0;
            Layer = (uint8 & 0x3000);
            VariableRateAudio = (uint8 & 0x08) != 0;
            int Reserved = (uint8 & 0x07);
            base.Valid = true;
        }
        
        public bool VariableRateAudio { get; set; }

        public int Layer { get; private set; }

        public bool ID { get; private set; }

        public bool FreeFormat { get; private set; }
    }
}
