GstBitWriter

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

GstBitWriter

A bit writer instance.

Members

data (guint8 *) –

Allocated data for bit writer to write

bit_size (guint) –

Size of written data in bits

Since : 1.16


GstBase.BitWriter

A bit writer instance.

Members

data (Number) –

Allocated data for bit writer to write

bit_size (Number) –

Size of written data in bits

Since : 1.16


GstBase.BitWriter

A bit writer instance.

Members

data (int) –

Allocated data for bit writer to write

bit_size (int) –

Size of written data in bits

Since : 1.16


Methods

gst_bit_writer_align_bytes

gboolean
gst_bit_writer_align_bytes (GstBitWriter * bitwriter,
                            guint8 trailing_bit)

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

Parameters:

bitwriter

a GstBitWriter instance

trailing_bit

trailing bits of last byte, 0 or 1

Returns

TRUE if successful, FALSE otherwise.


GstBase.BitWriter.prototype.align_bytes

function GstBase.BitWriter.prototype.align_bytes(trailing_bit: Number): {
    // javascript wrapper for 'gst_bit_writer_align_bytes'
}

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

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

trailing_bit (Number)

trailing bits of last byte, 0 or 1

Returns (Number)

true if successful, false otherwise.


GstBase.BitWriter.align_bytes

def GstBase.BitWriter.align_bytes (self, trailing_bit):
    #python wrapper for 'gst_bit_writer_align_bytes'

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

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

trailing_bit (int)

trailing bits of last byte, 0 or 1

Returns (bool)

True if successful, False otherwise.


gst_bit_writer_free

gst_bit_writer_free (GstBitWriter * bitwriter)

Frees bitwriter and the allocated data inside.

Parameters:

bitwriter ( [in][transfer: full])

GstBitWriter instance


GstBase.BitWriter.prototype.free

function GstBase.BitWriter.prototype.free(): {
    // javascript wrapper for 'gst_bit_writer_free'
}

Frees bitwriter and the allocated data inside.

Parameters:

bitwriter (GstBase.BitWriter)

GstBase.BitWriter instance


GstBase.BitWriter.free

def GstBase.BitWriter.free (self):
    #python wrapper for 'gst_bit_writer_free'

Frees bitwriter and the allocated data inside.

Parameters:

bitwriter (GstBase.BitWriter)

GstBase.BitWriter instance


gst_bit_writer_free_and_get_buffer

GstBuffer *
gst_bit_writer_free_and_get_buffer (GstBitWriter * bitwriter)

Frees bitwriter without destroying the internal data, which is returned as GstBuffer.

Free-function: gst_buffer_unref

Parameters:

bitwriter ( [in][transfer: full])

GstBitWriter instance

Returns ( [transfer: full])

a new allocated GstBuffer wrapping the data inside. gst_buffer_unref after usage.


GstBase.BitWriter.prototype.free_and_get_buffer

function GstBase.BitWriter.prototype.free_and_get_buffer(): {
    // javascript wrapper for 'gst_bit_writer_free_and_get_buffer'
}

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

Free-function: gst_buffer_unref

Parameters:

bitwriter (GstBase.BitWriter)

GstBase.BitWriter instance

Returns (Gst.Buffer)

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


GstBase.BitWriter.free_and_get_buffer

def GstBase.BitWriter.free_and_get_buffer (self):
    #python wrapper for 'gst_bit_writer_free_and_get_buffer'

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

Free-function: gst_buffer_unref

Parameters:

bitwriter (GstBase.BitWriter)

GstBase.BitWriter instance

Returns (Gst.Buffer)

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


gst_bit_writer_free_and_get_data

guint8 *
gst_bit_writer_free_and_get_data (GstBitWriter * bitwriter)

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

Free-function: g_free

Parameters:

bitwriter ( [in][transfer: full])

GstBitWriter instance

Returns ( [array][transfer: full])

the current data. g_free after usage.


GstBase.BitWriter.prototype.free_and_get_data

function GstBase.BitWriter.prototype.free_and_get_data(): {
    // javascript wrapper for 'gst_bit_writer_free_and_get_data'
}

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

Free-function: g_free

Parameters:

bitwriter (GstBase.BitWriter)

GstBase.BitWriter instance

Returns ([ Number ])

the current data. GLib.prototype.free after usage.


GstBase.BitWriter.free_and_get_data

def GstBase.BitWriter.free_and_get_data (self):
    #python wrapper for 'gst_bit_writer_free_and_get_data'

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

Free-function: g_free

Parameters:

bitwriter (GstBase.BitWriter)

GstBase.BitWriter instance

Returns ([ int ])

the current data. GLib.free after usage.


gst_bit_writer_get_data

guint8 *
gst_bit_writer_get_data (const GstBitWriter * bitwriter)

Get written data pointer

Parameters:

bitwriter

a GstBitWriter instance

Returns ( [array][transfer: none])

data pointer


GstBase.BitWriter.prototype.get_data

function GstBase.BitWriter.prototype.get_data(): {
    // javascript wrapper for 'gst_bit_writer_get_data'
}

Get written data pointer

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

Returns ([ Number ])

data pointer


GstBase.BitWriter.get_data

def GstBase.BitWriter.get_data (self):
    #python wrapper for 'gst_bit_writer_get_data'

Get written data pointer

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

Returns ([ int ])

data pointer


gst_bit_writer_get_remaining

guint
gst_bit_writer_get_remaining (const GstBitWriter * bitwriter)

Parameters:

bitwriter
No description available
Returns
No description available

GstBase.BitWriter.prototype.get_remaining

function GstBase.BitWriter.prototype.get_remaining(): {
    // javascript wrapper for 'gst_bit_writer_get_remaining'
}

Parameters:

bitwriter (GstBase.BitWriter)
No description available
Returns (Number)
No description available

GstBase.BitWriter.get_remaining

def GstBase.BitWriter.get_remaining (self):
    #python wrapper for 'gst_bit_writer_get_remaining'

Parameters:

bitwriter (GstBase.BitWriter)
No description available
Returns (int)
No description available

gst_bit_writer_get_size

guint
gst_bit_writer_get_size (const GstBitWriter * bitwriter)

Get size of written data

Parameters:

bitwriter

a GstBitWriter instance

Returns

size of bits written in data


GstBase.BitWriter.prototype.get_size

function GstBase.BitWriter.prototype.get_size(): {
    // javascript wrapper for 'gst_bit_writer_get_size'
}

Get size of written data

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

Returns (Number)

size of bits written in data


GstBase.BitWriter.get_size

def GstBase.BitWriter.get_size (self):
    #python wrapper for 'gst_bit_writer_get_size'

Get size of written data

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

Returns (int)

size of bits written in data


gst_bit_writer_init

gst_bit_writer_init (GstBitWriter * bitwriter)

Initializes bitwriter to an empty instance.

Parameters:

bitwriter

GstBitWriter instance


gst_bit_writer_init_with_data

gst_bit_writer_init_with_data (GstBitWriter * bitwriter,
                               guint8 * data,
                               guint size,
                               gboolean initialized)

Initializes bitwriter with the given memory area data. IF initialized is TRUE it is possible to read size bits from the GstBitWriter from the beginning.

Parameters:

bitwriter

GstBitWriter instance

data ( [arraylength=size][transfer: none])

Memory area for writing

size

Size of data in bytes

initialized

If TRUE the complete data can be read from the beginning


gst_bit_writer_init_with_size

gst_bit_writer_init_with_size (GstBitWriter * bitwriter,
                               guint32 size,
                               gboolean fixed)

Initializes a GstBitWriter instance and allocates the given data size.

Parameters:

bitwriter

GstBitWriter instance

size

the size on bytes to allocate for data

fixed

If TRUE the data can't be reallocated


gst_bit_writer_put_bits_uint16

gboolean
gst_bit_writer_put_bits_uint16 (GstBitWriter * bitwriter,
                                guint16 value,
                                guint nbits)

Write nbits bits of value to GstBitWriter.

Parameters:

bitwriter

a GstBitWriter instance

value

value of guint16 to write

nbits

number of bits to write

Returns

TRUE if successful, FALSE otherwise.


GstBase.BitWriter.prototype.put_bits_uint16

function GstBase.BitWriter.prototype.put_bits_uint16(value: Number, nbits: Number): {
    // javascript wrapper for 'gst_bit_writer_put_bits_uint16'
}

Write nbits bits of value to GstBase.BitWriter.

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

value (Number)

value of Number to write

nbits (Number)

number of bits to write

Returns (Number)

true if successful, false otherwise.


GstBase.BitWriter.put_bits_uint16

def GstBase.BitWriter.put_bits_uint16 (self, value, nbits):
    #python wrapper for 'gst_bit_writer_put_bits_uint16'

Write nbits bits of value to GstBase.BitWriter.

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

value (int)

value of int to write

nbits (int)

number of bits to write

Returns (bool)

True if successful, False otherwise.


gst_bit_writer_put_bits_uint32

gboolean
gst_bit_writer_put_bits_uint32 (GstBitWriter * bitwriter,
                                guint32 value,
                                guint nbits)

Write nbits bits of value to GstBitWriter.

Parameters:

bitwriter

a GstBitWriter instance

value

value of guint32 to write

nbits

number of bits to write

Returns

TRUE if successful, FALSE otherwise.


GstBase.BitWriter.prototype.put_bits_uint32

function GstBase.BitWriter.prototype.put_bits_uint32(value: Number, nbits: Number): {
    // javascript wrapper for 'gst_bit_writer_put_bits_uint32'
}

Write nbits bits of value to GstBase.BitWriter.

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

value (Number)

value of Number to write

nbits (Number)

number of bits to write

Returns (Number)

true if successful, false otherwise.


GstBase.BitWriter.put_bits_uint32

def GstBase.BitWriter.put_bits_uint32 (self, value, nbits):
    #python wrapper for 'gst_bit_writer_put_bits_uint32'

Write nbits bits of value to GstBase.BitWriter.

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

value (int)

value of int to write

nbits (int)

number of bits to write

Returns (bool)

True if successful, False otherwise.


gst_bit_writer_put_bits_uint64

gboolean
gst_bit_writer_put_bits_uint64 (GstBitWriter * bitwriter,
                                guint64 value,
                                guint nbits)

Write nbits bits of value to GstBitWriter.

Parameters:

bitwriter

a GstBitWriter instance

value

value of guint64 to write

nbits

number of bits to write

Returns

TRUE if successful, FALSE otherwise.


GstBase.BitWriter.prototype.put_bits_uint64

function GstBase.BitWriter.prototype.put_bits_uint64(value: Number, nbits: Number): {
    // javascript wrapper for 'gst_bit_writer_put_bits_uint64'
}

Write nbits bits of value to GstBase.BitWriter.

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

value (Number)

value of Number to write

nbits (Number)

number of bits to write

Returns (Number)

true if successful, false otherwise.


GstBase.BitWriter.put_bits_uint64

def GstBase.BitWriter.put_bits_uint64 (self, value, nbits):
    #python wrapper for 'gst_bit_writer_put_bits_uint64'

Write nbits bits of value to GstBase.BitWriter.

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

value (int)

value of int to write

nbits (int)

number of bits to write

Returns (bool)

True if successful, False otherwise.


gst_bit_writer_put_bits_uint8

gboolean
gst_bit_writer_put_bits_uint8 (GstBitWriter * bitwriter,
                               guint8 value,
                               guint nbits)

Write nbits bits of value to GstBitWriter.

Parameters:

bitwriter

a GstBitWriter instance

value

value of guint8 to write

nbits

number of bits to write

Returns

TRUE if successful, FALSE otherwise.


GstBase.BitWriter.prototype.put_bits_uint8

function GstBase.BitWriter.prototype.put_bits_uint8(value: Number, nbits: Number): {
    // javascript wrapper for 'gst_bit_writer_put_bits_uint8'
}

Write nbits bits of value to GstBase.BitWriter.

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

value (Number)

value of Number to write

nbits (Number)

number of bits to write

Returns (Number)

true if successful, false otherwise.


GstBase.BitWriter.put_bits_uint8

def GstBase.BitWriter.put_bits_uint8 (self, value, nbits):
    #python wrapper for 'gst_bit_writer_put_bits_uint8'

Write nbits bits of value to GstBase.BitWriter.

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

value (int)

value of int to write

nbits (int)

number of bits to write

Returns (bool)

True if successful, False otherwise.


gst_bit_writer_put_bytes

gboolean
gst_bit_writer_put_bytes (GstBitWriter * bitwriter,
                          const guint8 * data,
                          guint nbytes)

Write nbytes bytes of data to GstBitWriter.

Parameters:

bitwriter

a GstBitWriter instance

data ( [array])

pointer of data to write

nbytes

number of bytes to write

Returns

TRUE if successful, FALSE otherwise.


GstBase.BitWriter.prototype.put_bytes

function GstBase.BitWriter.prototype.put_bytes(data: [ Number ], nbytes: Number): {
    // javascript wrapper for 'gst_bit_writer_put_bytes'
}

Write nbytes bytes of data to GstBase.BitWriter.

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

data ([ Number ])

pointer of data to write

nbytes (Number)

number of bytes to write

Returns (Number)

true if successful, false otherwise.


GstBase.BitWriter.put_bytes

def GstBase.BitWriter.put_bytes (self, data, nbytes):
    #python wrapper for 'gst_bit_writer_put_bytes'

Write nbytes bytes of data to GstBase.BitWriter.

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

data ([ int ])

pointer of data to write

nbytes (int)

number of bytes to write

Returns (bool)

True if successful, False otherwise.


gst_bit_writer_reset

gst_bit_writer_reset (GstBitWriter * bitwriter)

Resets bitwriter and frees the data if it's owned by bitwriter.

Parameters:

bitwriter

GstBitWriter instance


GstBase.BitWriter.prototype.reset

function GstBase.BitWriter.prototype.reset(): {
    // javascript wrapper for 'gst_bit_writer_reset'
}

Resets bitwriter and frees the data if it's owned by bitwriter.

Parameters:

bitwriter (GstBase.BitWriter)

GstBase.BitWriter instance


GstBase.BitWriter.reset

def GstBase.BitWriter.reset (self):
    #python wrapper for 'gst_bit_writer_reset'

Resets bitwriter and frees the data if it's owned by bitwriter.

Parameters:

bitwriter (GstBase.BitWriter)

GstBase.BitWriter instance


gst_bit_writer_reset_and_get_buffer

GstBuffer *
gst_bit_writer_reset_and_get_buffer (GstBitWriter * bitwriter)

Resets bitwriter and returns the current data as GstBuffer.

Free-function: gst_buffer_unref

Parameters:

bitwriter

a GstBitWriter instance

Returns ( [transfer: full])

a new allocated GstBuffer wrapping the current data. gst_buffer_unref after usage.


GstBase.BitWriter.prototype.reset_and_get_buffer

function GstBase.BitWriter.prototype.reset_and_get_buffer(): {
    // javascript wrapper for 'gst_bit_writer_reset_and_get_buffer'
}

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

Free-function: gst_buffer_unref

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

Returns (Gst.Buffer)

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


GstBase.BitWriter.reset_and_get_buffer

def GstBase.BitWriter.reset_and_get_buffer (self):
    #python wrapper for 'gst_bit_writer_reset_and_get_buffer'

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

Free-function: gst_buffer_unref

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

Returns (Gst.Buffer)

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


gst_bit_writer_reset_and_get_data

guint8 *
gst_bit_writer_reset_and_get_data (GstBitWriter * bitwriter)

Resets bitwriter and returns the current data.

Free-function: g_free

Parameters:

bitwriter

a GstBitWriter instance

Returns ( [array][transfer: full])

the current data. g_free after usage.


GstBase.BitWriter.prototype.reset_and_get_data

function GstBase.BitWriter.prototype.reset_and_get_data(): {
    // javascript wrapper for 'gst_bit_writer_reset_and_get_data'
}

Resets bitwriter and returns the current data.

Free-function: g_free

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

Returns ([ Number ])

the current data. GLib.prototype.free after usage.


GstBase.BitWriter.reset_and_get_data

def GstBase.BitWriter.reset_and_get_data (self):
    #python wrapper for 'gst_bit_writer_reset_and_get_data'

Resets bitwriter and returns the current data.

Free-function: g_free

Parameters:

bitwriter (GstBase.BitWriter)

a GstBase.BitWriter instance

Returns ([ int ])

the current data. GLib.free after usage.


gst_bit_writer_set_pos

gboolean
gst_bit_writer_set_pos (GstBitWriter * bitwriter,
                        guint pos)

Parameters:

bitwriter
No description available
pos
No description available
Returns
No description available

GstBase.BitWriter.prototype.set_pos

function GstBase.BitWriter.prototype.set_pos(pos: Number): {
    // javascript wrapper for 'gst_bit_writer_set_pos'
}

Parameters:

bitwriter (GstBase.BitWriter)
No description available
pos (Number)
No description available
Returns (Number)
No description available

GstBase.BitWriter.set_pos

def GstBase.BitWriter.set_pos (self, pos):
    #python wrapper for 'gst_bit_writer_set_pos'

Parameters:

bitwriter (GstBase.BitWriter)
No description available
pos (int)
No description available
Returns (bool)
No description available

Functions

gst_bit_writer_new

GstBitWriter *
gst_bit_writer_new ()

Creates a new, empty GstBitWriter instance.

Free-function: gst_bit_writer_free

Returns ( [transfer: full])

a new, empty GstByteWriter instance


gst_bit_writer_new_with_data

GstBitWriter *
gst_bit_writer_new_with_data (guint8 * data,
                              guint size,
                              gboolean initialized)

Creates a new GstBitWriter instance with the given memory area. If initialized is TRUE it is possible to read size bits from the GstBitWriter from the beginning.

Free-function: gst_bit_writer_free

Parameters:

data ( [arraylength=size][transfer: none])

Memory area for writing

size

Size of data in bytes

initialized

if TRUE the complete data can be read from the beginning

Returns ( [transfer: full])

a new GstBitWriter instance


gst_bit_writer_new_with_size

GstBitWriter *
gst_bit_writer_new_with_size (guint32 size,
                              gboolean fixed)

Creates a GstBitWriter instance with the given initial data size.

Free-function: gst_bit_writer_free

Parameters:

size

Initial size of data in bytes

fixed

If TRUE the data can't be reallocated

Returns ( [transfer: full])

a new GstBitWriter instance


Function Macros

GST_BIT_WRITER_BIT_SIZE

#define GST_BIT_WRITER_BIT_SIZE(writer) ((writer)->bit_size)

GST_BIT_WRITER_DATA

#define GST_BIT_WRITER_DATA(writer)     ((writer)->data)

__GST_BITS_WRITER_ALIGNED

#define __GST_BITS_WRITER_ALIGNED(bitsize)                   \
    (((bitsize) + __GST_BITS_WRITER_ALIGNMENT_MASK)&(~__GST_BITS_WRITER_ALIGNMENT_MASK))

__GST_BIT_WRITER_WRITE_BITS_INLINE

#define __GST_BIT_WRITER_WRITE_BITS_INLINE(bits) \
static inline gboolean \
_gst_bit_writer_put_bits_uint##bits##_inline( \
    GstBitWriter *bitwriter, \
    guint##bits value, \
    guint nbits \
) \
{ \
    g_return_val_if_fail(bitwriter != NULL, FALSE); \
    g_return_val_if_fail(nbits != 0, FALSE); \
    g_return_val_if_fail(nbits <= bits, FALSE); \
    \
    if (!_gst_bit_writer_check_remaining(bitwriter, nbits)) \
        return FALSE; \
    gst_bit_writer_put_bits_uint##bits##_unchecked(bitwriter, value, nbits); \
    return TRUE; \
}

__GST_BIT_WRITER_WRITE_BITS_UNCHECKED

#define __GST_BIT_WRITER_WRITE_BITS_UNCHECKED(bits) \
static inline void \
gst_bit_writer_put_bits_uint##bits##_unchecked( \
    GstBitWriter *bitwriter, \
    guint##bits value, \
    guint nbits \
) \
{ \
    guint byte_pos, bit_offset; \
    guint8  *cur_byte; \
    guint fill_bits; \
    \
    byte_pos = (bitwriter->bit_size >> 3); \
    bit_offset = (bitwriter->bit_size & 0x07); \
    cur_byte = bitwriter->data + byte_pos; \
    g_assert (nbits <= bits); \
    g_assert( bit_offset < 8 && \
            bitwriter->bit_size <= bitwriter->bit_capacity); \
    \
    while (nbits) { \
        fill_bits = ((8 - bit_offset) < nbits ? (8 - bit_offset) : nbits); \
        nbits -= fill_bits; \
        bitwriter->bit_size += fill_bits; \
        \
        *cur_byte |= (((value >> nbits) & _gst_bit_writer_bit_filling_mask[fill_bits]) \
                      << (8 - bit_offset - fill_bits)); \
        ++cur_byte; \
        bit_offset = 0; \
    } \
    g_assert(cur_byte <= \
           (bitwriter->data + (bitwriter->bit_capacity >> 3))); \
}

Constants

__GST_BITS_WRITER_ALIGNMENT_MASK

#define __GST_BITS_WRITER_ALIGNMENT_MASK 2047

The results of the search are