// We can make our own handler.
		public Mpeg4IsoHandlerBox(ByteVector handlerType, string name, Mpeg4Box parent) : base("hdlr", 0, parent)
		{
			if (handlerType != null)
				this.handlerType = handlerType.Mid(0, 4);
			
			this.name = name;
		}
Example #2
0
 // Replace this box with another one.
 public void ReplaceWith(Mpeg4Box box)
 {
     if (Parent != null)
     {
         Parent.ReplaceChild(this, box);
     }
 }
        public Mpeg4AppleDataBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
        {
            // Ensure that the data is loaded before the file is closed.

            // Get the box data based on position and size offsets
            LoadBoxData(4, -4);
        }
		public Mpeg4AppleDataBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
		{
			// Ensure that the data is loaded before the file is closed.
			
			// Get the box data based on position and size offsets
			LoadBoxData(4, -4);			
		}
Example #5
0
 // If the file is readable and the box can have children and there is
 // enough space to read the data, get the next box by reading from the end
 // of the first box.
 private Mpeg4Box NextChild(Mpeg4Box child)
 {
     if (HasChildren && this.File != null && child.NextBoxPosition >= DataPosition && child.NextBoxPosition < NextBoxPosition)
     {
         return(Mpeg4Box.Create(File, child.NextBoxPosition, this));
     }
     return(null);
 }
		protected Mpeg4FullBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
		{
			File.Seek(base.DataPosition);

			// First 4 buffer contain version and flag data.
			version = File.ReadBlock(1)[0];
			flags = File.ReadBlock(3).ToUInt();
		}
		public Mpeg4IsoChunkLargeOffsetBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
		{
			File.Seek(base.DataPosition);
			offsets = new List<ulong>((int)File.ReadBlock(4).ToUInt());

			for (int i = 0; i < offsets.Count; i++)
				offsets[i] = (ulong)File.ReadBlock(4).ToLong();
		}
        protected Mpeg4FullBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
        {
            File.Seek(base.DataPosition);

            // First 4 buffer contain version and flag data.
            version = File.ReadBlock(1)[0];
            flags   = File.ReadBlock(3).ToUInt();
        }
        // We can make our own handler.
        public Mpeg4IsoHandlerBox(ByteVector handlerType, string name, Mpeg4Box parent) : base("hdlr", 0, parent)
        {
            if (handlerType != null)
            {
                this.handlerType = handlerType.Mid(0, 4);
            }

            this.name = name;
        }
        public Mpeg4IsoSampleDescriptionBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
        {
            File.Seek(base.DataPosition);

            // This box just contains a number saying how many of the first boxes
            // will be SampleEntries, since they can be named whatever they want to
            // be.
            entryCount = File.ReadBlock(4).ToUInt();
        }
		public Mpeg4IsoAudioSampleEntry(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
		{
			File.Seek(base.DataPosition + 8);
			channelCount = (ushort)File.ReadBlock(2).ToShort();
			sampleSize = (ushort)File.ReadBlock(2).ToShort();

			File.Seek(base.DataPosition + 16);
			sampleRate = (uint)File.ReadBlock(4).ToUInt();
		}
        public Mpeg4IsoAudioSampleEntry(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
        {
            File.Seek(base.DataPosition + 8);
            channelCount = (ushort)File.ReadBlock(2).ToShort();
            sampleSize   = (ushort)File.ReadBlock(2).ToShort();

            File.Seek(base.DataPosition + 16);
            sampleRate = (uint)File.ReadBlock(4).ToUInt();
        }
		public Mpeg4IsoSampleDescriptionBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
		{
			File.Seek(base.DataPosition);

			// This box just contains a number saying how many of the first boxes
			// will be SampleEntries, since they can be named whatever they want to
			// be.
			entryCount = File.ReadBlock(4).ToUInt();
		}
		public Mpeg4IsoChunkOffsetBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
		{
			File.Seek(base.DataPosition);
			offsets = new List<uint>((int)File.ReadBlock(4).ToUInt());
			//new uint[(int)File.ReadBlock(4).ToUInt()];

			for (int i = 0; i < offsets.Count; i++)
				offsets[i] = File.ReadBlock(4).ToUInt();
		}
        public Mpeg4IsoChunkLargeOffsetBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
        {
            File.Seek(base.DataPosition);
            offsets = new List <ulong>((int)File.ReadBlock(4).ToUInt());

            for (int i = 0; i < offsets.Count; i++)
            {
                offsets[i] = (ulong)File.ReadBlock(4).ToLong();
            }
        }
Example #16
0
        public Mpeg4IsoChunkOffsetBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
        {
            File.Seek(base.DataPosition);
            offsets = new List <uint>((int)File.ReadBlock(4).ToUInt());
            //new uint[(int)File.ReadBlock(4).ToUInt()];

            for (int i = 0; i < offsets.Count; i++)
            {
                offsets[i] = File.ReadBlock(4).ToUInt();
            }
        }
		public Mpeg4IsoHandlerBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
		{
			// Reserved
			File.Seek(base.DataPosition + 4);

			// Read the handler type.
			handlerType = File.ReadBlock(4);

			// Reserved
			File.Seek(base.DataPosition + 20);

			// Find the terminating byte and read a string from the data before it.
			long end = File.Find((byte)0, File.Tell);
			name = File.ReadBlock((int)(end - File.Tell)).ToString();
		}
Example #18
0
        // Replace a child with a new one.
        public void ReplaceChild(Mpeg4Box oldChild, Mpeg4Box newChild)
        {
            int index = children.IndexOf(oldChild);

            if (index >= 0)
            {
                children[index] = newChild;
                oldChild.Parent = null;
                newChild.Parent = this;
            }
            else
            {
                AddChild(newChild);
            }
        }
Example #19
0
        public Mpeg4Box(Mpeg4BoxHeader header, Mpeg4Box parent)
        {
            // Initialize everything.
            this.header = header;
            this.parent = parent;
            //this.data     = null;
            //this.children = new ArrayList();
            //this.loadChildrenStarted = false;

            // This was necessary after refactoring the File, DataPosition and DataSize
            // properties so that they are no longer virtual
            if (header != null && file == null)
            {
                this.file = header.File;
            }
        }
Example #20
0
		public Mpeg4Box(Mpeg4BoxHeader header, Mpeg4Box parent)
		{
			// Initialize everything.
			this.header = header;
			this.parent = parent;
			//this.data     = null;
			//this.children = new ArrayList();
			//this.loadChildrenStarted = false;
			
			// This was necessary after refactoring the File, DataPosition and DataSize
			// properties so that they are no longer virtual
			if (header != null && file == null)
			{
				this.file = header.File;
			}
		}
        public Mpeg4IsoHandlerBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
        {
            // Reserved
            File.Seek(base.DataPosition + 4);

            // Read the handler type.
            handlerType = File.ReadBlock(4);

            // Reserved
            File.Seek(base.DataPosition + 20);

            // Find the terminating byte and read a string from the data before it.
            long end = File.Find((byte)0, File.Tell);

            name = File.ReadBlock((int)(end - File.Tell)).ToString();
        }
Example #22
0
        // Load this box'field children as well as their children.
        public void LoadChildren()
        {
            if (!HasChildren || children.Count != 0 || loadChildrenStarted)
            {
                return;
            }

            loadChildrenStarted = true;

            Mpeg4Box box = FirstChild;

            while (box != null)
            {
                box.LoadChildren();
                children.Add(box);
                box = NextChild(box);
            }
        }
Example #23
0
        // Recursively find the first child with a given System.Type giving
        // preference to the current depth.
        public Mpeg4Box FindChildDeep(System.Type type)
        {
            foreach (Mpeg4Box child in Children)
            {
                if (child.GetType() == type)
                {
                    return(child);
                }
            }

            foreach (Mpeg4Box child in Children)
            {
                Mpeg4Box success = child.FindChildDeep(type);
                if (success != null)
                {
                    return(success);
                }
            }

            return(null);
        }
Example #24
0
        // Recursively find the first child with a given box type giving
        // preference to the current depth.
        public Mpeg4Box FindChildDeep(ByteVector type)
        {
            foreach (Mpeg4Box child in Children)
            {
                if (child.BoxType == type)
                {
                    return(child);
                }
            }

            foreach (Mpeg4Box child in Children)
            {
                Mpeg4Box success = child.FindChildDeep(type);
                if (success != null)
                {
                    return(success);
                }
            }

            return(null);
        }
		// This box can be created without loading it.
		public Mpeg4AppleItemListBox(Mpeg4Box parent) : base("ilst", parent)
		{
		}
Example #26
0
 public Mpeg4IsoSampleEntry(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
 {
     File.Seek(base.DataPosition + 6);
     dataReferenceIndex = (ushort)File.ReadBlock(2).ToShort();
 }
		public Mpeg4IsoMovieHeaderBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
		{
			// Size depends on version.
			boxSize = Version == 1 ? 108 : 96;

			// Get everything.
			File.Seek(base.DataPosition);
			ByteVector data = File.ReadBlock(boxSize);
			int pos = 0;

			// Read version one (large integers).
			if (Version == 1)
			{
				if (data.Count >= pos + 8)
					creationTime = (ulong)data.Mid(pos, 8).ToLong();
				pos += 8;

				if (data.Count >= pos + 8)
					modificationTime = (ulong)data.Mid(pos, 8).ToLong();
				pos += 8;

				if (data.Count >= pos + 4)
					timescale = data.Mid(pos, 4).ToUInt();
				pos += 4;

				if (data.Count >= pos + 8)
					duration = (ulong)data.Mid(pos, 8).ToLong();
				pos += 8;
			}
			// Read version zero (normal integers).
			else
			{
				if (data.Count >= pos + 4)
					creationTime = data.Mid(pos, 4).ToUInt();
				pos += 4;

				if (data.Count >= pos + 4)
					modificationTime = data.Mid(pos, 4).ToUInt();
				pos += 4;

				if (data.Count >= pos + 4)
					timescale = data.Mid(pos, 4).ToUInt();
				pos += 4;

				if (data.Count >= pos + 4)
					duration = (ulong)data.Mid(pos, 4).ToUInt();
				pos += 4;
			}

			// Get rate
			if (data.Count >= pos + 4)
				rate = data.Mid(pos, 4).ToUInt();
			pos += 4;

			// Get volume
			if (data.Count >= pos + 2)
				volume = (ushort)data.Mid(pos, 2).ToShort();
			pos += 2;

			// reserved
			pos += 2;

			// reserved
			pos += 8;

			// video transformation matrix
			pos += 36;

			// pre-defined
			pos += 24;

			// Get next track ID
			if (data.Count >= pos + 4)
				nextTrackId = (ushort)data.Mid(pos, 4).ToUInt();
		}
		public Mpeg4AppleAdditionalInfoBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
		{
			// The box content is a type string.
			text = LoadBoxData().ToString(StringType.Latin1);
			//BoxData.ToString(StringType.Latin1);
		}
 public Mpeg4UnknownBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
 {
 }
		public Mpeg4IsoSampleEntry(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
		{
			File.Seek(base.DataPosition + 6);
			dataReferenceIndex = (ushort)File.ReadBlock(2).ToShort();
		}
Example #31
0
 protected Mpeg4FullBox(ByteVector type, uint flags, Mpeg4Box parent) : base(new Mpeg4BoxHeader(type), parent)
 {
     //version = 0;
     this.flags = flags;
 }
Example #32
0
		protected Mpeg4FullBox(ByteVector type, uint flags, Mpeg4Box parent) : base(new Mpeg4BoxHeader(type), parent)
		{
			//version = 0;
			this.flags = flags;
		}
Example #33
0
 public Mpeg4IsoUserDataBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
 {
 }
		public Mpeg4IsoSampleTableBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
		{
		}
		public Mpeg4AppleAnnotationBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
		{
		}
		public Mpeg4IsoMetaBox(ByteVector handler_type, string handler_name, Mpeg4Box parent) : base("meta", 0, parent)
		{
			AddChild(new Mpeg4IsoHandlerBox(handler_type, handler_name, this));
		}
		public Mpeg4IsoFreeSpaceBox(ulong padding, Mpeg4Box parent) : base("free", parent)
		{
			PaddingSize = padding;
		}
Example #38
0
 protected Mpeg4FullBox(ByteVector type, Mpeg4Box parent) : this(type, 0, parent)
 {
 }
		public Mpeg4AppleItemListBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
		{
		}
Example #40
0
 // This box can be created without loading it.
 public Mpeg4AppleItemListBox(Mpeg4Box parent) : base("ilst", parent)
 {
 }
		// This box can be created without loading it.
		public Mpeg4AppleAnnotationBox(ByteVector type, Mpeg4Box parent) : base(type, parent)
		{
		}
Example #42
0
 public Mpeg4IsoMediaBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
 {
 }
Example #43
0
 // This box can be created without loading it.
 public Mpeg4IsoUserDataBox(Mpeg4Box parent) : base("udta", parent)
 {
 }
		public Mpeg4AppleElementaryStreamDescriptor(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
		{
			//WARNING: this was changed from accessing the Data property directy to instead
			// use LoadBoxData which returns a reference to the underlying data.  This change
			// was required to avoid accessing the virtual methods that the Data property uses
			// Everything should still work but if it doesn't then this change is the culprit...			
		
			decoderConfiguration = new ByteVector();

			uint length;

			// This box contains a ton of information.
			int offset = 0;

			// This is a safe alternative to the Data property
			// it will be a reference to the same underlying structure and so should work identically to Data
			ByteVector boxData = LoadBoxData();
			
			// Elementary Stream Descriptor Tag
			if (boxData[offset++] == 3)
			{
				// We have a descriptor tag. Check that it'field at least 20 long.
				if ((length = ReadLength(boxData, offset)) < 20)
				{
					TagLibDebugger.Debug("TagLib.Mpeg4.AppleElementaryStreamDescriptor () - Could not read data. Too small.");
					return;
				}
				offset += 4;

				streamId = boxData.Mid(offset, 2).ToShort();
				offset += 2;

				streamPriority = boxData[offset++];
			}
			else
			{
				// The tag wasn'type found, so the next two byte are the ID, and
				// after that, business as usual.
				streamId = boxData.Mid(offset, 2).ToShort();
				offset += 2;
			}

			// Verify that the next data is the Decoder Configuration Descriptor
			// Tag and escape if it won'type work out.
			if (boxData[offset++] != 4)
			{
				TagLibDebugger.Debug("TagLib.Mpeg4.AppleElementaryStreamDescriptor () - Could not identify decoder configuration descriptor.");
				return;
			}

			// Check that it'field at least 15 long.
			if ((length = ReadLength(boxData, offset)) < 15)
			{
				TagLibDebugger.Debug("TagLib.Mpeg4.AppleElementaryStreamDescriptor () - Could not read data. Too small.");
				return;
			}
			offset += 4;

			// Read a lot of good info.
			objectTypeId = boxData[offset++];
			streamType = boxData[offset++];
			bufferSize = boxData.Mid(offset, 3).ToUInt();
			offset += 3;
			maximumBitrate = boxData.Mid(offset, 4).ToUInt();
			offset += 4;
			averageBitrate = boxData.Mid(offset, 4).ToUInt();
			offset += 4;

			// Verify that the next data is the Decoder Specific Descriptor
			// Tag and escape if it won'type work out.
			if (boxData[offset++] != 5)
			{
				TagLibDebugger.Debug("TagLib.Mpeg4.AppleElementaryStreamDescriptor () - Could not identify decoder specific descriptor.");
				return;
			}

			// The rest of the info is decoder specific.
			length = ReadLength(boxData, offset);
			offset += 4;
			decoderConfiguration = boxData.Mid(offset, (int)length);
		}
		public Mpeg4IsoTrackBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
		{
		}
 public Mpeg4IsoFreeSpaceBox(ulong padding, Mpeg4Box parent) : base("free", parent)
 {
     PaddingSize = padding;
 }
Example #47
0
 public Mpeg4AppleItemListBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
 {
 }
 public Mpeg4IsoFreeSpaceBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
 {
     // set padding equal to the size of the zero space.
     padding = HeaderDataSize;
 }
Example #49
0
		// If the file is readable and the box can have children and there is 
		// enough space to read the data, get the next box by reading from the end
		// of the first box.
		private Mpeg4Box NextChild(Mpeg4Box child)
		{
			if (HasChildren && this.File != null && child.NextBoxPosition >= DataPosition && child.NextBoxPosition < NextBoxPosition)
				return Mpeg4Box.Create(File, child.NextBoxPosition, this);
			return null;
		}
		public Mpeg4IsoFreeSpaceBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
		{
			// set padding equal to the size of the zero space.
			padding = HeaderDataSize;
		}
Example #51
0
 public Mpeg4IsoTrackBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
 {
 }
		public Mpeg4IsoMediaInformationBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
		{
		}
Example #53
0
		protected Mpeg4FullBox(ByteVector type, Mpeg4Box parent) : this(type, 0, parent)
		{
		}
		public Mpeg4AppleDataBox(ByteVector data, uint flags, Mpeg4Box parent) : base("data", flags, parent)
		{
			InitializeBoxData(data);
			//Data = data;
		}
		// This box can be created without loading it.
		public Mpeg4IsoUserDataBox(Mpeg4Box parent) : base("udta", parent)
		{
		}
 public Mpeg4AppleAdditionalInfoBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
 {
     // The box content is a type string.
     text = LoadBoxData().ToString(StringType.Latin1);
     //BoxData.ToString(StringType.Latin1);
 }
		public Mpeg4IsoMetaBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
		{
		}
Example #58
0
 public Mpeg4IsoSampleTableBox(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
 {
 }
Example #59
0
        public Mpeg4AppleElementaryStreamDescriptor(Mpeg4BoxHeader header, Mpeg4Box parent) : base(header, parent)
        {
            //WARNING: this was changed from accessing the Data property directy to instead
            // use LoadBoxData which returns a reference to the underlying data.  This change
            // was required to avoid accessing the virtual methods that the Data property uses
            // Everything should still work but if it doesn't then this change is the culprit...

            decoderConfiguration = new ByteVector();

            uint length;

            // This box contains a ton of information.
            int offset = 0;

            // This is a safe alternative to the Data property
            // it will be a reference to the same underlying structure and so should work identically to Data
            ByteVector boxData = LoadBoxData();

            // Elementary Stream Descriptor Tag
            if (boxData[offset++] == 3)
            {
                // We have a descriptor tag. Check that it'field at least 20 long.
                if ((length = ReadLength(boxData, offset)) < 20)
                {
                    TagLibDebugger.Debug("TagLib.Mpeg4.AppleElementaryStreamDescriptor () - Could not read data. Too small.");
                    return;
                }
                offset += 4;

                streamId = boxData.Mid(offset, 2).ToShort();
                offset  += 2;

                streamPriority = boxData[offset++];
            }
            else
            {
                // The tag wasn'type found, so the next two byte are the ID, and
                // after that, business as usual.
                streamId = boxData.Mid(offset, 2).ToShort();
                offset  += 2;
            }

            // Verify that the next data is the Decoder Configuration Descriptor
            // Tag and escape if it won'type work out.
            if (boxData[offset++] != 4)
            {
                TagLibDebugger.Debug("TagLib.Mpeg4.AppleElementaryStreamDescriptor () - Could not identify decoder configuration descriptor.");
                return;
            }

            // Check that it'field at least 15 long.
            if ((length = ReadLength(boxData, offset)) < 15)
            {
                TagLibDebugger.Debug("TagLib.Mpeg4.AppleElementaryStreamDescriptor () - Could not read data. Too small.");
                return;
            }
            offset += 4;

            // Read a lot of good info.
            objectTypeId   = boxData[offset++];
            streamType     = boxData[offset++];
            bufferSize     = boxData.Mid(offset, 3).ToUInt();
            offset        += 3;
            maximumBitrate = boxData.Mid(offset, 4).ToUInt();
            offset        += 4;
            averageBitrate = boxData.Mid(offset, 4).ToUInt();
            offset        += 4;

            // Verify that the next data is the Decoder Specific Descriptor
            // Tag and escape if it won'type work out.
            if (boxData[offset++] != 5)
            {
                TagLibDebugger.Debug("TagLib.Mpeg4.AppleElementaryStreamDescriptor () - Could not identify decoder specific descriptor.");
                return;
            }

            // The rest of the info is decoder specific.
            length  = ReadLength(boxData, offset);
            offset += 4;
            decoderConfiguration = boxData.Mid(offset, (int)length);
        }
Example #60
0
		// Create a box by reading the file and add it to "parent".
		public static Mpeg4Box Create(Mpeg4File file, long position, Mpeg4Box parent)
		{
			// Read the box header.
			Mpeg4BoxHeader header = new Mpeg4BoxHeader(file, position);

			// If we're not even valid, quit.
			if (!header.IsValid)
				return null;

			// IF we're in a SampleDescriptionBox and haven'type loaded all the
			// entries, try loading an appropriate entry.
			if (parent.BoxType == "stsd" && parent.Children.Count < ((Mpeg4IsoSampleDescriptionBox)parent).EntryCount)
			{
				Mpeg4IsoHandlerBox handler = parent.Handler;
				if (handler != null && handler.HandlerType == "soun")
					return new Mpeg4IsoAudioSampleEntry(header, parent);
				else
					return new Mpeg4IsoSampleEntry(header, parent);
			}

			//
			// A bunch of standard items.
			//

			if (header.BoxType == "moov")
				return new Mpeg4IsoMovieBox(header, parent);

			if (header.BoxType == "mvhd")
				return new Mpeg4IsoMovieHeaderBox(header, parent);

			if (header.BoxType == "mdia")
				return new Mpeg4IsoMediaBox(header, parent);

			if (header.BoxType == "minf")
				return new Mpeg4IsoMediaInformationBox(header, parent);

			if (header.BoxType == "stbl")
				return new Mpeg4IsoSampleTableBox(header, parent);

			if (header.BoxType == "stsd")
				return new Mpeg4IsoSampleDescriptionBox(header, parent);

			if (header.BoxType == "stco")
				return new Mpeg4IsoChunkOffsetBox(header, parent);

			if (header.BoxType == "co64")
				return new Mpeg4IsoChunkLargeOffsetBox(header, parent);

			if (header.BoxType == "trak")
				return new Mpeg4IsoTrackBox(header, parent);

			if (header.BoxType == "hdlr")
				return new Mpeg4IsoHandlerBox(header, parent);

			if (header.BoxType == "udta")
				return new Mpeg4IsoUserDataBox(header, parent);

			if (header.BoxType == "meta")
				return new Mpeg4IsoMetaBox(header, parent);

			if (header.BoxType == "ilst")
				return new Mpeg4AppleItemListBox(header, parent);

			if (header.BoxType == "data")
				return new Mpeg4AppleDataBox(header, parent);

			if (header.BoxType == "esds")
				return new Mpeg4AppleElementaryStreamDescriptor(header, parent);

			if (header.BoxType == "free" || header.BoxType == "skip")
				return new Mpeg4IsoFreeSpaceBox(header, parent);

			if (header.BoxType == "mean" || header.BoxType == "name")
				return new Mpeg4AppleAdditionalInfoBox(header, parent);

			// If we still don'type have a tag, and we're inside an ItemLisBox, load
			// lthe box as an AnnotationBox (Apple tag item).
			if (parent.GetType() == typeof(Mpeg4AppleItemListBox))
				return new Mpeg4AppleAnnotationBox(header, parent);

			// Nothing good. Go generic.
			return new Mpeg4UnknownBox(header, parent);
		}