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 ) { //video tag #1 body = IoBuffer . allocate ( 41 ) ; body . setAutoExpand ( true ) ; body . put ( PREFIX_VIDEO_CONFIG_FRAME ) ; //prefix if ( videoDecoderBytes != null ) { //because of other processing we do this check if ( log . isDebugEnabled ( ) ) { log . debug ( "Video decoder bytes: {}" , HexDump . byteArrayToHexString ( videoDecoderBytes ) ) ; } body . put ( videoDecoderBytes ) ; } tag = new Tag ( IoConstants . TYPE_VIDEO , timestamp , body . position ( ) , null , 0 ) ; body . flip ( ) ; tag . setBody ( body ) ; //add tag firstTags . add ( tag ) ; } // TODO: Handle other mp4 container audio codecs like mp3 // mp3 header magic number ((int & 0xffe00000) == 0xffe00000) if ( hasAudio ) { //audio tag #1 if ( audioDecoderBytes != null ) { //because of other processing we do this check if ( log . isDebugEnabled ( ) ) { log . debug ( "Audio decoder bytes: {}" , HexDump . byteArrayToHexString ( audioDecoderBytes ) ) ; } body = IoBuffer . allocate ( audioDecoderBytes . length + 3 ) ; body . setAutoExpand ( true ) ; body . put ( PREFIX_AUDIO_CONFIG_FRAME ) ; //prefix body . put ( audioDecoderBytes ) ; body . put ( ( byte ) 0x06 ) ; //suffix tag = new Tag ( IoConstants . TYPE_AUDIO , timestamp , body . position ( ) , null , 0 ) ; body . flip ( ) ; tag . setBody ( body ) ; //add tag firstTags . add ( tag ) ; } else { log . info ( "Audio decoder bytes were not available" ) ; } } }
Tag sequence MetaData Video config Audio config remaining audio and video