public Mp4MdhdBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.MDHD, 0L, stream) { if (base.Version == 0) { this.CreationTime = stream.ReadUInt32(); this.ModificationTime = stream.ReadUInt32(); this.TimeScale = stream.ReadUInt32(); this.Duration = stream.ReadUInt32(); } else { this.CreationTime = stream.ReadUInt64(); this.ModificationTime = stream.ReadUInt64(); this.TimeScale = stream.ReadUInt32(); this.Duration = stream.ReadUInt64(); } byte[] buffer = new byte[2]; stream.Read(buffer, 2); byte num = (byte)(((byte)(buffer[0] >> 2)) & 0x1f); byte num2 = (byte)((((byte)(buffer[0] & 3)) << 3) | ((buffer[1] >> 5) & 7)); byte num3 = (byte)(buffer[1] & 0x1f); if (((num != 0) && (num2 != 0)) && (num3 != 0)) { char[] chArray = new char[] { (char)(num + 0x60), (char)(num2 + 0x60), (char)(num3 + 0x60) }; this.Language = new string(chArray); } else { this.Language = "```"; } }
public Mp4ElstBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.ELST, 0L, stream) { uint num = stream.ReadUInt32(); this.Entries = new List <Mp4ElstEntry>(); for (uint i = 0; i < num; i++) { short num3; if (base.Version == 0) { uint num4 = stream.ReadUInt32(); int num5 = stream.ReadInt32(); num3 = stream.ReadInt16(); stream.ReadInt16(); this.Entries.Add(new Mp4ElstEntry((ulong)num4, (long)num5, num3)); } else { ulong segmentDuration = stream.ReadUInt64(); long mediaTime = stream.ReadInt64(); num3 = stream.ReadInt16(); stream.ReadInt16(); this.Entries.Add(new Mp4ElstEntry(segmentDuration, mediaTime, num3)); } } }
public Mp48bdlBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.LDB8) { this.Encoding = stream.ReadUInt32(); this.EncodingVersion = stream.ReadUInt32(); this.BundleData = new byte[(size - 8) - 8]; stream.Read(this.BundleData, this.BundleData.Length); }
public Mp4HdlrBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.HDLR, 0L, stream) { this.Reserved = new uint[3]; this.PreDefined = stream.ReadUInt32(); this.HandlerType = stream.ReadUInt32(); this.Reserved[0] = stream.ReadUInt32(); this.Reserved[1] = stream.ReadUInt32(); this.Reserved[2] = stream.ReadUInt32(); int count = ((int)size) - 0x1c; if (count > 0) { byte[] buffer = new byte[count]; stream.Read(buffer, count); if (buffer[0] == (count - 1)) { this.Name = Encoding.UTF8.GetString(buffer, 1, buffer.Length - 1); } else { this.Name = Encoding.UTF8.GetString(buffer); int index = this.Name.IndexOf('\0'); if (index != -1) { this.Name = this.Name.Substring(0, index); } } } else { this.Name = string.Empty; } }
public Mp4TkhdBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.TKHD, 0L, stream) { this.Reserved2 = new byte[8]; this.Matrix = new uint[9]; if (base.Version == 0) { this.CreationTime = stream.ReadUInt32(); this.ModificationTime = stream.ReadUInt32(); this.TrackId = stream.ReadUInt32(); this.Reserved1 = stream.ReadUInt32(); this.Duration = stream.ReadUInt32(); } else { this.CreationTime = stream.ReadUInt64(); this.ModificationTime = stream.ReadUInt64(); this.TrackId = stream.ReadUInt32(); this.Reserved1 = stream.ReadUInt32(); this.Duration = stream.ReadUInt64(); } stream.Read(this.Reserved2, 8); this.Layer = stream.ReadUInt16(); this.AlternateGroup = stream.ReadUInt16(); this.Volume = stream.ReadUInt16(); this.Reserved3 = stream.ReadUInt16(); for (int i = 0; i < 9; i++) { this.Matrix[i] = stream.ReadUInt32(); } this.Width = stream.ReadUInt32(); this.Height = stream.ReadUInt32(); }
public Mp4TrexBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.TREX, 0L, stream) { this.TrackId = stream.ReadUInt32(); this.DefaultSampleDescriptionIndex = stream.ReadUInt32(); this.DefaultSampleDuration = stream.ReadUInt32(); this.DefaultSampleSize = stream.ReadUInt32(); this.DefaultSampleFlags = stream.ReadUInt32(); }
public Mp4HmhdBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.HMHD, 0L, stream) { this.MaxPduSize = stream.ReadUInt16(); this.AvgPduSize = stream.ReadUInt16(); this.MaxBitrate = stream.ReadUInt32(); this.AvgBitrate = stream.ReadUInt32(); this.Reserved = stream.ReadUInt32(); }
public Mp4StssBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.STSS, 0L, stream) { this.lookupCache = 0; uint num = stream.ReadUInt32(); this.Entries = new List <uint>((int)num); for (int i = 0; i < num; i++) { this.Entries.Add(stream.ReadUInt32()); } }
public Mp4FtypBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.FTYP) { this.MajorBrand = stream.ReadUInt32(); this.MinorVersion = stream.ReadUInt32(); int capacity = (int)((size - 0x10) / 4); this.CompatibleBrands = new List <uint>(capacity); for (int i = 0; i < capacity; i++) { this.CompatibleBrands.Add(stream.ReadUInt32()); } }
public Mp4SttsBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.STTS, 0L, stream) { this.lookupCache = new LookupCache(); uint num = stream.ReadUInt32(); this.Entries = new List <Mp4SttsEntry>((int)num); for (int i = 0; i < num; i++) { uint sampleCount = stream.ReadUInt32(); uint sampleDelta = stream.ReadUInt32(); this.Entries.Add(new Mp4SttsEntry(sampleCount, sampleDelta)); } }
public Mp4PdinBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.PDIN, stream) { int capacity = ((int)size) - this.HeaderSize; this.Entries = new List <Mp4PdinEntry>(capacity); for (int i = 0; i < capacity; i++) { Mp4PdinEntry item = new Mp4PdinEntry { Rate = stream.ReadUInt32(), InitialDelay = stream.ReadUInt32() }; this.Entries.Add(item); } }
public Mp4MvhdBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.MVHD, 0L, stream) { this.Reserved1 = new byte[2]; this.Reserved2 = new byte[8]; this.Matrix = new uint[9]; this.Predefined = new byte[0x18]; if (base.Version == 0) { this.CreationTime = stream.ReadUInt32(); this.ModificationTime = stream.ReadUInt32(); this.TimeScale = stream.ReadUInt32(); this.Duration = stream.ReadUInt32(); } else { this.CreationTime = stream.ReadUInt64(); this.ModificationTime = stream.ReadUInt64(); this.TimeScale = stream.ReadUInt32(); this.Duration = stream.ReadUInt64(); } this.Rate = stream.ReadUInt32(); this.Volume = stream.ReadUInt16(); stream.Read(this.Reserved1, this.Reserved1.Length); stream.Read(this.Reserved2, this.Reserved2.Length); for (int i = 0; i < 9; i++) { this.Matrix[i] = stream.ReadUInt32(); } stream.Read(this.Predefined, this.Predefined.Length); this.NextTrackId = stream.ReadUInt32(); }
public Mp4FullBox(uint size, uint type, ulong largeSize, Mp4Stream stream) : base(size, type, largeSize) { uint num = stream.ReadUInt32(); this.Version = (num >> 0x18) & 0xff; this.Flags = num & 0xffffff; }
public Mp4StscBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.STSC, 0L, stream) { uint num = 1; uint num2 = stream.ReadUInt32(); this.Entries = new List <Mp4StscEntry>((int)num2); byte[] buffer = new byte[num2 * 12]; stream.Read(buffer, (int)(num2 * 12)); for (int i = 0; i < num2; i++) { uint num4 = Mp4Util.BytesToUInt32BE(buffer, i * 12); uint num5 = Mp4Util.BytesToUInt32BE(buffer, (i * 12) + 4); uint num6 = Mp4Util.BytesToUInt32BE(buffer, (i * 12) + 8); if (i > 0) { int num7 = i - 1; this.Entries[num7].ChunkCount = num4 - this.Entries[num7].FirstChunk; num += this.Entries[num7].ChunkCount * this.Entries[num7].SamplesPerChunk; } this.Entries.Add(new Mp4StscEntry()); this.Entries[i].ChunkCount = 0; this.Entries[i].FirstChunk = num4; this.Entries[i].FirstSample = num; this.Entries[i].SamplesPerChunk = num5; this.Entries[i].SampleDescriptionIndex = num6; } }
public override void ReadFields(Mp4Stream stream) { base.ReadFields(stream); this.HintTrackVersion = stream.ReadUInt16(); this.HighestCompatibleVersion = stream.ReadUInt16(); this.MaxPacketSize = stream.ReadUInt32(); }
public Mp4TrunBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.TRUN, 0L, stream) { uint num = stream.ReadUInt32(); if ((base.Flags & 1) != 0) { this.DataOffset = (int)stream.ReadUInt32(); } if ((base.Flags & 4) != 0) { this.FirstSampleFlags = stream.ReadUInt32(); } this.Entries = new List <Mp4TrunEntry>((int)num); for (int i = 0; i < num; i++) { this.Entries.Add(new Mp4TrunEntry()); if ((base.Flags & 0x100) != 0) { this.Entries[i].SampleDuration = stream.ReadUInt32(); } if ((base.Flags & 0x200) != 0) { this.Entries[i].SampleSize = stream.ReadUInt32(); } if ((base.Flags & 0x400) != 0) { this.Entries[i].SampleFlags = stream.ReadUInt32(); } if ((base.Flags & 0x800) != 0) { this.Entries[i].SampleCompositionTimeOffset = stream.ReadUInt32(); } } }
public Mp4MehdBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.MEHD, 0L, stream) { if (base.Version == 1) { this.FragmentDuration = stream.ReadUInt64(); } else { this.FragmentDuration = stream.ReadUInt32(); } }
public Mp4StszBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.STSZ, 0L, stream) { this.SampleSize = stream.ReadUInt32(); uint num = stream.ReadUInt32(); if (this.SampleSize == 0) { this.Entries = new List <uint>((int)num); byte[] buffer = new byte[num * 4]; stream.Read(buffer, (int)(num * 4)); for (uint i = 0; i < num; i++) { this.Entries.Add(Mp4Util.BytesToUInt32BE(buffer, (int)(i * 4))); } } else { this.Entries = new List <uint>(); } }
public Mp4TrefTypeBox(uint type, uint size, Mp4Stream stream) : base(size, type) { int capacity = ((int)size) - this.HeaderSize; this.TrackIds = new List <uint>(capacity); for (int i = 0; i < capacity; i++) { uint item = stream.ReadUInt32(); this.TrackIds.Add(item); } }
public Mp4RtpBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.RTP_, 0L) { this.DescriptionFormat = stream.ReadUInt32(); int count = ((int)size) - 12; if (count > 0) { byte[] buffer = new byte[count]; stream.Read(buffer, count); this.Text = Encoding.ASCII.GetString(buffer); } }
public override void ReadFields(Mp4Stream stream) { base.ReadFields(stream); this.Predefined1 = stream.ReadUInt16(); this.Reserved2 = stream.ReadUInt16(); stream.Read(this.Predefined2, this.Predefined2.Length); this.Width = stream.ReadUInt16(); this.Height = stream.ReadUInt16(); this.HorizResolution = stream.ReadUInt32(); this.VertResolution = stream.ReadUInt32(); this.Reserved3 = stream.ReadUInt32(); this.FrameCount = stream.ReadUInt16(); byte[] buffer = new byte[0x20]; stream.Read(buffer, 0x20); int count = buffer[0]; if (count < 0x20) { this.CompressorName = Encoding.ASCII.GetString(buffer, 1, count); } this.Depth = stream.ReadUInt16(); this.Predefined3 = stream.ReadUInt16(); }
public Mp4Co64Box(uint size, Mp4Stream stream) : base(size, Mp4BoxType.CO64, 0L, stream) { uint num = stream.ReadUInt32(); if (num > (((size - 12) - 4) / 8)) { num = ((size - 12) - 4) / 8; } this.Entries = new List <ulong>((int)num); for (int i = 0; i < num; i++) { this.Entries.Add(stream.ReadUInt64()); } }
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); } }
public Mp4TfhdBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.TFHD, 0L, stream) { this.TrackId = stream.ReadUInt32(); if ((base.Flags & 1) != 0) { this.BaseDataOffset = stream.ReadUInt64(); } if ((base.Flags & 2) != 0) { this.SampleDescriptionIndex = stream.ReadUInt32(); } if ((base.Flags & 8) != 0) { this.DefaultSampleDuration = stream.ReadUInt32(); } if ((base.Flags & 0x10) != 0) { this.DefaultSampleSize = stream.ReadUInt32(); } if ((base.Flags & 0x20) != 0) { this.DefaultSampleFlags = stream.ReadUInt32(); } }
public Mp4StcoBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.STCO, 0L, stream) { uint num = stream.ReadUInt32(); if (num > (((size - 12) - 4) / 4)) { num = ((size - 12) - 4) / 4; } this.Entries = new List <uint>((int)num); byte[] buffer = new byte[num * 4]; stream.Read(buffer, (int)(num * 4)); for (int i = 0; i < num; i++) { this.Entries.Add(Mp4Util.BytesToUInt32BE(buffer, i * 4)); } }
public Mp4DrefBox(uint size, Mp4Stream stream, Mp4BoxFactory factory) : base(size, Mp4BoxType.DREF, 0L, stream) { uint num = stream.ReadUInt32(); this.Entries = new List <Mp4Box>((int)num); uint num2 = num; long bytesAvailable = (size - 12) - 4; while (num2-- > 0) { Mp4Box item = null; while ((item = factory.Read(stream, ref bytesAvailable)) != null) { this.Entries.Add(item); } } }
public Mp4StsdBox(uint size, Mp4Stream stream, Mp4BoxFactory factory) : base(size, Mp4BoxType.STSD, 0L, stream) { uint num = stream.ReadUInt32(); factory.PushContext(base.Type); long bytesAvailable = (size - 12) - 4; this.Entries = new List <Mp4Box>((int)num); for (int i = 0; i < num; i++) { Mp4Box item = factory.Read(stream, ref bytesAvailable); if (item != null) { this.Entries.Add(item); } } factory.PopContext(); }
public Mp4CttsBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.CTTS, 0L, stream) { this.lookupCache = new LookupCache(); uint num = stream.ReadUInt32(); this.Entries = new List <Mp4CttsEntry>((int)num); byte[] buffer = new byte[num * 8]; stream.Read(buffer, (int)(num * 8)); bool flag = false; int num2 = 0; for (int i = 0; i < num; i++) { this.Entries.Add(new Mp4CttsEntry()); this.Entries[i].SampleCount = Mp4Util.BytesToUInt32BE(buffer, i * 8); uint num4 = Mp4Util.BytesToUInt32BE(buffer, (i * 8) + 4); if ((num4 & 0x80000000) != 0) { flag = true; int num5 = (int)num4; if (num5 < num2) { num2 = num5; } } this.Entries[i].SampleOffset = num4; } if (flag) { for (int j = 0; j < num; j++) { Mp4CttsEntry local1 = this.Entries[j]; local1.SampleOffset -= (uint)num2; } } }
public override void ReadFields(Mp4Stream stream) { base.ReadFields(stream); this.QtVersion = stream.ReadUInt16(); this.QtRevision = stream.ReadUInt16(); this.QtVendor = stream.ReadUInt32(); this.ChannelCount = stream.ReadUInt16(); this.SampleSize = stream.ReadUInt16(); this.QtCompressionId = stream.ReadUInt16(); this.QtPacketSize = stream.ReadUInt16(); this.SampleRate = stream.ReadUInt32(); if (this.QtVersion == 1) { this.QtV1SamplesPerPacket = stream.ReadUInt32(); this.QtV1BytesPerPacket = stream.ReadUInt32(); this.QtV1BytesPerFrame = stream.ReadUInt32(); this.QtV1BytesPerSample = stream.ReadUInt32(); } else if (this.QtVersion == 2) { uint num2; uint num3; this.QtV2StructSize = stream.ReadUInt32(); this.QtV2SampleRate64 = stream.ReadDouble(); this.QtV2ChannelCount = stream.ReadUInt32(); this.QtV2Reserved = stream.ReadUInt32(); this.QtV2BitsPerChannel = stream.ReadUInt32(); this.QtV2FormatSpecificFlags = stream.ReadUInt32(); this.QtV2BytesPerAudioPacket = stream.ReadUInt32(); this.QtV2LPCMFramesPerAudioPacket = stream.ReadUInt32(); if (this.QtV2StructSize > 0x48) { uint num = this.QtV2StructSize - 0x48; this.QtV2Extension = new byte[num]; stream.Read(this.QtV2Extension, (int)num); } this.QtV1BytesPerSample = num2 = 0; this.QtV1BytesPerFrame = num3 = num2; this.QtV1SamplesPerPacket = this.QtV1BytesPerPacket = num3; } else { this.QtV1SamplesPerPacket = 0; this.QtV1BytesPerPacket = 0; this.QtV1BytesPerFrame = 0; this.QtV1BytesPerSample = 0; this.QtV2StructSize = 0; this.QtV2SampleRate64 = 0.0; this.QtV2ChannelCount = 0; this.QtV2Reserved = 0; this.QtV2BitsPerChannel = 0; this.QtV2FormatSpecificFlags = 0; this.QtV2BytesPerAudioPacket = 0; this.QtV2LPCMFramesPerAudioPacket = 0; } }
public Mp4MfhdBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.MFHD, 0L, stream) { this.SequenceNumber = stream.ReadUInt32(); }