@Override
  public void parse(IsoBufferWrapper in, long size, BoxParser boxParser, Box lastMovieFragmentBox)
      throws IOException {
    super.parse(in, size, boxParser, lastMovieFragmentBox);

    trackId = in.readUInt32();
    long temp = in.readUInt32();
    reserved = (int) (temp >> 6);
    lengthSizeOfTrafNum = (int) (temp & 0x3F) >> 4;
    lengthSizeOfTrunNum = (int) (temp & 0xC) >> 2;
    lengthSizeOfSampleNum = (int) (temp & 0x3);
    long numberOfEntries = in.readUInt32();

    entries = new ArrayList<Entry>();

    for (int i = 0; i < numberOfEntries; i++) {
      Entry entry = new Entry();
      if (getVersion() == 1) {
        entry.time = in.readUInt64();
        entry.moofOffset = in.readUInt64();
      } else {
        entry.time = in.readUInt32();
        entry.moofOffset = in.readUInt32();
      }
      entry.trafNumber = getVariable(lengthSizeOfTrafNum, in);
      entry.trunNumber = getVariable(lengthSizeOfTrunNum, in);
      entry.sampleNumber = getVariable(lengthSizeOfSampleNum, in);

      entries.add(entry);
    }
  }
 @Override
 public void parse(IsoBufferWrapper in, long size, BoxParser boxParser, Box lastMovieFragmentBox)
     throws IOException {
   super.parse(in, size, boxParser, lastMovieFragmentBox);
   maxSamplePerFrame = in.readUInt32();
   unknown1 = in.readUInt8();
   sampleSize = in.readUInt8();
   historyMult = in.readUInt8();
   initialHistory = in.readUInt8();
   kModifier = in.readUInt8();
   channels = in.readUInt8();
   unknown2 = in.readUInt16();
   maxCodedFrameSize = in.readUInt32();
   bitRate = in.readUInt32();
   sampleRate = in.readUInt32();
 }
 @Override
 public void parse(IsoBufferWrapper in, long size, BoxParser boxParser, Box lastMovieFragmentBox)
     throws IOException {
   super.parse(in, size, boxParser, lastMovieFragmentBox);
   dataReferenceType = in.readString(4);
   dataReferenceSize = in.readUInt32();
   dataReference = in.readString((int) dataReferenceSize);
 }
 private long getVariable(long length, IsoBufferWrapper in) throws IOException {
   long ret;
   if (((length + 1) * 8) == 8) {
     ret = in.readUInt8();
   } else if (((length + 1) * 8) == 16) {
     ret = in.readUInt16();
   } else if (((length + 1) * 8) == 24) {
     ret = in.readUInt24();
   } else if (((length + 1) * 8) == 32) {
     ret = in.readUInt32();
   } else if (((length + 1) * 8) == 64) {
     ret = in.readUInt64();
   } else {
     throw new IOException("lengthSize not power of two");
   }
   return ret;
 }
  public IsoBufferWrapper nextNALUnit() throws IOException {
    if (src.remaining() < 5) {
      return null;
    }

    long nalLength;
    if (src.remaining() >= nalLengthSize) {
      // nalLength = src.read(nalLengthSize);
      nalLength = src.readUInt32();
      if (nalLength == 0) return null;

      IsoBufferWrapper segment = src.getSegment(src.position(), nalLength);
      src.position(src.position() + nalLength);
      return segment;
    } else {
      throw new RuntimeException(
          "remaining bytes less than nalLengthSize found in sample. should not be here.");
    }
  }