public override string ToString() { StringBuilder xml = new StringBuilder(); xml.Append(base.ToString()); if (SoundMediaHeaderBox != null) { xml.Append(SoundMediaHeaderBox.ToString()); } if (VideoMediaHeaderBox != null) { xml.Append(VideoMediaHeaderBox.ToString()); } if (DataInformationBox != null) { xml.Append(DataInformationBox.ToString()); } if (SampleTableBox != null) { xml.Append(SampleTableBox.ToString()); } if (NullMediaHeaderBox != null) { xml.Append(NullMediaHeaderBox.ToString()); } xml.Append("</box>"); return(xml.ToString()); }
/// <summary> /// Read - read a MediaInformationBox /// We go in a loop with an if-else statement, so ordering of sub-boxes does not matter. /// </summary> /// <param name="reader"></param> public override void Read(BoxReader reader) { using (new SizeChecker(this, reader)) { base.Read(reader); while (reader.BaseStream.Position < (long)(this.Size + this.Offset)) { long pos = reader.BaseStream.Position; Box test = new Box(BoxTypes.Any); test.Read(reader); reader.BaseStream.Seek(pos, System.IO.SeekOrigin.Begin); pos = reader.BaseStream.Position; if (test.Type == BoxTypes.SoundMediaHeader) { this.SoundMediaHeaderBox = new SoundMediaHeaderBox(); SoundMediaHeaderBox.Read(reader); } else if (test.Type == BoxTypes.VideoMediaHeader) { this.VideoMediaHeaderBox = new VideoMediaHeaderBox(); VideoMediaHeaderBox.Read(reader); } else if (test.Type == BoxTypes.DataInformation) { this.DataInformationBox = new DataInformationBox(); DataInformationBox.Read(reader); } else if (test.Type == BoxTypes.SampleTable) { this.SampleTableBox = new SampleTableBox(this); SampleTableBox.Read(reader); } else if (test.Type == BoxTypes.NullMediaHeader) { this.NullMediaHeaderBox = new NullMediaHeaderBox(); NullMediaHeaderBox.Read(reader); } else { test.Read(reader); Debug.WriteLine(string.Format("Unknown box type {0} in MediaInformationBox (minf)", test.Type.ToString())); } } } }