           @videoTrakBox = child
 
     return
+
+  getTree: ->
+    if not @boxes?
+      throw new Error "parse() must be called before dump"
+    tree = { root: [] }
+    for box in @boxes
+      tree.root.push box.getTree()
+    return tree
 
   dump: ->
     if not @boxes?

        @moovBox = box
      else if box instanceof MediaDataBox
        @mdatBox = box
#      process.stdout.write box.dump 0, 1
      @tree.boxes.push box.getTree()
      @boxes.push box
    if DEBUG
      diffTime = process.hrtime startTime

    @bits = null

  parse: ->
    if DEBUG
      startTime = process.hrtime()
    @boxes = []
