예제 #1
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);
            }
        }
예제 #2
0
        public Mp4TfraBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.TFRA, 0L, stream)
        {
            this.TrackId = stream.ReadUInt32();
            uint num = stream.ReadUInt32();

            this.Reserved              = ((int)(num >> 6)) & 0x3ffffff;
            this.LengthSizeOfTrafNum   = (byte)((num >> 4) & 3);
            this.LengthSizeOfTrunNum   = (byte)((num >> 2) & 3);
            this.LengthSizeOfSampleNum = (byte)(num & 3);
            uint num2 = stream.ReadUInt32();

            this.Entries = new List <Mp4TfraEntry>();
            for (int i = 0; i < num2; i++)
            {
                Mp4TfraEntry item = new Mp4TfraEntry();
                if (base.Version == 1)
                {
                    item.Time       = stream.ReadUInt64();
                    item.MoofOffset = stream.ReadUInt64();
                }
                else
                {
                    item.Time       = stream.ReadUInt32();
                    item.MoofOffset = stream.ReadUInt32();
                }
                switch (this.LengthSizeOfTrafNum)
                {
                case 0:
                    item.TrafNumber = stream.ReadUInt08();
                    break;

                case 1:
                    item.TrafNumber = stream.ReadUInt16();
                    break;

                case 2:
                    item.TrafNumber = stream.ReadUInt24();
                    break;

                case 3:
                    item.TrafNumber = stream.ReadUInt32();
                    break;
                }
                switch (this.LengthSizeOfTrunNum)
                {
                case 0:
                    item.TrunNumber = stream.ReadUInt08();
                    break;

                case 1:
                    item.TrunNumber = stream.ReadUInt16();
                    break;

                case 2:
                    item.TrunNumber = stream.ReadUInt24();
                    break;

                case 3:
                    item.TrunNumber = stream.ReadUInt32();
                    break;
                }
                switch (this.LengthSizeOfSampleNum)
                {
                case 0:
                    item.SampleNumber = stream.ReadUInt08();
                    break;

                case 1:
                    item.SampleNumber = stream.ReadUInt16();
                    break;

                case 2:
                    item.SampleNumber = stream.ReadUInt24();
                    break;

                case 3:
                    item.SampleNumber = stream.ReadUInt32();
                    break;
                }
                this.Entries.Add(item);
            }
        }