BitWriter
Added in version 1.16.
- class BitWriter(*args, **kwargs)
BitWriter
provides a bit writer that can write any number of
bits into a memory buffer. It provides functions for writing any
number of bits into 8, 16, 32 and 64 bit variables.
Methods
- class BitWriter
- align_bytes(trailing_bit: int) bool
Write trailing bit to align last byte of
data
.trailing_bit
can only be 1 or 0.- Parameters:
trailing_bit – trailing bits of last byte, 0 or 1
- free_and_get_buffer() Buffer
Frees
bitwriter
without destroying the internal data, which is returned asBuffer
.Free-function: gst_buffer_unref
- free_and_get_data() bytes
Frees
bitwriter
without destroying the internal data, which is returned.Free-function: g_free
- put_bits_uint16(value: int, nbits: int) bool
Write
nbits
bits ofvalue
toBitWriter
.- Parameters:
value – value of
guint16
to writenbits – number of bits to write
- put_bits_uint32(value: int, nbits: int) bool
Write
nbits
bits ofvalue
toBitWriter
.- Parameters:
value – value of
guint32
to writenbits – number of bits to write
- put_bits_uint64(value: int, nbits: int) bool
Write
nbits
bits ofvalue
toBitWriter
.- Parameters:
value – value of
guint64
to writenbits – number of bits to write
- put_bits_uint8(value: int, nbits: int) bool
Write
nbits
bits ofvalue
toBitWriter
.- Parameters:
value – value of
guint8
to writenbits – number of bits to write
- put_bytes(data: Sequence[int], nbytes: int) bool
Write
nbytes
bytes ofdata
toBitWriter
.- Parameters:
data – pointer of data to write
nbytes – number of bytes to write