GstBase.BitWriter

Fields

Name

Type

Access

Description

auto_grow

bool

r

bit_capacity

int

r

bit_size

int

r/w

Size of written data in bits

data

int

r/w

Allocated data for bit writer to write

owned

bool

r

Methods

align_bytes (trailing_bit)

free ()

free_and_get_buffer ()

free_and_get_data ()

get_data ()

get_remaining ()

get_size ()

put_bits_uint16 (value, nbits)

put_bits_uint32 (value, nbits)

put_bits_uint64 (value, nbits)

put_bits_uint8 (value, nbits)

put_bytes (data, nbytes)

reset ()

reset_and_get_buffer ()

reset_and_get_data ()

set_pos (pos)

Details

class GstBase.BitWriter

GstBase.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.

New in version 1.16.

align_bytes(trailing_bit)
Parameters:

trailing_bit (int) – trailing bits of last byte, 0 or 1

Returns:

True if successful, False otherwise.

Return type:

bool

Write trailing bit to align last byte of data. trailing_bit can only be 1 or 0.

free()

Frees self and the allocated data inside.

free_and_get_buffer()
Returns:

a new allocated Gst.Buffer wrapping the data inside. gst_buffer_unref() after usage.

Return type:

Gst.Buffer

Frees self without destroying the internal data, which is returned as Gst.Buffer.

Free-function: gst_buffer_unref

free_and_get_data()
Returns:

the current data. GLib.free() after usage.

Return type:

bytes

Frees self without destroying the internal data, which is returned.

Free-function: GLib.free

get_data()
Returns:

data pointer

Return type:

bytes

Get written data pointer

get_remaining()
Return type:

int

get_size()
Returns:

size of bits written in data

Return type:

int

Get size of written data

put_bits_uint16(value, nbits)
Parameters:
  • value (int) – value of #guint16 to write

  • nbits (int) – number of bits to write

Returns:

True if successful, False otherwise.

Return type:

bool

Write nbits bits of value to GstBase.BitWriter.

put_bits_uint32(value, nbits)
Parameters:
  • value (int) – value of #guint32 to write

  • nbits (int) – number of bits to write

Returns:

True if successful, False otherwise.

Return type:

bool

Write nbits bits of value to GstBase.BitWriter.

put_bits_uint64(value, nbits)
Parameters:
  • value (int) – value of #guint64 to write

  • nbits (int) – number of bits to write

Returns:

True if successful, False otherwise.

Return type:

bool

Write nbits bits of value to GstBase.BitWriter.

put_bits_uint8(value, nbits)
Parameters:
  • value (int) – value of #guint8 to write

  • nbits (int) – number of bits to write

Returns:

True if successful, False otherwise.

Return type:

bool

Write nbits bits of value to GstBase.BitWriter.

put_bytes(data, nbytes)
Parameters:
  • data (bytes) – pointer of data to write

  • nbytes (int) – number of bytes to write

Returns:

True if successful, False otherwise.

Return type:

bool

Write nbytes bytes of data to GstBase.BitWriter.

reset()

Resets self and frees the data if it’s owned by self.

reset_and_get_buffer()
Returns:

a new allocated Gst.Buffer wrapping the current data. gst_buffer_unref() after usage.

Return type:

Gst.Buffer

Resets self and returns the current data as Gst.Buffer.

Free-function: gst_buffer_unref

reset_and_get_data()
Returns:

the current data. GLib.free() after usage.

Return type:

bytes

Resets self and returns the current data.

Free-function: GLib.free

set_pos(pos)
Parameters:

pos (int) –

Return type:

bool