Exemplo n.º 1
0
 public override void WriteBody(Mp4Stream stream)
 {
     if (base.Version == 0)
     {
         stream.WriteUInt32((uint)this.CreationTime);
         stream.WriteUInt32((uint)this.ModificationTime);
         stream.WriteUInt32(this.TrackId);
         stream.WriteUInt32(this.Reserved1);
         stream.WriteUInt32((uint)this.Duration);
     }
     else
     {
         stream.WriteUInt64(this.CreationTime);
         stream.WriteUInt64(this.ModificationTime);
         stream.WriteUInt32(this.TrackId);
         stream.WriteUInt32(this.Reserved1);
         stream.WriteUInt64(this.Duration);
     }
     stream.Write(this.Reserved2, this.Reserved2.Length);
     stream.WriteUInt16(this.Layer);
     stream.WriteUInt16(this.AlternateGroup);
     stream.WriteUInt16(this.Volume);
     stream.WriteUInt16(this.Reserved3);
     for (int i = 0; i < 9; i++)
     {
         stream.WriteUInt32(this.Matrix[i]);
     }
     stream.WriteUInt32(this.Width);
     stream.WriteUInt32(this.Height);
 }
Exemplo n.º 2
0
        public override void WriteInnerBody(Mp4Stream stream)
        {
            base.WriteInnerBody(stream);
            stream.WriteUInt16(this.Predefined1);
            stream.WriteUInt16(this.Reserved2);
            stream.Write(this.Predefined2, this.Predefined2.Length);
            stream.WriteUInt16(this.Width);
            stream.WriteUInt16(this.Height);
            stream.WriteUInt32(this.HorizResolution);
            stream.WriteUInt32(this.VertResolution);
            stream.WriteUInt32(this.Reserved3);
            stream.WriteUInt16(this.FrameCount);
            byte[] buffer = new byte[0x20];
            int    length = this.CompressorName.Length;

            if (length > 0x1f)
            {
                length = 0x1f;
            }
            buffer[0] = (byte)length;
            for (int i = 0; i < length; i++)
            {
                buffer[i + 1] = (byte)this.CompressorName[i];
            }
            for (int j = length + 1; j < 0x20; j++)
            {
                buffer[j] = 0;
            }
            stream.Write(buffer, 0x20);
            stream.WriteUInt16(this.Depth);
            stream.WriteUInt16(this.Predefined3);
        }
Exemplo n.º 3
0
 public override void WriteBody(Mp4Stream stream)
 {
     for (int i = 0; i < this.Entries.Count; i++)
     {
         stream.WriteUInt32(this.Entries[i].Rate);
         stream.WriteUInt32(this.Entries[i].InitialDelay);
     }
 }
Exemplo n.º 4
0
 public override void WriteBody(Mp4Stream stream)
 {
     stream.WriteUInt32((uint)this.Entries.Count);
     for (int i = 0; i < this.Entries.Count; i++)
     {
         stream.WriteUInt32(this.Entries[i]);
     }
 }
Exemplo n.º 5
0
 public override void WriteBody(Mp4Stream stream)
 {
     stream.WriteUInt32(this.TrackId);
     stream.WriteUInt32(this.DefaultSampleDescriptionIndex);
     stream.WriteUInt32(this.DefaultSampleDuration);
     stream.WriteUInt32(this.DefaultSampleSize);
     stream.WriteUInt32(this.DefaultSampleFlags);
 }
Exemplo n.º 6
0
 public override void WriteBody(Mp4Stream stream)
 {
     stream.WriteUInt32(this.MajorBrand);
     stream.WriteUInt32(this.MinorVersion);
     foreach (uint num in this.CompatibleBrands)
     {
         stream.WriteUInt32(num);
     }
 }
Exemplo n.º 7
0
 public override void WriteBody(Mp4Stream stream)
 {
     stream.WriteUInt32(this.EntryCount);
     for (int i = 0; i < this.EntryCount; i++)
     {
         stream.WriteUInt32(this.Entries[i].SampleCount);
         stream.WriteUInt32(this.Entries[i].SampleDelta);
     }
 }
Exemplo n.º 8
0
 public override void WriteBody(Mp4Stream stream)
 {
     stream.WriteUInt32(this.EntryCount);
     for (int i = 0; i < this.EntryCount; i++)
     {
         stream.WriteUInt32(this.Entries[i].FirstChunk);
         stream.WriteUInt32(this.Entries[i].SamplesPerChunk);
         stream.WriteUInt32(this.Entries[i].SampleDescriptionIndex);
     }
 }
Exemplo n.º 9
0
 public override void WriteBody(Mp4Stream stream)
 {
     stream.WriteUInt32(this.SampleSize);
     stream.WriteUInt32(this.SampleCount);
     if (this.SampleSize == 0)
     {
         for (int i = 0; i < this.SampleCount; i++)
         {
             stream.WriteUInt32(this.Entries[i]);
         }
     }
 }
Exemplo n.º 10
0
 public virtual void WriteHeader(Mp4Stream stream)
 {
     stream.WriteUInt32(this.Size);
     stream.WriteUInt32(this.Type);
     if (this.Size == 1)
     {
         stream.WriteUInt64(this.LargeSize);
     }
     if (this.UserType != null)
     {
         stream.Write(this.UserType, this.UserType.Length);
     }
 }
Exemplo n.º 11
0
 public override void WriteBody(Mp4Stream stream)
 {
     if (base.Version == 0)
     {
         stream.WriteUInt32((uint)this.CreationTime);
         stream.WriteUInt32((uint)this.ModificationTime);
         stream.WriteUInt32(this.TimeScale);
         stream.WriteUInt32((uint)this.Duration);
     }
     else
     {
         stream.WriteUInt64(this.CreationTime);
         stream.WriteUInt64(this.ModificationTime);
         stream.WriteUInt32(this.TimeScale);
         stream.WriteUInt64(this.Duration);
     }
     stream.WriteUInt32(this.Rate);
     stream.WriteUInt16(this.Volume);
     stream.Write(this.Reserved1, this.Reserved1.Length);
     stream.Write(this.Reserved2, this.Reserved2.Length);
     for (int i = 0; i < 9; i++)
     {
         stream.WriteUInt32(this.Matrix[i]);
     }
     stream.Write(this.Predefined, this.Predefined.Length);
     stream.WriteUInt32(this.NextTrackId);
 }
Exemplo n.º 12
0
        public override void WriteFields(Mp4Stream stream)
        {
            stream.WriteUInt08((byte)this.ObjectTypeIndication);
            byte num = (byte)(((this.StreamType << 2) | (this.UpStream ? 2 : 0)) | 1);

            stream.WriteUInt08(num);
            stream.WriteUInt24(this.BufferSize);
            stream.WriteUInt32(this.MaxBitrate);
            stream.WriteUInt32(this.AverageBitrate);
            foreach (Mp4Descriptor descriptor in this.SubDescriptors)
            {
                descriptor.Write(stream);
            }
        }
Exemplo n.º 13
0
 public override void WriteBody(Mp4Stream stream)
 {
     for (int i = 0; i < this.TrackIds.Count; i++)
     {
         stream.WriteUInt32(this.TrackIds[i]);
     }
 }
Exemplo n.º 14
0
 public override void WriteInnerBody(Mp4Stream stream)
 {
     base.WriteInnerBody(stream);
     stream.WriteUInt16(this.HintTrackVersion);
     stream.WriteUInt16(this.HighestCompatibleVersion);
     stream.WriteUInt32(this.MaxPacketSize);
 }
Exemplo n.º 15
0
 public override void WriteBody(Mp4Stream stream)
 {
     stream.WriteUInt32((uint)this.Entries.Count);
     foreach (Mp4Box box in this.Entries)
     {
         box.Write(stream);
     }
 }
Exemplo n.º 16
0
 public override void WriteBody(Mp4Stream stream)
 {
     stream.WriteUInt32((uint)this.Entries.Count);
     if ((base.Flags & 1) != 0)
     {
         stream.WriteUInt32((uint)this.DataOffset);
     }
     if ((base.Flags & 4) != 0)
     {
         stream.WriteUInt32(this.FirstSampleFlags);
     }
     for (int i = 0; i < this.Entries.Count; i++)
     {
         if ((base.Flags & 0x100) != 0)
         {
             stream.WriteUInt32(this.Entries[i].SampleDuration);
         }
         if ((base.Flags & 0x200) != 0)
         {
             stream.WriteUInt32(this.Entries[i].SampleSize);
         }
         if ((base.Flags & 0x400) != 0)
         {
             stream.WriteUInt32(this.Entries[i].SampleFlags);
         }
         if ((base.Flags & 0x800) != 0)
         {
             stream.WriteUInt32(this.Entries[i].SampleCompositionTimeOffset);
         }
     }
 }
Exemplo n.º 17
0
 public override void WriteBody(Mp4Stream stream)
 {
     if (base.Version == 1)
     {
         stream.WriteUInt64(this.FragmentDuration);
     }
     else
     {
         stream.WriteUInt32((uint)this.FragmentDuration);
     }
 }
Exemplo n.º 18
0
 public override void WriteBody(Mp4Stream stream)
 {
     stream.WriteUInt32((uint)this.Entries.Count);
     foreach (Mp4Box box in this.Entries)
     {
         long position = stream.Position;
         box.Write(stream);
         long num3 = stream.Position - position;
         if (num3 > box.Size)
         {
             throw new Exception("Internal error");
         }
     }
 }
Exemplo n.º 19
0
        public override void WriteBody(Mp4Stream stream)
        {
            if (base.Version == 0)
            {
                stream.WriteUInt32((uint)this.CreationTime);
                stream.WriteUInt32((uint)this.ModificationTime);
                stream.WriteUInt32(this.TimeScale);
                stream.WriteUInt32((uint)this.Duration);
            }
            else
            {
                stream.WriteUInt64(this.CreationTime);
                stream.WriteUInt64(this.ModificationTime);
                stream.WriteUInt32(this.TimeScale);
                stream.WriteUInt64(this.Duration);
            }
            byte num  = (byte)(this.Language[0] - '`');
            byte num2 = (byte)(this.Language[1] - '`');
            byte num3 = (byte)(this.Language[2] - '`');

            stream.WriteUInt08((byte)((num << 2) | (num2 >> 3)));
            stream.WriteUInt08((byte)((num2 << 5) | num3));
            stream.WriteUInt16(0);
        }
Exemplo n.º 20
0
 public override void WriteBody(Mp4Stream stream)
 {
     stream.WriteUInt32(this.TrackId);
     if ((base.Flags & 1) != 0)
     {
         stream.WriteUInt64(this.BaseDataOffset);
     }
     if ((base.Flags & 2) != 0)
     {
         stream.WriteUInt32(this.SampleDescriptionIndex);
     }
     if ((base.Flags & 8) != 0)
     {
         stream.WriteUInt32(this.DefaultSampleDuration);
     }
     if ((base.Flags & 0x10) != 0)
     {
         stream.WriteUInt32(this.DefaultSampleSize);
     }
     if ((base.Flags & 0x20) != 0)
     {
         stream.WriteUInt32(this.DefaultSampleFlags);
     }
 }
Exemplo n.º 21
0
        public override void WriteBody(Mp4Stream stream)
        {
            stream.WriteUInt32(0);
            stream.WriteUInt32(this.HandlerType);
            stream.WriteUInt32(this.Reserved[0]);
            stream.WriteUInt32(this.Reserved[1]);
            stream.WriteUInt32(this.Reserved[2]);
            int length = this.Name.Length;

            if ((0x20 + length) > this.Size)
            {
                length = (((int)this.Size) - 12) + 20;
            }
            if (length > 0)
            {
                stream.Write(Encoding.UTF8.GetBytes(this.Name), length);
            }
            int num2 = ((int)this.Size) - (0x20 + length);

            while (num2-- > 0)
            {
                stream.WriteUInt08(0);
            }
        }
Exemplo n.º 22
0
 public override void WriteBody(Mp4Stream stream)
 {
     stream.WriteUInt32(this.SequenceNumber);
 }
Exemplo n.º 23
0
 public override void WriteBody(Mp4Stream stream)
 {
     stream.WriteUInt32(this.TimeScale);
 }
Exemplo n.º 24
0
 public override void WriteBody(Mp4Stream stream)
 {
     stream.WriteUInt32(this.Encoding);
     stream.WriteUInt32(this.EncodingVersion);
     stream.Write(this.BundleData, this.BundleData.Length);
 }
Exemplo n.º 25
0
 public override void WriteBody(Mp4Stream stream)
 {
     stream.WriteUInt32(this.MfraSize);
 }
Exemplo n.º 26
0
 public override void WriteInnerBody(Mp4Stream stream)
 {
     base.WriteInnerBody(stream);
     stream.WriteUInt16(this.QtVersion);
     stream.WriteUInt16(this.QtRevision);
     stream.WriteUInt32(this.QtVendor);
     stream.WriteUInt16(this.ChannelCount);
     stream.WriteUInt16(this.SampleSize);
     stream.WriteUInt16(this.QtCompressionId);
     stream.WriteUInt16(this.QtPacketSize);
     stream.WriteUInt32(this.SampleRate);
     if (this.QtVersion == 1)
     {
         stream.WriteUInt32(this.QtV1SamplesPerPacket);
         stream.WriteUInt32(this.QtV1BytesPerPacket);
         stream.WriteUInt32(this.QtV1BytesPerFrame);
         stream.WriteUInt32(this.QtV1BytesPerSample);
     }
     else if (this.QtVersion == 2)
     {
         stream.WriteUInt32(this.QtV2StructSize);
         stream.WriteDouble(this.QtV2SampleRate64);
         stream.WriteUInt32(this.QtV2ChannelCount);
         stream.WriteUInt32(this.QtV2Reserved);
         stream.WriteUInt32(this.QtV2BitsPerChannel);
         stream.WriteUInt32(this.QtV2FormatSpecificFlags);
         stream.WriteUInt32(this.QtV2BytesPerAudioPacket);
         stream.WriteUInt32(this.QtV2LPCMFramesPerAudioPacket);
         if (this.QtV2Extension != null)
         {
             stream.Write(this.QtV2Extension, this.QtV2Extension.Length);
         }
     }
 }
Exemplo n.º 27
0
        public override void WriteBody(Mp4Stream stream)
        {
            stream.WriteUInt32(this.TrackId);
            uint num = (uint)(this.Reserved << 6);

            num |= (uint)(this.LengthSizeOfTrafNum << 4);
            num |= (uint)(this.LengthSizeOfTrunNum << 2);
            num |= this.LengthSizeOfSampleNum;
            stream.WriteUInt32(num);
            stream.WriteUInt32((uint)this.NumberOfEntry);
            for (int i = 0; i < this.Entries.Count; i++)
            {
                Mp4TfraEntry entry = this.Entries[i];
                if (base.Version == 1)
                {
                    stream.WriteUInt64(entry.Time);
                    stream.WriteUInt64(entry.MoofOffset);
                }
                else
                {
                    stream.WriteUInt32((uint)entry.Time);
                    stream.WriteUInt32((uint)entry.MoofOffset);
                }
                switch (this.LengthSizeOfTrafNum)
                {
                case 0:
                    stream.WriteUInt08((byte)entry.TrafNumber);
                    break;

                case 1:
                    stream.WriteUInt16((ushort)entry.TrafNumber);
                    break;

                case 2:
                    stream.WriteUInt24(entry.TrafNumber);
                    break;

                case 3:
                    stream.WriteUInt32(entry.TrafNumber);
                    break;
                }
                switch (this.LengthSizeOfTrunNum)
                {
                case 0:
                    stream.WriteUInt08((byte)entry.TrunNumber);
                    break;

                case 1:
                    stream.WriteUInt16((ushort)entry.TrunNumber);
                    break;

                case 2:
                    stream.WriteUInt24(entry.TrunNumber);
                    break;

                case 3:
                    stream.WriteUInt32(entry.TrunNumber);
                    break;
                }
                switch (this.LengthSizeOfSampleNum)
                {
                case 0:
                    stream.WriteUInt08((byte)entry.SampleNumber);
                    break;

                case 1:
                    stream.WriteUInt16((ushort)entry.SampleNumber);
                    break;

                case 2:
                    stream.WriteUInt24(entry.SampleNumber);
                    break;

                case 3:
                    stream.WriteUInt32(entry.SampleNumber);
                    break;
                }
            }
        }