GStreamer 0.10 Library Reference Manual | ||||
---|---|---|---|---|
#include <gst/base/gstbytereader.h> GstByteReader; #define GST_BYTE_READER_INIT (data, size) #define GST_BYTE_READER_INIT_FROM_BUFFER (buffer) GstByteReader* gst_byte_reader_new (const guint8 *data, guint size); GstByteReader* gst_byte_reader_new_from_buffer (const GstBuffer *buffer); void gst_byte_reader_free (GstByteReader *reader); void gst_byte_reader_init (GstByteReader *reader, const guint8 *data, guint size); void gst_byte_reader_init_from_buffer (GstByteReader *reader, const GstBuffer *buffer); guint gst_byte_reader_get_pos (const GstByteReader *reader); guint gst_byte_reader_get_remaining (const GstByteReader *reader); gboolean gst_byte_reader_set_pos (GstByteReader *reader, guint pos); gboolean gst_byte_reader_skip (GstByteReader *reader, guint nbytes); gboolean gst_byte_reader_get_int8 (GstByteReader *reader, gint8 *val); gboolean gst_byte_reader_get_int16_be (GstByteReader *reader, gint16 *val); gboolean gst_byte_reader_get_int16_le (GstByteReader *reader, gint16 *val); gboolean gst_byte_reader_get_int24_be (GstByteReader *reader, gint32 *val); gboolean gst_byte_reader_get_int24_le (GstByteReader *reader, gint32 *val); gboolean gst_byte_reader_get_int32_be (GstByteReader *reader, gint32 *val); gboolean gst_byte_reader_get_int32_le (GstByteReader *reader, gint32 *val); gboolean gst_byte_reader_get_int64_be (GstByteReader *reader, gint64 *val); gboolean gst_byte_reader_get_int64_le (GstByteReader *reader, gint64 *val); gboolean gst_byte_reader_get_uint8 (GstByteReader *reader, guint8 *val); gboolean gst_byte_reader_get_uint16_be (GstByteReader *reader, guint16 *val); gboolean gst_byte_reader_get_uint16_le (GstByteReader *reader, guint16 *val); gboolean gst_byte_reader_get_uint24_be (GstByteReader *reader, guint32 *val); gboolean gst_byte_reader_get_uint24_le (GstByteReader *reader, guint32 *val); gboolean gst_byte_reader_get_uint32_be (GstByteReader *reader, guint32 *val); gboolean gst_byte_reader_get_uint32_le (GstByteReader *reader, guint32 *val); gboolean gst_byte_reader_get_uint64_be (GstByteReader *reader, guint64 *val); gboolean gst_byte_reader_get_uint64_le (GstByteReader *reader, guint64 *val); gboolean gst_byte_reader_peek_int8 (GstByteReader *reader, gint8 *val); gboolean gst_byte_reader_peek_int16_be (GstByteReader *reader, gint16 *val); gboolean gst_byte_reader_peek_int16_le (GstByteReader *reader, gint16 *val); gboolean gst_byte_reader_peek_int24_be (GstByteReader *reader, gint32 *val); gboolean gst_byte_reader_peek_int24_le (GstByteReader *reader, gint32 *val); gboolean gst_byte_reader_peek_int32_be (GstByteReader *reader, gint32 *val); gboolean gst_byte_reader_peek_int32_le (GstByteReader *reader, gint32 *val); gboolean gst_byte_reader_peek_int64_be (GstByteReader *reader, gint64 *val); gboolean gst_byte_reader_peek_int64_le (GstByteReader *reader, gint64 *val); gboolean gst_byte_reader_peek_uint8 (GstByteReader *reader, guint8 *val); gboolean gst_byte_reader_peek_uint16_be (GstByteReader *reader, guint16 *val); gboolean gst_byte_reader_peek_uint16_le (GstByteReader *reader, guint16 *val); gboolean gst_byte_reader_peek_uint24_be (GstByteReader *reader, guint32 *val); gboolean gst_byte_reader_peek_uint24_le (GstByteReader *reader, guint32 *val); gboolean gst_byte_reader_peek_uint32_be (GstByteReader *reader, guint32 *val); gboolean gst_byte_reader_peek_uint32_le (GstByteReader *reader, guint32 *val); gboolean gst_byte_reader_peek_uint64_be (GstByteReader *reader, guint64 *val); gboolean gst_byte_reader_peek_uint64_le (GstByteReader *reader, guint64 *val); gboolean gst_byte_reader_get_float32_le (GstByteReader *reader, gfloat *val); gboolean gst_byte_reader_get_float32_be (GstByteReader *reader, gfloat *val); gboolean gst_byte_reader_get_float64_le (GstByteReader *reader, gdouble *val); gboolean gst_byte_reader_get_float64_be (GstByteReader *reader, gdouble *val); gboolean gst_byte_reader_peek_float32_le (GstByteReader *reader, gfloat *val); gboolean gst_byte_reader_peek_float32_be (GstByteReader *reader, gfloat *val); gboolean gst_byte_reader_peek_float64_le (GstByteReader *reader, gdouble *val); gboolean gst_byte_reader_peek_float64_be (GstByteReader *reader, gdouble *val); gboolean gst_byte_reader_get_data (GstByteReader *reader, guint size, const guint8 **val); gboolean gst_byte_reader_peek_data (GstByteReader *reader, guint size, const guint8 **val);
GstByteReader provides a byte reader that can read different integer and floating point types from a memory buffer. It provides functions for reading signed/unsigned, little/big endian integers of 8, 16, 24, 32 and 64 bits and functions for reading little/big endian floating points numbers of 32 and 64 bits.
typedef struct { const guint8 *data; guint size; guint byte; /* Byte position */ } GstByteReader;
A byte reader instance.
const guint8 *data ; |
Data from which the bit reader will read |
guint size ; |
Size of data in bytes
|
guint byte ; |
Current byte position |
#define GST_BYTE_READER_INIT(data, size) {data, size, 0}
A GstByteReader 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_byte_reader_init()
.
data : |
Data from which the GstByteReader should read |
size : |
Size of data in bytes
|
Since 0.10.22
#define GST_BYTE_READER_INIT_FROM_BUFFER(buffer) {GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer), 0}
A GstByteReader 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_byte_reader_init()
.
buffer : |
Buffer from which the GstByteReader should read |
Since 0.10.22
GstByteReader* gst_byte_reader_new (const guint8 *data, guint size);
Create a new GstByteReader instance, which will read from data
.
data : |
Data from which the GstByteReader should read |
size : |
Size of data in bytes
|
Returns : | a new GstByteReader instance |
Since 0.10.22
GstByteReader* gst_byte_reader_new_from_buffer (const GstBuffer *buffer);
Create a new GstByteReader instance, which will read from the
GstBuffer buffer
.
buffer : |
Buffer from which the GstByteReader should read |
Returns : | a new GstByteReader instance |
Since 0.10.22
void gst_byte_reader_free (GstByteReader *reader);
Frees a GstByteReader instance, which was previously allocated by
gst_byte_reader_new()
or gst_byte_reader_new_from_buffer()
.
reader : |
a GstByteReader instance |
Since 0.10.22
void gst_byte_reader_init (GstByteReader *reader, const guint8 *data, guint size);
Initializes a GstByteReader instance to read from data
. This function
can be called on already initialized instances.
reader : |
a GstByteReader instance |
data : |
Data from which the GstByteReader should read |
size : |
Size of data in bytes
|
Since 0.10.22
void gst_byte_reader_init_from_buffer (GstByteReader *reader, const GstBuffer *buffer);
Initializes a GstByteReader instance to read from buffer
. This function
can be called on already initialized instances.
reader : |
a GstByteReader instance |
buffer : |
Buffer from which the GstByteReader should read |
Since 0.10.22
guint gst_byte_reader_get_pos (const GstByteReader *reader);
Returns the current position of a GstByteReader instance in bytes.
reader : |
a GstByteReader instance |
Returns : | The current position of reader in bytes.
|
Since 0.10.22
guint gst_byte_reader_get_remaining (const GstByteReader *reader);
Returns the remaining number of bytes of a GstByteReader instance.
reader : |
a GstByteReader instance |
Returns : | The remaining number of bytes of reader instance.
|
Since 0.10.22
gboolean gst_byte_reader_set_pos (GstByteReader *reader, guint pos);
Sets the new position of a GstByteReader instance to pos
in bytes.
reader : |
a GstByteReader instance |
pos : |
The new position in bytes |
Returns : | TRUE if the position could be set successfully, FALSE
otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_skip (GstByteReader *reader, guint nbytes);
Skips nbytes
bytes of the GstByteReader instance.
reader : |
a GstByteReader instance |
nbytes : |
the number of bytes to skip |
Returns : | TRUE if nbytes bytes could be skipped, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_int8 (GstByteReader *reader, gint8 *val);
Read a signed 8 bit integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gint8 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_int16_be (GstByteReader *reader, gint16 *val);
Read a signed 16 bit big endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gint16 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_int16_le (GstByteReader *reader, gint16 *val);
Read a signed 16 bit little endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gint16 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_int24_be (GstByteReader *reader, gint32 *val);
Read a signed 24 bit big endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gint32 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_int24_le (GstByteReader *reader, gint32 *val);
Read a signed 24 bit little endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gint32 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_int32_be (GstByteReader *reader, gint32 *val);
Read a signed 32 bit big endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gint32 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_int32_le (GstByteReader *reader, gint32 *val);
Read a signed 32 bit little endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gint32 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_int64_be (GstByteReader *reader, gint64 *val);
Read a signed 64 bit big endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gint64 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_int64_le (GstByteReader *reader, gint64 *val);
Read a signed 64 bit little endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gint64 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_uint8 (GstByteReader *reader, guint8 *val);
Read an unsigned 8 bit integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a guint8 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_uint16_be (GstByteReader *reader, guint16 *val);
Read an unsigned 16 bit big endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a guint16 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_uint16_le (GstByteReader *reader, guint16 *val);
Read an unsigned 16 bit little endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a guint16 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_uint24_be (GstByteReader *reader, guint32 *val);
Read an unsigned 24 bit big endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a guint32 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_uint24_le (GstByteReader *reader, guint32 *val);
Read an unsigned 24 bit little endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a guint32 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_uint32_be (GstByteReader *reader, guint32 *val);
Read an unsigned 32 bit big endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a guint32 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_uint32_le (GstByteReader *reader, guint32 *val);
Read an unsigned 32 bit little endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a guint32 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_uint64_be (GstByteReader *reader, guint64 *val);
Read an unsigned 64 bit big endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a guint64 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_uint64_le (GstByteReader *reader, guint64 *val);
Read an unsigned 64 bit little endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a guint64 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_int8 (GstByteReader *reader, gint8 *val);
Read a signed 8 bit integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gint8 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_int16_be (GstByteReader *reader, gint16 *val);
Read a signed 16 bit big endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gint16 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_int16_le (GstByteReader *reader, gint16 *val);
Read a signed 16 bit little endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gint16 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_int24_be (GstByteReader *reader, gint32 *val);
Read a signed 24 bit big endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gint32 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_int24_le (GstByteReader *reader, gint32 *val);
Read a signed 24 bit little endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gint32 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_int32_be (GstByteReader *reader, gint32 *val);
Read a signed 32 bit big endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gint32 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_int32_le (GstByteReader *reader, gint32 *val);
Read a signed 32 bit little endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gint32 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_int64_be (GstByteReader *reader, gint64 *val);
Read a signed 64 bit big endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gint64 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_int64_le (GstByteReader *reader, gint64 *val);
Read a signed 64 bit little endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gint64 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_uint8 (GstByteReader *reader, guint8 *val);
Read a signed 8 bit integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a guint8 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_uint16_be (GstByteReader *reader, guint16 *val);
Read a signed 16 bit big endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a guint16 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_uint16_le (GstByteReader *reader, guint16 *val);
Read a signed 16 bit little endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a guint16 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_uint24_be (GstByteReader *reader, guint32 *val);
Read a signed 24 bit big endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a guint32 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_uint24_le (GstByteReader *reader, guint32 *val);
Read a signed 24 bit little endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a guint32 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_uint32_be (GstByteReader *reader, guint32 *val);
Read a signed 32 bit big endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a guint32 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_uint32_le (GstByteReader *reader, guint32 *val);
Read a signed 32 bit little endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a guint32 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_uint64_be (GstByteReader *reader, guint64 *val);
Read a signed 64 bit big endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a guint64 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_uint64_le (GstByteReader *reader, guint64 *val);
Read a signed 64 bit little endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a guint64 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_float32_le (GstByteReader *reader, gfloat *val);
Read a 32 bit little endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gfloat to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_float32_be (GstByteReader *reader, gfloat *val);
Read a 32 bit big endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gfloat to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_float64_le (GstByteReader *reader, gdouble *val);
Read a 64 bit little endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gdouble to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_float64_be (GstByteReader *reader, gdouble *val);
Read a 64 bit big endian integer into val
and update the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gdouble to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_float32_le (GstByteReader *reader, gfloat *val);
Read a 32 bit little endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gfloat to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_float32_be (GstByteReader *reader, gfloat *val);
Read a 32 bit big endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gfloat to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_float64_le (GstByteReader *reader, gdouble *val);
Read a 64 bit little endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gdouble to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_float64_be (GstByteReader *reader, gdouble *val);
Read a 64 bit big endian integer into val
but keep the current position.
reader : |
a GstByteReader instance |
val : |
Pointer to a gdouble to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_get_data (GstByteReader *reader, guint size, const guint8 **val);
Returns a constant pointer to the current data
position if at least size
bytes are left and
updates the current position.
reader : |
a GstByteReader instance |
size : |
Size in bytes |
val : |
Pointer to a guint8 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22
gboolean gst_byte_reader_peek_data (GstByteReader *reader, guint size, const guint8 **val);
Returns a constant pointer to the current data
position if at least size
bytes are left and
keeps the current position.
reader : |
a GstByteReader instance |
size : |
Size in bytes |
val : |
Pointer to a guint8 to store the result |
Returns : | TRUE if successful, FALSE otherwise.
|
Since 0.10.22