GstBase.BitReader

Fields

Name

Type

Access

Description

bit

int

r/w

Bit position in the current byte

byte

int

r/w

Current byte position

data

bytes

r/w

Data from which the bit reader will read

size

int

r/w

Size of data in bytes

Methods

free ()

get_bits_uint16 (nbits)

get_bits_uint32 (nbits)

get_bits_uint64 (nbits)

get_bits_uint8 (nbits)

get_pos ()

get_remaining ()

get_size ()

init (data)

peek_bits_uint16 (nbits)

peek_bits_uint32 (nbits)

peek_bits_uint64 (nbits)

peek_bits_uint8 (nbits)

set_pos (pos)

skip (nbits)

skip_to_byte ()

Details

class GstBase.BitReader

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.

free()[source]

Frees a GstBase.BitReader instance, which was previously allocated by gst_bit_reader_new().

get_bits_uint16(nbits)[source]
Parameters:

nbits (int) – number of bits to read

Returns:

True if successful, False otherwise.

val:

Pointer to a #guint16 to store the result

Return type:

(bool, val: int)

Read nbits bits into val and update the current position.

get_bits_uint32(nbits)[source]
Parameters:

nbits (int) – number of bits to read

Returns:

True if successful, False otherwise.

val:

Pointer to a #guint32 to store the result

Return type:

(bool, val: int)

Read nbits bits into val and update the current position.

get_bits_uint64(nbits)[source]
Parameters:

nbits (int) – number of bits to read

Returns:

True if successful, False otherwise.

val:

Pointer to a #guint64 to store the result

Return type:

(bool, val: int)

Read nbits bits into val and update the current position.

get_bits_uint8(nbits)[source]
Parameters:

nbits (int) – number of bits to read

Returns:

True if successful, False otherwise.

val:

Pointer to a #guint8 to store the result

Return type:

(bool, val: int)

Read nbits bits into val and update the current position.

get_pos()[source]
Returns:

The current position of self in bits.

Return type:

int

Returns the current position of a GstBase.BitReader instance in bits.

get_remaining()[source]
Returns:

The remaining number of bits of self instance.

Return type:

int

Returns the remaining number of bits of a GstBase.BitReader instance.

get_size()[source]
Returns:

The total number of bits of self instance.

Return type:

int

Returns the total number of bits of a GstBase.BitReader instance.

init(data)[source]
Parameters:

data (bytes) – data from which the bit reader should read

Initializes a GstBase.BitReader instance to read from data. This function can be called on already initialized instances.

peek_bits_uint16(nbits)[source]
Parameters:

nbits (int) – number of bits to read

Returns:

True if successful, False otherwise.

val:

Pointer to a #guint16 to store the result

Return type:

(bool, val: int)

Read nbits bits into val but keep the current position.

peek_bits_uint32(nbits)[source]
Parameters:

nbits (int) – number of bits to read

Returns:

True if successful, False otherwise.

val:

Pointer to a #guint32 to store the result

Return type:

(bool, val: int)

Read nbits bits into val but keep the current position.

peek_bits_uint64(nbits)[source]
Parameters:

nbits (int) – number of bits to read

Returns:

True if successful, False otherwise.

val:

Pointer to a #guint64 to store the result

Return type:

(bool, val: int)

Read nbits bits into val but keep the current position.

peek_bits_uint8(nbits)[source]
Parameters:

nbits (int) – number of bits to read

Returns:

True if successful, False otherwise.

val:

Pointer to a #guint8 to store the result

Return type:

(bool, val: int)

Read nbits bits into val but keep the current position.

set_pos(pos)[source]
Parameters:

pos (int) – The new position in bits

Returns:

True if the position could be set successfully, False otherwise.

Return type:

bool

Sets the new position of a GstBase.BitReader instance to pos in bits.

skip(nbits)[source]
Parameters:

nbits (int) – the number of bits to skip

Returns:

True if nbits bits could be skipped, False otherwise.

Return type:

bool

Skips nbits bits of the GstBase.BitReader instance.

skip_to_byte()[source]
Returns:

True if successful, False otherwise.

Return type:

bool

Skips until the next byte.