ParsableNalUnitBitArray
@UnstableApi
class ParsableNalUnitBitArray
Wraps a byte array, providing methods that allow it to be read as a NAL unit bitstream.
Whenever the byte sequence [0, 0, 3] appears in the wrapped byte array, it is treated as [0, 0] for all reading/skipping operations, which makes the bitstream appear to be unescaped.
Summary
Public constructors |
|---|
ParsableNalUnitBitArray(data: ByteArray!, offset: Int, limit: Int) |
Public functions |
|
|---|---|
Unit |
Skips bits until at a byte alignment; if already byte aligned, then simply returns. |
Boolean |
canReadBits(numBits: Int)Returns whether it's possible to read |
Boolean |
Returns whether it is possible to read an Exp-Golomb-coded integer starting from the current offset. |
Boolean |
readBit()Reads a single bit. |
Int |
Reads up to 32 bits. |
Int |
Reads an signed Exp-Golomb-coded format integer. |
Int |
Reads an unsigned Exp-Golomb-coded format integer. |
Unit |
Resets the wrapped data, limit and offset. |
Unit |
skipBit()Skips a single bit. |
Unit |
Skips bits and moves current reading position forward. |
Public constructors
Public functions
byteAlign
fun byteAlign(): Unit
Skips bits until at a byte alignment; if already byte aligned, then simply returns.
canReadBits
fun canReadBits(numBits: Int): Boolean
Returns whether it's possible to read n bits starting from the current offset. The offset is not modified.
| Parameters | |
|---|---|
numBits: Int |
The number of bits. |
| Returns | |
|---|---|
Boolean |
Whether it is possible to read |
canReadExpGolombCodedNum
fun canReadExpGolombCodedNum(): Boolean
Returns whether it is possible to read an Exp-Golomb-coded integer starting from the current offset. The offset is not modified.
| Returns | |
|---|---|
Boolean |
Whether it is possible to read an Exp-Golomb-coded integer. |
readBits
fun readBits(numBits: Int): Int
Reads up to 32 bits.
| Parameters | |
|---|---|
numBits: Int |
The number of bits to read. |
| Returns | |
|---|---|
Int |
An integer whose bottom n bits hold the read data. |
readSignedExpGolombCodedInt
fun readSignedExpGolombCodedInt(): Int
Reads an signed Exp-Golomb-coded format integer.
| Returns | |
|---|---|
Int |
The value of the parsed Exp-Golomb-coded integer. |
readUnsignedExpGolombCodedInt
fun readUnsignedExpGolombCodedInt(): Int
Reads an unsigned Exp-Golomb-coded format integer.
| Returns | |
|---|---|
Int |
The value of the parsed Exp-Golomb-coded integer. |