public void AddHeader(Element elt)
 {
     if (elt.ID.BinaryEquals(Elements.Info)) {
     var s = new MemoryStream(elt.Data);
     while (s.Position<s.Length) {
       var child = Element.ReadHeader(s);
       if (child.ID.BinaryEquals(Elements.TimecodeScale)) {
     this.TimecodeScale = Element.ReadUInt(s, child.Size.Value) * 1.0;
       }
       else {
     child.ReadBody(s);
       }
     }
       }
       HeaderElements.Add(elt);
 }
 public EBML(Element element)
     : this()
 {
     this.Element = element;
       using (var s=new MemoryStream(this.Element.Data)) {
     while (s.Position<s.Length) {
       var elt = Element.ReadHeader(s);
       if (elt.ID.BinaryEquals(Elements.EBMLVersion)) {
     this.Version = (int)Element.ReadUInt(s, elt.Size.Value);
       }
       else if (elt.ID.BinaryEquals(Elements.EBMLReadVersion)) {
     this.ReadVersion = (int)Element.ReadUInt(s, elt.Size.Value);
       }
       else if (elt.ID.BinaryEquals(Elements.EBMLMaxIDLength)) {
     this.MaxIDLength = (int)Element.ReadUInt(s, elt.Size.Value);
       }
       else if (elt.ID.BinaryEquals(Elements.EBMLMaxSizeLength)) {
     this.MaxSizeLength = (int)Element.ReadUInt(s, elt.Size.Value);
       }
       else if (elt.ID.BinaryEquals(Elements.DocType)) {
     this.DocType = Element.ReadString(s, elt.Size.Value);
       }
       else if (elt.ID.BinaryEquals(Elements.DocTypeVersion)) {
     this.DocTypeVersion = (int)Element.ReadUInt(s, elt.Size.Value);
       }
       else if (elt.ID.BinaryEquals(Elements.DocTypeReadVersion)) {
     this.DocTypeReadVersion = (int)Element.ReadUInt(s, elt.Size.Value);
       }
       else {
     elt.ReadBody(s);
       }
     }
       }
 }
 public Segment(Element element)
 {
     this.Element        = element;
       this.HeaderElements = new List<Element>();
       this.TimecodeScale  = 1000000.0;
 }
 public Cluster(Element element)
 {
     this.Element   = element;
       this.BlockSize = 0;
       this.BlockID   = null;
       this.Timecode  = 0.0;
       this.Timespan  = 0.0;
 }