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() list[int] #
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
int
to writenbits – number of bits to write
- put_bits_uint32(value: int, nbits: int) bool #
Write
nbits
bits ofvalue
toBitWriter
.- Parameters:
value – value of
int
to writenbits – number of bits to write
- put_bits_uint64(value: int, nbits: int) bool #
Write
nbits
bits ofvalue
toBitWriter
.- Parameters:
value – value of
int
to writenbits – number of bits to write
- put_bits_uint8(value: int, nbits: int) bool #
Write
nbits
bits ofvalue
toBitWriter
.- Parameters:
value – value of
int
to writenbits – number of bits to write
- put_bytes(data: list[int], nbytes: int) bool #
Write
nbytes
bytes ofdata
toBitWriter
.- Parameters:
data – pointer of data to write
nbytes – number of bytes to write
- reset_and_get_buffer() Buffer #
Resets
bitwriter
and returns the current data asBuffer
.Free-function: gst_buffer_unref