Shaka Packager SDK
Public Member Functions | List of all members
shaka::media::BitWriter Class Reference

Public Member Functions

 BitWriter (std::vector< uint8_t > *storage)
 
void WriteBits (uint32_t bits, size_t number_of_bits)
 
void Flush ()
 Write pending bits, and align bitstream with extra zero bits.
 
size_t BitPos () const
 
size_t BytePos () const
 

Detailed Description

Definition at line 18 of file bit_writer.h.

Constructor & Destructor Documentation

◆ BitWriter()

shaka::media::BitWriter::BitWriter ( std::vector< uint8_t > *  storage)
explicit

Constructor a BitWriter instance which writes to the provided storage.

Parameters
storagepoints to vector this BitWriter writes to. Cannot be nullptr.

Definition at line 14 of file bit_writer.cc.

Member Function Documentation

◆ BitPos()

size_t shaka::media::BitWriter::BitPos ( ) const
inline
Returns
last written position, in bits.

Definition at line 38 of file bit_writer.h.

◆ BytePos()

size_t shaka::media::BitWriter::BytePos ( ) const
inline
Returns
last written position, in bytes.

Definition at line 41 of file bit_writer.h.

◆ WriteBits()

void shaka::media::BitWriter::WriteBits ( uint32_t  bits,
size_t  number_of_bits 
)

Appends the sequence 'bits' of length 'number_of_bits' <= 32. Note that 'bits' should contain at most 'number_of_bits' bits, i.e. bits should be less than 1 << number_of_bits.

Parameters
bitsis the data to write.
number_of_bitsis the number of LSB to write, capped at 32. Cannot be zero.

Definition at line 17 of file bit_writer.cc.


The documentation for this class was generated from the following files: