private void createPreStreamingTags(int timestamp,boolean clear){
  log.debug("Creating pre-streaming tags");
  if (clear) {
    firstTags.clear();
  }
  ITag tag=null;
  IoBuffer body=null;
  if (hasVideo) {
    body=IoBuffer.allocate(41);
    body.setAutoExpand(true);
    body.put(PREFIX_VIDEO_CONFIG_FRAME);
    if (videoDecoderBytes != null) {
      body.put(videoDecoderBytes);
    }
    tag=new Tag(IoConstants.TYPE_VIDEO,timestamp,body.position(),null,0);
    body.flip();
    tag.setBody(body);
    firstTags.add(tag);
  }
  if (hasAudio) {
    body=IoBuffer.allocate(7);
    body.setAutoExpand(true);
    body.put(new byte[]{(byte)0xaf,(byte)0});
    if (audioDecoderBytes != null) {
      body.put(audioDecoderBytes);
    }
 else {
      body.put(AUDIO_CONFIG_FRAME_AAC_LC);
    }
    body.put((byte)0x06);
    tag=new Tag(IoConstants.TYPE_AUDIO,timestamp,body.position(),null,tag.getBodySize());
    body.flip();
    tag.setBody(body);
    firstTags.add(tag);
  }
}

private void createPreStreamingTags ( int timestamp , boolean clear ) { log . debug ( "Creating pre-streaming tags" ) ; if ( clear ) { firstTags . clear ( ) ; } ITag tag = null ; IoBuffer body = null ; if ( hasVideo ) { body = IoBuffer . allocate ( 41 ) ; body . setAutoExpand ( true ) ; body . put ( PREFIX_VIDEO_CONFIG_FRAME ) ; if ( videoDecoderBytes != null ) { body . put ( videoDecoderBytes ) ; } tag = new Tag ( IoConstants . TYPE_VIDEO , timestamp , body . position ( ) , null , 0 ) ; body . flip ( ) ; tag . setBody ( body ) ; firstTags . add ( tag ) ; } if ( hasAudio ) { body = IoBuffer . allocate ( 7 ) ; body . setAutoExpand ( true ) ; body . put ( new byte [ ] { ( byte ) 0xaf , ( byte ) 0 } ) ; if ( audioDecoderBytes != null ) { body . put ( audioDecoderBytes ) ; } else { body . put ( AUDIO_CONFIG_FRAME_AAC_LC ) ; } body . put ( ( byte ) 0x06 ) ; tag = new Tag ( IoConstants . TYPE_AUDIO , timestamp , body . position ( ) , null , tag . getBodySize ( ) ) ; body . flip ( ) ; tag . setBody ( body ) ; firstTags . add ( tag ) ; } }
tag sequence metadata , video config , audio config , remaining audio and video packet prefixes : 17 00 00 00 00 = video extra data ( first video packet ) 17 01 00 00 00 = video keyframe 27 01 00 00 00 = video interframe af 00 . . . 06 = audio extra data ( first audio packet ) af 01 = audio frame audio extra data ( s ) : af 00 = prefix 11 90 4f 14 = aac main = aottype 0 12 10 = aac lc = aottype 1 13 90 56 e5 a5 48 00 = he - aac sbr = aottype 2 06 = suffix still not absolutely certain about this order or the bytes - need to verify later
