       process.stdout.write box.dump 0, 2
     return
 
+  hasVideo: ->
+    return @videoTrakBox?
+
+  hasAudio: ->
+    return @audioTrakBox?
+
   getSPS: ->
     avcCBox = @videoTrakBox.find 'avcC'
     return avcCBox.sequenceParameterSets[0]

      logger.debug "[mp4:#{@filename}] already paused"

  sendVideoPacketsSinceLastKeyFrame: (endSeconds, callback) ->
    # Get next sample number
    stblBox = @videoTrakBox.child('mdia').child('minf').child('stbl')
    sttsBox = stblBox.child('stts') # TimeToSampleBox

    callback?()

  getNumVideoSamples: ->
    if @videoTrakBox?
      sttsBox = @videoTrakBox.find 'stts'
      return sttsBox.getTotalSamples()
    else
      return 0

  getNumAudioSamples: ->
    if @audioTrakBox?
      sttsBox = @audioTrakBox.find 'stts'
      return sttsBox.getTotalSamples()
    else
      return 0

  # Returns the timestamp of the last sample in the file
  getLastTimestamp: ->
    if @videoTrakBox?
      numVideoSamples = @getNumVideoSamples()
      sttsBox = @videoTrakBox.find 'stts'
      videoLastTimestamp = sttsBox.getDecodingTime(numVideoSamples).seconds
    else
      videoLastTimestamp = 0

    if @audioTrakBox?
      numAudioSamples = @getNumAudioSamples()
      sttsBox = @audioTrakBox.find 'stts'
      audioLastTimestamp = sttsBox.getDecodingTime(numAudioSamples).seconds
    else
      audioLastTimestamp = 0

    if audioLastTimestamp > videoLastTimestamp
      return audioLastTimestamp
