Пример #1
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);
            }
        }
Пример #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.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);
 }
Пример #3
0
 public override void WriteInnerBody(Mp4Stream stream)
 {
     base.WriteInnerBody(stream);
     stream.WriteUInt16(this.HintTrackVersion);
     stream.WriteUInt16(this.HighestCompatibleVersion);
     stream.WriteUInt32(this.MaxPacketSize);
 }
Пример #4
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);
            }
        }
Пример #5
0
 public override void WriteBody(Mp4Stream stream)
 {
     stream.WriteUInt16(this.GraphicsMode);
     stream.WriteUInt16(this.OpColor[0]);
     stream.WriteUInt16(this.OpColor[1]);
     stream.WriteUInt16(this.OpColor[2]);
 }
Пример #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.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);
 }
Пример #7
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);
        }
Пример #8
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);
         }
     }
 }
Пример #9
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);
        }
Пример #10
0
 public override void WriteInnerBody(Mp4Stream stream)
 {
     stream.Write(this.Reserved, this.Reserved.Length);
     stream.WriteUInt16(this.DataReferenceIndex);
 }
Пример #11
0
 public override void WriteBody(Mp4Stream stream)
 {
     stream.WriteInt16(this.Balance);
     stream.WriteUInt16(this.Reserved);
 }
Пример #12
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;
                }
            }
        }