Ejemplo n.º 1
0
        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 = "```";
            }
        }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 3
0
 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();
 }
Ejemplo n.º 4
0
        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));
                }
            }
        }
Ejemplo n.º 5
0
 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();
     }
 }
Ejemplo n.º 6
0
        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());
            }
        }
Ejemplo n.º 7
0
 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();
     }
 }
Ejemplo n.º 8
0
        public Mp4TfraBox(uint size, Mp4Stream stream) : base(size, Mp4BoxType.TFRA, 0L, stream)
        {
            this.TrackId = stream.ReadUInt32();
            uint num = stream.ReadUInt32();

            this.Reserved              = ((int)(num >> 6)) & 0x3ffffff;
            this.LengthSizeOfTrafNum   = (byte)((num >> 4) & 3);
            this.LengthSizeOfTrunNum   = (byte)((num >> 2) & 3);
            this.LengthSizeOfSampleNum = (byte)(num & 3);
            uint num2 = stream.ReadUInt32();

            this.Entries = new List <Mp4TfraEntry>();
            for (int i = 0; i < num2; i++)
            {
                Mp4TfraEntry item = new Mp4TfraEntry();
                if (base.Version == 1)
                {
                    item.Time       = stream.ReadUInt64();
                    item.MoofOffset = stream.ReadUInt64();
                }
                else
                {
                    item.Time       = stream.ReadUInt32();
                    item.MoofOffset = stream.ReadUInt32();
                }
                switch (this.LengthSizeOfTrafNum)
                {
                case 0:
                    item.TrafNumber = stream.ReadUInt08();
                    break;

                case 1:
                    item.TrafNumber = stream.ReadUInt16();
                    break;

                case 2:
                    item.TrafNumber = stream.ReadUInt24();
                    break;

                case 3:
                    item.TrafNumber = stream.ReadUInt32();
                    break;
                }
                switch (this.LengthSizeOfTrunNum)
                {
                case 0:
                    item.TrunNumber = stream.ReadUInt08();
                    break;

                case 1:
                    item.TrunNumber = stream.ReadUInt16();
                    break;

                case 2:
                    item.TrunNumber = stream.ReadUInt24();
                    break;

                case 3:
                    item.TrunNumber = stream.ReadUInt32();
                    break;
                }
                switch (this.LengthSizeOfSampleNum)
                {
                case 0:
                    item.SampleNumber = stream.ReadUInt08();
                    break;

                case 1:
                    item.SampleNumber = stream.ReadUInt16();
                    break;

                case 2:
                    item.SampleNumber = stream.ReadUInt24();
                    break;

                case 3:
                    item.SampleNumber = stream.ReadUInt32();
                    break;
                }
                this.Entries.Add(item);
            }
        }