public Mp4ObjectDescriptor(Mp4Stream stream, Mp4DescriptorTag tag, uint headerSize, uint payloadSize) : base(tag, headerSize, payloadSize)
        {
            Mp4Descriptor descriptor;
            long          position = stream.Position;
            ushort        num2     = stream.ReadUInt16();

            this.ObjectDescriptorId = (ushort)(num2 >> 6);
            this.UrlFlag            = (num2 & 0x20) != 0;
            if (this.UrlFlag)
            {
                byte   count  = stream.ReadUInt08();
                byte[] buffer = new byte[0x100];
                stream.Read(buffer, count);
                buffer[count] = 0;
                this.Url      = Encoding.ASCII.GetString(buffer, 0, count);
            }
            long offset = stream.Position;

            this.SubDescriptors = new List <Mp4Descriptor>();
            Mp4DescriptorFactory factory = new Mp4DescriptorFactory();
            Mp4SubStream         stream2 = new Mp4SubStream(stream, offset, (long)(payloadSize - ((uint)(offset - position))));

            while ((descriptor = factory.Read(stream2)) != null)
            {
                this.SubDescriptors.Add(descriptor);
            }
        }
Example #2
0
        public Mp4EsDescriptor(Mp4Stream stream, uint headerSize, uint payloadSize) : base(Mp4DescriptorTag.ES, headerSize, payloadSize)
        {
            Mp4Descriptor descriptor;
            long          position = stream.Position;

            this.EsId = stream.ReadUInt16();
            byte num2 = stream.ReadUInt08();

            this.Flags          = (uint)((num2 >> 5) & 7);
            this.StreamPriority = (byte)(num2 & 0x1f);
            if ((this.Flags & 1) != 0)
            {
                this.DependsOn = stream.ReadUInt16();
            }
            else
            {
                this.DependsOn = 0;
            }
            if ((this.Flags & 2) != 0)
            {
                byte count = stream.ReadUInt08();
                if (count != 0)
                {
                    byte[] buffer = new byte[count + 1];
                    stream.Read(buffer, count);
                    buffer[count] = 0;
                    this.Url      = Encoding.ASCII.GetString(buffer, 0, count);
                }
            }
            if ((this.Flags & 2) != 0)
            {
                this.OcrEsId = stream.ReadUInt16();
            }
            else
            {
                this.OcrEsId = 0;
            }
            long offset = stream.Position;

            this.SubDescriptors = new List <Mp4Descriptor>();
            Mp4DescriptorFactory factory = new Mp4DescriptorFactory();
            Mp4SubStream         stream2 = new Mp4SubStream(stream, offset, (long)(payloadSize - ((uint)(offset - position))));

            while ((descriptor = factory.Read(stream2)) != null)
            {
                this.SubDescriptors.Add(descriptor);
            }
        }
Example #3
0
        public Mp4DecoderConfigDescriptor(Mp4Stream stream, uint headerSize, uint payloadSize) : base(Mp4DescriptorTag.DECODER_CONFIG, headerSize, payloadSize)
        {
            Mp4Descriptor descriptor;
            long          position = stream.Position;

            this.ObjectTypeIndication = (Mp4ObjectTypeIndication)stream.ReadUInt08();
            byte num2 = stream.ReadUInt08();

            this.StreamType     = (byte)((num2 >> 2) & 0x3f);
            this.UpStream       = (num2 & 2) != 0;
            this.BufferSize     = stream.ReadUInt24();
            this.MaxBitrate     = stream.ReadUInt32();
            this.AverageBitrate = stream.ReadUInt32();
            long offset = stream.Position;

            this.SubDescriptors = new List <Mp4Descriptor>();
            Mp4DescriptorFactory factory = new Mp4DescriptorFactory();
            Mp4SubStream         stream2 = new Mp4SubStream(stream, offset, (long)(payloadSize - ((uint)(offset - position))));

            while ((descriptor = factory.Read(stream2)) != null)
            {
                this.SubDescriptors.Add(descriptor);
            }
        }
Example #4
0
        public Mp4EsdsBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.ESDS, 0L, stream)
        {
            Mp4Descriptor descriptor = new Mp4DescriptorFactory().Read(stream);

            this.EsDescriptor = descriptor as Mp4EsDescriptor;
        }
Example #5
0
        public Mp4IodsBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.IODS, 0L, stream)
        {
            Mp4Descriptor descriptor = new Mp4DescriptorFactory().Read(stream);

            this.ObjectDescriptor = descriptor as Mp4ObjectDescriptor;
        }