Пример #1
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);
        }
Пример #2
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);
 }
Пример #3
0
        public override void WriteBody(Mp4Stream stream)
        {
            stream.WriteUInt08(this.ConfigurationVersion);
            stream.WriteUInt08(this.AVCProfileIndication);
            stream.WriteUInt08(this.AVCCompatibleProfiles);
            stream.WriteUInt08(this.AVCLevelIndication);
            byte num = 0xfc;

            if ((this.NaluLengthSize >= 1) && (this.NaluLengthSize <= 4))
            {
                num = (byte)(num | ((byte)(this.NaluLengthSize - 1)));
            }
            stream.WriteUInt08(num);
            this.NaluLengthSize = (byte)(1 + (num & 3));
            byte num2 = (byte)(this.SequenceParameters.Count & 0x31);

            stream.WriteUInt08((byte)(0xe0 | num2));
            for (int i = 0; i < num2; i++)
            {
                ushort length = (ushort)this.SequenceParameters[i].Length;
                stream.WriteUInt16(length);
                stream.Write(this.SequenceParameters[i], length);
            }
            byte count = (byte)this.PictureParameters.Count;

            stream.WriteUInt08(count);
            for (int j = 0; j < count; j++)
            {
                ushort length = (ushort)this.PictureParameters[j].Length;
                stream.WriteUInt16(length);
                stream.Write(this.PictureParameters[j], length);
            }
        }
Пример #4
0
 public override void WriteFields(Mp4Stream stream)
 {
     if ((base.PayloadSize != 0) && (this.Info != null))
     {
         stream.Write(this.Info, this.Info.Length);
     }
 }
Пример #5
0
        public override void WriteFields(Mp4Stream stream)
        {
            stream.WriteUInt16(this.EsId);
            byte num = (byte)(this.StreamPriority | ((byte)(this.Flags << 5)));

            stream.WriteUInt08(num);
            if ((this.Flags & 1) != 0)
            {
                stream.WriteUInt16(this.DependsOn);
            }
            if ((this.Flags & 2) != 0)
            {
                byte[] bytes = Encoding.ASCII.GetBytes(this.Url);
                stream.WriteUInt08((byte)bytes.Length);
                stream.Write(bytes, bytes.Length);
                stream.WriteUInt08(0);
            }
            if ((this.Flags & 4) != 0)
            {
                stream.WriteUInt16(this.OcrEsId);
            }
            foreach (Mp4Descriptor descriptor in this.SubDescriptors)
            {
                descriptor.Write(stream);
            }
        }
Пример #6
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);
 }
Пример #7
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);
         }
     }
 }
Пример #8
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);
     }
 }
Пример #9
0
 public override void WriteBody(Mp4Stream stream)
 {
     if (((base.Flags & 1) == 0) && (this.Size > 12))
     {
         byte[] bytes = Encoding.ASCII.GetBytes(this.Location);
         stream.Write(bytes, bytes.Length + 1);
         int num = ((int)this.Size) - ((12 + bytes.Length) + 1);
         while (num-- != 0)
         {
             stream.WriteUInt08(0);
         }
     }
 }
Пример #10
0
 public override void WriteBody(Mp4Stream stream)
 {
     if (this.Size > 8)
     {
         byte[] bytes = Encoding.ASCII.GetBytes(this.Value);
         stream.Write(bytes, bytes.Length + 1);
         uint num = this.Size - ((uint)((8 + bytes.Length) + 1));
         while (num-- != 0)
         {
             stream.WriteUInt08(0);
         }
     }
 }
Пример #11
0
        public virtual void Write(Mp4Stream stream)
        {
            stream.WriteUInt08((byte)this.Tag);
            if (((this.HeaderSize - 1) > 8) || (this.HeaderSize < 2))
            {
                throw new Exception("Wrong value for HeaderSize");
            }
            uint payloadSize = this.PayloadSize;

            byte[] buffer = new byte[8];
            buffer[(int)((IntPtr)(this.HeaderSize - 2))] = (byte)(payloadSize & 0x7f);
            for (int i = ((int)this.HeaderSize) - 3; i >= 0; i--)
            {
                payloadSize = payloadSize >> 7;
                buffer[i]   = (byte)((payloadSize & 0x7f) | 0x80);
            }
            stream.Write(buffer, ((int)this.HeaderSize) - 1);
            this.WriteFields(stream);
        }
Пример #12
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);
            }
        }
Пример #13
0
 public override void WriteFields(Mp4Stream stream)
 {
     stream.Write(this.Data, this.Data.Length);
 }
Пример #14
0
 public override void WriteBody(Mp4Stream stream)
 {
     byte[] data = this.Data;
     stream.Write(data, data.Length);
 }
Пример #15
0
 public override void WriteBody(Mp4Stream stream)
 {
     stream.WriteUInt32(this.Encoding);
     stream.WriteUInt32(this.EncodingVersion);
     stream.Write(this.BundleData, this.BundleData.Length);
 }
Пример #16
0
 public override void WriteInnerBody(Mp4Stream stream)
 {
     stream.Write(this.Reserved, this.Reserved.Length);
     stream.WriteUInt16(this.DataReferenceIndex);
 }
Пример #17
0
 public virtual void CopyTo(Mp4Stream stream, int count)
 {
     byte[] buffer = new byte[count];
     this.stream.Read(buffer, 0, count);
     stream.Write(buffer, count);
 }