     #       elst <- self
     mvhdBox = @findParent('moov').find('mvhd')
 
+    # We cannot get mdhd box at this time, since it is not parsed yet
+
     entryCount = bits.read_uint32()
     @entries = []
     for i in [1..entryCount]

  getDetails: (detailLevel) ->
    str = "entryCount=#{@entryCount}"
    if detailLevel >= 2
      str += ' ' + @entries.map((entry) ->
        "sampleCount=#{entry.sampleCount} sampleDelta=#{entry.sampleDelta}"
      ).join(',')
    return str


      if mediaRateFraction isnt 0
        logger.warn "[mp4] warning: media_rate_fraction is not 0 in elst box: #{mediaRateFraction}"
      @entries.push
        segmentDuration: segmentDuration  # in Movie Header Box (mvhd) timescale
        segmentDurationSeconds: segmentDuration / mvhdBox.timescale
        mediaTime: mediaTime  # in media (mdhd) timescale
        mediaRate: mediaRateInteger + mediaRateFraction / 65536 # TODO: Is this correct?

    if bits.has_more_data()
      throw new Error "elst box has more data"

  # Returns the starting offset for this track in mdhd timescale units
  getEmptyDuration: ->
    time = 0
    for entry in @entries
      if entry.mediaTime is -1  # empty edit
        # moov
        #   mvhd <- find target
        #   iods
        #   trak
        #     tkhd
        #     edts
        #       elst <- self
        mvhdBox = @findParent('moov').child('mvhd')

        #   trak
        #     tkhd
        #     edts
        #       elst <- self
        #     mdia
        #       mdhd <- find target
        mdhdBox = @findParent('trak').child('mdia').child('mdhd')
        if not mdhdBox?
          throw new Error "cannot access mdhd box (not parsed yet?)"

        # Convert segmentDuration from mvhd timescale to mdhd timescale
        time += entry.segmentDuration * mdhdBox.timescale / mvhdBox.timescale
      else
        # mediaTime is already in mdhd timescale, so no conversion needed
        return time + entry.mediaTime

  getDetails: (detailLevel) ->
    @entries.map((entry, index) ->
      "[#{index}]:segmentDuration=#{entry.segmentDuration},segmentDurationSeconds=#{entry.segmentDurationSeconds},mediaTime=#{entry.mediaTime},mediaRate=#{entry.mediaRate}"
    ).join(',')

  getTree: ->
