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

namespace skyscraper5.Mpeg2.Descriptors
{
	[SkyscraperPlugin]
	[TsDescriptor(0x0e,"PMT")]
    class MaximumBitrateDescriptor : TsDescriptor
    {
        public MaximumBitrateDescriptor(byte[] buffer)
        {
            byte[] realBuffer = new byte[4];
            realBuffer[2] = buffer[0];
            realBuffer[1] = buffer[1];
            realBuffer[0] = buffer[2];
            uint uInt32 = BitConverter.ToUInt32(realBuffer, 0);
            MaximumBitrate = uInt32 & (0x3fffff);
            MaximumBitrate *= 50;
        }

        public uint MaximumBitrate { get; private set; }
    }
}
