Shaka Packager SDK
|
A class to read bit streams. More...
#include <bit_reader.h>
Public Member Functions | |
BitReader (const uint8_t *data, size_t size) | |
template<typename T > | |
bool | ReadBits (size_t num_bits, T *out) |
bool | ReadBits (size_t num_bits, bool *out) |
bool | SkipBits (size_t num_bits) |
bool | SkipBitsConditional (bool condition, size_t num_bits) |
void | SkipToNextByte () |
bool | SkipBytes (size_t num_bytes) |
size_t | bits_available () const |
size_t | bit_position () const |
A class to read bit streams.
Definition at line 17 of file bit_reader.h.
shaka::media::BitReader::BitReader | ( | const uint8_t * | data, |
size_t | size | ||
) |
Initialize the BitReader object to read a data buffer.
data | points to the beginning of the buffer. |
size | is the buffer size in bytes. |
Definition at line 12 of file bit_reader.cc.
|
inline |
Definition at line 94 of file bit_reader.h.
|
inline |
Definition at line 89 of file bit_reader.h.
|
inline |
Read a number of bits from stream.
num_bits | specifies the number of bits to read. It cannot be larger than the number of bits the type can hold. | |
[out] | out | stores the output. The type T has to be a primitive integer type. |
Definition at line 35 of file bit_reader.h.
bool shaka::media::BitReader::SkipBits | ( | size_t | num_bits | ) |
Skip a number of bits from stream.
num_bits | specifies the number of bits to be skipped. |
Definition at line 24 of file bit_reader.cc.
|
inline |
Read one bit then skip the number of bits specified if that bit matches condition.
condition | indicates when the number of bits should be skipped. |
num_bits | specifies the number of bits to be skipped. |
Definition at line 69 of file bit_reader.h.
bool shaka::media::BitReader::SkipBytes | ( | size_t | num_bytes | ) |
Skip a number of bytes from stream. The current posision should be byte aligned, otherwise a false is returned and bytes are not skipped.
num_bytes | specifies the number of bytes to be skipped. |
Definition at line 63 of file bit_reader.cc.
void shaka::media::BitReader::SkipToNextByte | ( | ) |
Skip a number of bits so the stream is byte aligned to the initial data. There could be 0 to 7 bits skipped.
Definition at line 54 of file bit_reader.cc.