INNER CODE UNIT · Kotlin
bufferPosition
pedroSG94/RootEncoder · common/src/main/java/com/pedro/common/BitBuffer.kt:84
bufferPosition = buffer.position() * Byte.SIZE_BITS
}
companion object {
fun extractRbsp(buffer: ByteBuffer, headerLength: Int): ByteBuffer {
val rbsp = ByteBuffer.allocateDirect(buffer.remaining())
val indices = buffer.indicesOf(byteArrayOf(0x00, 0x00, 0x03))
rbsp.put(buffer, 0, headerLength)
var previous = headerLength
indices.forEach {
rbsp.put(buffer, previous, it + 2 - previous)
previous = it + 3 // skip emulation_prevention_three_byte
}
rbsp.put(buffer, previous, buffer.limit() - previous)