:right-sidebar: True BitReader =================================================================== .. currentmodule:: gi.repository.GstBase .. class:: BitReader(*args, **kwargs) :no-contents-entry: :obj:`~gi.repository.GstBase.BitReader` provides a bit reader that can read any number of bits from a memory buffer. It provides functions for reading any number of bits into 8, 16, 32 and 64 bit variables. Methods ------- .. rst-class:: interim-class .. class:: BitReader :no-index: .. method:: free() -> None Frees a :obj:`~gi.repository.GstBase.BitReader` instance, which was previously allocated by :func:`~gi.repository.GstBase.BitReader.new`. .. method:: get_bits_uint16(nbits: int) -> ~typing.Tuple[bool, int] Read ``nbits`` bits into ``val`` and update the current position. :param nbits: number of bits to read .. method:: get_bits_uint32(nbits: int) -> ~typing.Tuple[bool, int] Read ``nbits`` bits into ``val`` and update the current position. :param nbits: number of bits to read .. method:: get_bits_uint64(nbits: int) -> ~typing.Tuple[bool, int] Read ``nbits`` bits into ``val`` and update the current position. :param nbits: number of bits to read .. method:: get_bits_uint8(nbits: int) -> ~typing.Tuple[bool, int] Read ``nbits`` bits into ``val`` and update the current position. :param nbits: number of bits to read .. method:: get_pos() -> int Returns the current position of a :obj:`~gi.repository.GstBase.BitReader` instance in bits. .. method:: get_remaining() -> int Returns the remaining number of bits of a :obj:`~gi.repository.GstBase.BitReader` instance. .. method:: get_size() -> int Returns the total number of bits of a :obj:`~gi.repository.GstBase.BitReader` instance. .. method:: init(data: list[int]) -> None Initializes a :obj:`~gi.repository.GstBase.BitReader` instance to read from ``data``\. This function can be called on already initialized instances. :param data: data from which the bit reader should read .. method:: peek_bits_uint16(nbits: int) -> ~typing.Tuple[bool, int] Read ``nbits`` bits into ``val`` but keep the current position. :param nbits: number of bits to read .. method:: peek_bits_uint32(nbits: int) -> ~typing.Tuple[bool, int] Read ``nbits`` bits into ``val`` but keep the current position. :param nbits: number of bits to read .. method:: peek_bits_uint64(nbits: int) -> ~typing.Tuple[bool, int] Read ``nbits`` bits into ``val`` but keep the current position. :param nbits: number of bits to read .. method:: peek_bits_uint8(nbits: int) -> ~typing.Tuple[bool, int] Read ``nbits`` bits into ``val`` but keep the current position. :param nbits: number of bits to read .. method:: set_pos(pos: int) -> bool Sets the new position of a :obj:`~gi.repository.GstBase.BitReader` instance to ``pos`` in bits. :param pos: The new position in bits .. method:: skip(nbits: int) -> bool Skips ``nbits`` bits of the :obj:`~gi.repository.GstBase.BitReader` instance. :param nbits: the number of bits to skip .. method:: skip_to_byte() -> bool Skips until the next byte. Fields ------ .. rst-class:: interim-class .. class:: BitReader :no-index: .. attribute:: bit Bit position in the current byte .. attribute:: byte Current byte position .. attribute:: data Data from which the bit reader will read .. attribute:: size Size of ``data`` in bytes