public Mp4EsdsBox(Mp4BoxHeader header,ByteBuffer dataBuffer){
  this.header=header;
  int sectionThreeLength;
  int sectionFourLength;
  int sectionFiveLength;
  int sectionSixLength;
  dataBuffer.position(dataBuffer.position() + VERSION_FLAG_LENGTH + OTHER_FLAG_LENGTH);
  if (dataBuffer.get() == SECTION_THREE) {
    sectionThreeLength=processSectionHeader(dataBuffer);
    dataBuffer.position(dataBuffer.position() + ES_ID_LENGTH + STREAM_PRIORITY_LENGTH);
  }
  if (dataBuffer.get() == SECTION_FOUR) {
    sectionFourLength=processSectionHeader(dataBuffer);
    kind=kindMap.get((int)dataBuffer.get());
    dataBuffer.position(dataBuffer.position() + STREAM_TYPE_LENGTH + BUFFER_SIZE_LENGTH);
    this.maxBitrate=Utils.getIntBE(dataBuffer,dataBuffer.position(),(dataBuffer.position() + MAX_BITRATE_LENGTH - 1));
    dataBuffer.position(dataBuffer.position() + MAX_BITRATE_LENGTH);
    this.avgBitrate=Utils.getIntBE(dataBuffer,dataBuffer.position(),(dataBuffer.position() + AVERAGE_BITRATE_LENGTH - 1));
    dataBuffer.position(dataBuffer.position() + AVERAGE_BITRATE_LENGTH);
  }
  if (dataBuffer.get() == SECTION_FIVE) {
    sectionFiveLength=processSectionHeader(dataBuffer);
    audioProfile=audioProfileMap.get((dataBuffer.get() >> 3));
    byte channelByte=dataBuffer.get();
    numberOfChannels=(channelByte << 1) >> 4;
  }
}

public Mp4EsdsBox ( Mp4BoxHeader header , ByteBuffer dataBuffer ) { this . header = header ; int sectionThreeLength ; int sectionFourLength ; int sectionFiveLength ; int sectionSixLength ; dataBuffer . position ( dataBuffer . position ( ) + VERSION_FLAG_LENGTH + OTHER_FLAG_LENGTH ) ; if ( dataBuffer . get ( ) == SECTION_THREE ) { sectionThreeLength = processSectionHeader ( dataBuffer ) ; dataBuffer . position ( dataBuffer . position ( ) + ES_ID_LENGTH + STREAM_PRIORITY_LENGTH ) ; } if ( dataBuffer . get ( ) == SECTION_FOUR ) { sectionFourLength = processSectionHeader ( dataBuffer ) ; kind = kindMap . get ( ( int ) dataBuffer . get ( ) ) ; dataBuffer . position ( dataBuffer . position ( ) + STREAM_TYPE_LENGTH + BUFFER_SIZE_LENGTH ) ; this . maxBitrate = Utils . getIntBE ( dataBuffer , dataBuffer . position ( ) , ( dataBuffer . position ( ) + MAX_BITRATE_LENGTH - 1 ) ) ; dataBuffer . position ( dataBuffer . position ( ) + MAX_BITRATE_LENGTH ) ; this . avgBitrate = Utils . getIntBE ( dataBuffer , dataBuffer . position ( ) , ( dataBuffer . position ( ) + AVERAGE_BITRATE_LENGTH - 1 ) ) ; dataBuffer . position ( dataBuffer . position ( ) + AVERAGE_BITRATE_LENGTH ) ; } if ( dataBuffer . get ( ) == SECTION_FIVE ) { sectionFiveLength = processSectionHeader ( dataBuffer ) ; audioProfile = audioProfileMap . get ( ( dataBuffer . get ( ) > > 3 ) ) ; byte channelByte = dataBuffer . get ( ) ; numberOfChannels = ( channelByte << 1 ) > > 4 ; } }
databuffer must start from from the start of the body
