GstBitReader

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

GstBitReader

A bit reader instance.

Members

data (const guint8 *) –

Data from which the bit reader will read

size (guint) –

Size of data in bytes

byte (guint) –

Current byte position

bit (guint) –

Bit position in the current byte


GstBase.BitReader

A bit reader instance.

Members

data ([ int ]) –

Data from which the bit reader will read

size (int) –

Size of data in bytes

byte (int) –

Current byte position

bit (int) –

Bit position in the current byte


GstBase.BitReader

A bit reader instance.

Members

data ([ Number ]) –

Data from which the bit reader will read

size (Number) –

Size of data in bytes

byte (Number) –

Current byte position

bit (Number) –

Bit position in the current byte


Methods

gst_bit_reader_free

gst_bit_reader_free (GstBitReader * reader)

Frees a GstBitReader instance, which was previously allocated by gst_bit_reader_new.

Parameters:

reader ( [in] [transfer: full] ) –

a GstBitReader instance


GstBase.BitReader.free

def GstBase.BitReader.free (self):
    #python wrapper for 'gst_bit_reader_free'

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

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance


GstBase.BitReader.prototype.free

function GstBase.BitReader.prototype.free(): {
    // javascript wrapper for 'gst_bit_reader_free'
}

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

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance


gst_bit_reader_get_bits_uint16

gboolean
gst_bit_reader_get_bits_uint16 (GstBitReader * reader,
                                guint16 * val,
                                guint nbits)

Read nbits bits into val and update the current position.

Parameters:

reader

a GstBitReader instance

val ( [out] ) –

Pointer to a guint16 to store the result

nbits

number of bits to read

Returns

TRUE if successful, FALSE otherwise.


GstBase.BitReader.get_bits_uint16

def GstBase.BitReader.get_bits_uint16 (self, nbits):
    #python wrapper for 'gst_bit_reader_get_bits_uint16'

Read nbits bits into val and update the current position.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

nbits ( int ) –

number of bits to read

Returns a tuple made of:

( bool ) –

True if successful, False otherwise.

val ( int ) –

True if successful, False otherwise.


GstBase.BitReader.prototype.get_bits_uint16

function GstBase.BitReader.prototype.get_bits_uint16(nbits: Number): {
    // javascript wrapper for 'gst_bit_reader_get_bits_uint16'
}

Read nbits bits into val and update the current position.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

nbits ( Number ) –

number of bits to read

Returns a tuple made of:

( Number ) –

true if successful, false otherwise.

val ( Number ) –

true if successful, false otherwise.


gst_bit_reader_get_bits_uint32

gboolean
gst_bit_reader_get_bits_uint32 (GstBitReader * reader,
                                guint32 * val,
                                guint nbits)

Read nbits bits into val and update the current position.

Parameters:

reader

a GstBitReader instance

val ( [out] ) –

Pointer to a guint32 to store the result

nbits

number of bits to read

Returns

TRUE if successful, FALSE otherwise.


GstBase.BitReader.get_bits_uint32

def GstBase.BitReader.get_bits_uint32 (self, nbits):
    #python wrapper for 'gst_bit_reader_get_bits_uint32'

Read nbits bits into val and update the current position.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

nbits ( int ) –

number of bits to read

Returns a tuple made of:

( bool ) –

True if successful, False otherwise.

val ( int ) –

True if successful, False otherwise.


GstBase.BitReader.prototype.get_bits_uint32

function GstBase.BitReader.prototype.get_bits_uint32(nbits: Number): {
    // javascript wrapper for 'gst_bit_reader_get_bits_uint32'
}

Read nbits bits into val and update the current position.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

nbits ( Number ) –

number of bits to read

Returns a tuple made of:

( Number ) –

true if successful, false otherwise.

val ( Number ) –

true if successful, false otherwise.


gst_bit_reader_get_bits_uint64

gboolean
gst_bit_reader_get_bits_uint64 (GstBitReader * reader,
                                guint64 * val,
                                guint nbits)

Read nbits bits into val and update the current position.

Parameters:

reader

a GstBitReader instance

val ( [out] ) –

Pointer to a guint64 to store the result

nbits

number of bits to read

Returns

TRUE if successful, FALSE otherwise.


GstBase.BitReader.get_bits_uint64

def GstBase.BitReader.get_bits_uint64 (self, nbits):
    #python wrapper for 'gst_bit_reader_get_bits_uint64'

Read nbits bits into val and update the current position.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

nbits ( int ) –

number of bits to read

Returns a tuple made of:

( bool ) –

True if successful, False otherwise.

val ( int ) –

True if successful, False otherwise.


GstBase.BitReader.prototype.get_bits_uint64

function GstBase.BitReader.prototype.get_bits_uint64(nbits: Number): {
    // javascript wrapper for 'gst_bit_reader_get_bits_uint64'
}

Read nbits bits into val and update the current position.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

nbits ( Number ) –

number of bits to read

Returns a tuple made of:

( Number ) –

true if successful, false otherwise.

val ( Number ) –

true if successful, false otherwise.


gst_bit_reader_get_bits_uint8

gboolean
gst_bit_reader_get_bits_uint8 (GstBitReader * reader,
                               guint8 * val,
                               guint nbits)

Read nbits bits into val and update the current position.

Parameters:

reader

a GstBitReader instance

val ( [out] ) –

Pointer to a guint8 to store the result

nbits

number of bits to read

Returns

TRUE if successful, FALSE otherwise.


GstBase.BitReader.get_bits_uint8

def GstBase.BitReader.get_bits_uint8 (self, nbits):
    #python wrapper for 'gst_bit_reader_get_bits_uint8'

Read nbits bits into val and update the current position.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

nbits ( int ) –

number of bits to read

Returns a tuple made of:

( bool ) –

True if successful, False otherwise.

val ( int ) –

True if successful, False otherwise.


GstBase.BitReader.prototype.get_bits_uint8

function GstBase.BitReader.prototype.get_bits_uint8(nbits: Number): {
    // javascript wrapper for 'gst_bit_reader_get_bits_uint8'
}

Read nbits bits into val and update the current position.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

nbits ( Number ) –

number of bits to read

Returns a tuple made of:

( Number ) –

true if successful, false otherwise.

val ( Number ) –

true if successful, false otherwise.


gst_bit_reader_get_pos

guint
gst_bit_reader_get_pos (const GstBitReader * reader)

Returns the current position of a GstBitReader instance in bits.

Parameters:

reader

a GstBitReader instance

Returns

The current position of reader in bits.


GstBase.BitReader.get_pos

def GstBase.BitReader.get_pos (self):
    #python wrapper for 'gst_bit_reader_get_pos'

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

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

Returns ( int ) –

The current position of reader in bits.


GstBase.BitReader.prototype.get_pos

function GstBase.BitReader.prototype.get_pos(): {
    // javascript wrapper for 'gst_bit_reader_get_pos'
}

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

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

Returns ( Number ) –

The current position of reader in bits.


gst_bit_reader_get_remaining

guint
gst_bit_reader_get_remaining (const GstBitReader * reader)

Returns the remaining number of bits of a GstBitReader instance.

Parameters:

reader

a GstBitReader instance

Returns

The remaining number of bits of reader instance.


GstBase.BitReader.get_remaining

def GstBase.BitReader.get_remaining (self):
    #python wrapper for 'gst_bit_reader_get_remaining'

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

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

Returns ( int ) –

The remaining number of bits of reader instance.


GstBase.BitReader.prototype.get_remaining

function GstBase.BitReader.prototype.get_remaining(): {
    // javascript wrapper for 'gst_bit_reader_get_remaining'
}

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

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

Returns ( Number ) –

The remaining number of bits of reader instance.


gst_bit_reader_get_size

guint
gst_bit_reader_get_size (const GstBitReader * reader)

Returns the total number of bits of a GstBitReader instance.

Parameters:

reader

a GstBitReader instance

Returns

The total number of bits of reader instance.


GstBase.BitReader.get_size

def GstBase.BitReader.get_size (self):
    #python wrapper for 'gst_bit_reader_get_size'

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

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

Returns ( int ) –

The total number of bits of reader instance.


GstBase.BitReader.prototype.get_size

function GstBase.BitReader.prototype.get_size(): {
    // javascript wrapper for 'gst_bit_reader_get_size'
}

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

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

Returns ( Number ) –

The total number of bits of reader instance.


gst_bit_reader_init

gst_bit_reader_init (GstBitReader * reader,
                     const guint8 * data,
                     guint size)

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

Parameters:

reader

a GstBitReader instance

data ( [in] [array length=size] ) –

data from which the bit reader should read

size

Size of data in bytes


GstBase.BitReader.init

def GstBase.BitReader.init (self, data, size):
    #python wrapper for 'gst_bit_reader_init'

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

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

data ( [ int ] ) –

data from which the bit reader should read

size ( int ) –

Size of data in bytes


GstBase.BitReader.prototype.init

function GstBase.BitReader.prototype.init(data: [ Number ], size: Number): {
    // javascript wrapper for 'gst_bit_reader_init'
}

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

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

data ( [ Number ] ) –

data from which the bit reader should read

size ( Number ) –

Size of data in bytes


gst_bit_reader_peek_bits_uint16

gboolean
gst_bit_reader_peek_bits_uint16 (const GstBitReader * reader,
                                 guint16 * val,
                                 guint nbits)

Read nbits bits into val but keep the current position.

Parameters:

reader

a GstBitReader instance

val ( [out] ) –

Pointer to a guint16 to store the result

nbits

number of bits to read

Returns

TRUE if successful, FALSE otherwise.


GstBase.BitReader.peek_bits_uint16

def GstBase.BitReader.peek_bits_uint16 (self, nbits):
    #python wrapper for 'gst_bit_reader_peek_bits_uint16'

Read nbits bits into val but keep the current position.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

nbits ( int ) –

number of bits to read

Returns a tuple made of:

( bool ) –

True if successful, False otherwise.

val ( int ) –

True if successful, False otherwise.


GstBase.BitReader.prototype.peek_bits_uint16

function GstBase.BitReader.prototype.peek_bits_uint16(nbits: Number): {
    // javascript wrapper for 'gst_bit_reader_peek_bits_uint16'
}

Read nbits bits into val but keep the current position.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

nbits ( Number ) –

number of bits to read

Returns a tuple made of:

( Number ) –

true if successful, false otherwise.

val ( Number ) –

true if successful, false otherwise.


gst_bit_reader_peek_bits_uint32

gboolean
gst_bit_reader_peek_bits_uint32 (const GstBitReader * reader,
                                 guint32 * val,
                                 guint nbits)

Read nbits bits into val but keep the current position.

Parameters:

reader

a GstBitReader instance

val ( [out] ) –

Pointer to a guint32 to store the result

nbits

number of bits to read

Returns

TRUE if successful, FALSE otherwise.


GstBase.BitReader.peek_bits_uint32

def GstBase.BitReader.peek_bits_uint32 (self, nbits):
    #python wrapper for 'gst_bit_reader_peek_bits_uint32'

Read nbits bits into val but keep the current position.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

nbits ( int ) –

number of bits to read

Returns a tuple made of:

( bool ) –

True if successful, False otherwise.

val ( int ) –

True if successful, False otherwise.


GstBase.BitReader.prototype.peek_bits_uint32

function GstBase.BitReader.prototype.peek_bits_uint32(nbits: Number): {
    // javascript wrapper for 'gst_bit_reader_peek_bits_uint32'
}

Read nbits bits into val but keep the current position.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

nbits ( Number ) –

number of bits to read

Returns a tuple made of:

( Number ) –

true if successful, false otherwise.

val ( Number ) –

true if successful, false otherwise.


gst_bit_reader_peek_bits_uint64

gboolean
gst_bit_reader_peek_bits_uint64 (const GstBitReader * reader,
                                 guint64 * val,
                                 guint nbits)

Read nbits bits into val but keep the current position.

Parameters:

reader

a GstBitReader instance

val ( [out] ) –

Pointer to a guint64 to store the result

nbits

number of bits to read

Returns

TRUE if successful, FALSE otherwise.


GstBase.BitReader.peek_bits_uint64

def GstBase.BitReader.peek_bits_uint64 (self, nbits):
    #python wrapper for 'gst_bit_reader_peek_bits_uint64'

Read nbits bits into val but keep the current position.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

nbits ( int ) –

number of bits to read

Returns a tuple made of:

( bool ) –

True if successful, False otherwise.

val ( int ) –

True if successful, False otherwise.


GstBase.BitReader.prototype.peek_bits_uint64

function GstBase.BitReader.prototype.peek_bits_uint64(nbits: Number): {
    // javascript wrapper for 'gst_bit_reader_peek_bits_uint64'
}

Read nbits bits into val but keep the current position.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

nbits ( Number ) –

number of bits to read

Returns a tuple made of:

( Number ) –

true if successful, false otherwise.

val ( Number ) –

true if successful, false otherwise.


gst_bit_reader_peek_bits_uint8

gboolean
gst_bit_reader_peek_bits_uint8 (const GstBitReader * reader,
                                guint8 * val,
                                guint nbits)

Read nbits bits into val but keep the current position.

Parameters:

reader

a GstBitReader instance

val ( [out] ) –

Pointer to a guint8 to store the result

nbits

number of bits to read

Returns

TRUE if successful, FALSE otherwise.


GstBase.BitReader.peek_bits_uint8

def GstBase.BitReader.peek_bits_uint8 (self, nbits):
    #python wrapper for 'gst_bit_reader_peek_bits_uint8'

Read nbits bits into val but keep the current position.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

nbits ( int ) –

number of bits to read

Returns a tuple made of:

( bool ) –

True if successful, False otherwise.

val ( int ) –

True if successful, False otherwise.


GstBase.BitReader.prototype.peek_bits_uint8

function GstBase.BitReader.prototype.peek_bits_uint8(nbits: Number): {
    // javascript wrapper for 'gst_bit_reader_peek_bits_uint8'
}

Read nbits bits into val but keep the current position.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

nbits ( Number ) –

number of bits to read

Returns a tuple made of:

( Number ) –

true if successful, false otherwise.

val ( Number ) –

true if successful, false otherwise.


gst_bit_reader_set_pos

gboolean
gst_bit_reader_set_pos (GstBitReader * reader,
                        guint pos)

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

Parameters:

reader

a GstBitReader instance

pos

The new position in bits

Returns

TRUE if the position could be set successfully, FALSE otherwise.


GstBase.BitReader.set_pos

def GstBase.BitReader.set_pos (self, pos):
    #python wrapper for 'gst_bit_reader_set_pos'

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

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

pos ( int ) –

The new position in bits

Returns ( bool ) –

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


GstBase.BitReader.prototype.set_pos

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

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

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

pos ( Number ) –

The new position in bits

Returns ( Number ) –

true if the position could be set successfully, false otherwise.


gst_bit_reader_skip

gboolean
gst_bit_reader_skip (GstBitReader * reader,
                     guint nbits)

Skips nbits bits of the GstBitReader instance.

Parameters:

reader

a GstBitReader instance

nbits

the number of bits to skip

Returns

TRUE if nbits bits could be skipped, FALSE otherwise.


GstBase.BitReader.skip

def GstBase.BitReader.skip (self, nbits):
    #python wrapper for 'gst_bit_reader_skip'

Skips nbits bits of the GstBase.BitReader instance.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

nbits ( int ) –

the number of bits to skip

Returns ( bool ) –

True if nbits bits could be skipped, False otherwise.


GstBase.BitReader.prototype.skip

function GstBase.BitReader.prototype.skip(nbits: Number): {
    // javascript wrapper for 'gst_bit_reader_skip'
}

Skips nbits bits of the GstBase.BitReader instance.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

nbits ( Number ) –

the number of bits to skip

Returns ( Number ) –

true if nbits bits could be skipped, false otherwise.


gst_bit_reader_skip_to_byte

gboolean
gst_bit_reader_skip_to_byte (GstBitReader * reader)

Skips until the next byte.

Parameters:

reader

a GstBitReader instance

Returns

TRUE if successful, FALSE otherwise.


GstBase.BitReader.skip_to_byte

def GstBase.BitReader.skip_to_byte (self):
    #python wrapper for 'gst_bit_reader_skip_to_byte'

Skips until the next byte.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

Returns ( bool ) –

True if successful, False otherwise.


GstBase.BitReader.prototype.skip_to_byte

function GstBase.BitReader.prototype.skip_to_byte(): {
    // javascript wrapper for 'gst_bit_reader_skip_to_byte'
}

Skips until the next byte.

Parameters:

reader ( GstBase.BitReader ) –

a GstBase.BitReader instance

Returns ( Number ) –

true if successful, false otherwise.


Functions

gst_bit_reader_new

GstBitReader *
gst_bit_reader_new (const guint8 * data,
                    guint size)

Create a new GstBitReader instance, which will read from data.

Free-function: gst_bit_reader_free

Parameters:

data ( [array length=size] ) –

Data from which the GstBitReader should read

size

Size of data in bytes

Returns ( [transfer: full] ) –

a new GstBitReader instance


Function Macros

GST_BIT_READER

#define GST_BIT_READER(reader) ((GstBitReader *) (reader))

GST_BIT_READER_INIT

#define GST_BIT_READER_INIT(data, size) {data, size, 0, 0}

A GstBitReader must be initialized with this macro, before it can be used. This macro can used be to initialize a variable, but it cannot be assigned to a variable. In that case you have to use gst_bit_reader_init.

Parameters:

data

Data from which the GstBitReader should read

size

Size of data in bytes


__GST_BIT_READER_READ_BITS_INLINE

#define __GST_BIT_READER_READ_BITS_INLINE(bits) \
static inline gboolean \
_gst_bit_reader_get_bits_uint##bits##_inline (GstBitReader *reader, guint##bits *val, guint nbits) \
{ \
  g_return_val_if_fail (reader != NULL, FALSE); \
  g_return_val_if_fail (val != NULL, FALSE); \
  g_return_val_if_fail (nbits <= bits, FALSE); \
  \
  if (_gst_bit_reader_get_remaining_unchecked (reader) < nbits) \
    return FALSE; \
\
  *val = gst_bit_reader_get_bits_uint##bits##_unchecked (reader, nbits); \
  return TRUE; \
} \
\
static inline gboolean \
_gst_bit_reader_peek_bits_uint##bits##_inline (const GstBitReader *reader, guint##bits *val, guint nbits) \
{ \
  g_return_val_if_fail (reader != NULL, FALSE); \
  g_return_val_if_fail (val != NULL, FALSE); \
  g_return_val_if_fail (nbits <= bits, FALSE); \
  \
  if (_gst_bit_reader_get_remaining_unchecked (reader) < nbits) \
    return FALSE; \
\
  *val = gst_bit_reader_peek_bits_uint##bits##_unchecked (reader, nbits); \
  return TRUE; \
}

__GST_BIT_READER_READ_BITS_UNCHECKED

#define __GST_BIT_READER_READ_BITS_UNCHECKED(bits) \
static inline guint##bits \
gst_bit_reader_peek_bits_uint##bits##_unchecked (const GstBitReader *reader, guint nbits) \
{ \
  guint##bits ret = 0; \
  const guint8 *data; \
  guint byte, bit; \
  \
  data = reader->data; \
  byte = reader->byte; \
  bit = reader->bit; \
  \
  while (nbits > 0) { \
    guint toread = MIN (nbits, 8 - bit); \
    \
    ret <<= toread; \
    ret |= (data[byte] & (0xff >> bit)) >> (8 - toread - bit); \
    \
    bit += toread; \
    if (bit >= 8) { \
      byte++; \
      bit = 0; \
    } \
    nbits -= toread; \
  } \
  \
  return ret; \
} \
\
static inline guint##bits \
gst_bit_reader_get_bits_uint##bits##_unchecked (GstBitReader *reader, guint nbits) \
{ \
  guint##bits ret; \
  \
  ret = gst_bit_reader_peek_bits_uint##bits##_unchecked (reader, nbits); \
  \
  gst_bit_reader_skip_unchecked (reader, nbits); \
  \
  return ret; \
}

The results of the search are