Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 4
0
 public override void WriteBody(Mp4Stream stream)
 {
     for (int i = 0; i < this.Entries.Count; i++)
     {
         byte num2 = 0;
         num2 = (byte)((num2 | this.Entries[i].SampleDependsOn) << 2);
         num2 = (byte)((num2 | this.Entries[i].SampleIsDependOn) << 2);
         num2 = (byte)(num2 | this.Entries[i].SampleHasRedundancy);
         stream.WriteUInt08(num2);
     }
 }
Ejemplo n.º 5
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);
         }
     }
 }
Ejemplo n.º 6
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);
         }
     }
 }
Ejemplo n.º 7
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);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
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);
            }
        }
Ejemplo n.º 10
0
 public override void WriteHeader(Mp4Stream stream)
 {
     base.WriteHeader(stream);
     stream.WriteUInt08((byte)this.Version);
     stream.WriteUInt24(this.Flags);
 }
Ejemplo n.º 11
0
 public override void WriteFields(Mp4Stream stream)
 {
     stream.WriteUInt08(this.Predefined);
 }
Ejemplo n.º 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;
                }
            }
        }