public static ByteBuffer joinNALUnits ( List < ByteBuffer > nalUnits ) { int size = 0 ; for ( ByteBuffer nal : nalUnits ) { size += 4 + nal . remaining ( ) ; } ByteBuffer allocate = ByteBuffer . allocate ( size ) ; joinNALUnitsToBuffer ( nalUnits , allocate ) ; return allocate ; }
Joins buffers containing individual NAL units into a single AnnexB delimited buffer . Each NAL unit will be separated with 00 00 00 01 markers . Allocates a new byte buffer and writes data into it .