ByteReader

#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. It also provides functions to read NUL-terminated strings in various character encodings.

class ByteReader {}

Constructors

this
this(GstByteReader* gstByteReader, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(ubyte[] data)

Create a new #GstByteReader instance, which will read from @data.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

dupData
bool dupData(ubyte[] val)

Free-function: g_free

dupStringUtf16
bool dupStringUtf16(ushort[] str)

Free-function: g_free

dupStringUtf32
bool dupStringUtf32(uint[] str)

Free-function: g_free

dupStringUtf8
bool dupStringUtf8(string str)

Free-function: g_free

free
void free()

Frees a #GstByteReader instance, which was previously allocated by gst_byte_reader_new().

getByteReaderStruct
GstByteReader* getByteReaderStruct(bool transferOwnership)

Get the main Gtk struct

getData
bool getData(ubyte[] val)

Returns a constant pointer to the current data position if at least @size bytes are left and updates the current position.

getFloat32Be
bool getFloat32Be(float val)

Read a 32 bit big endian floating point value into @val and update the current position.

getFloat32Le
bool getFloat32Le(float val)

Read a 32 bit little endian floating point value into @val and update the current position.

getFloat64Be
bool getFloat64Be(double val)

Read a 64 bit big endian floating point value into @val and update the current position.

getFloat64Le
bool getFloat64Le(double val)

Read a 64 bit little endian floating point value into @val and update the current position.

getInt16Be
bool getInt16Be(short val)

Read a signed 16 bit big endian integer into @val and update the current position.

getInt16Le
bool getInt16Le(short val)

Read a signed 16 bit little endian integer into @val and update the current position.

getInt24Be
bool getInt24Be(int val)

Read a signed 24 bit big endian integer into @val and update the current position.

getInt24Le
bool getInt24Le(int val)

Read a signed 24 bit little endian integer into @val and update the current position.

getInt32Be
bool getInt32Be(int val)

Read a signed 32 bit big endian integer into @val and update the current position.

getInt32Le
bool getInt32Le(int val)

Read a signed 32 bit little endian integer into @val and update the current position.

getInt64Be
bool getInt64Be(long val)

Read a signed 64 bit big endian integer into @val and update the current position.

getInt64Le
bool getInt64Le(long val)

Read a signed 64 bit little endian integer into @val and update the current position.

getInt8
bool getInt8(byte val)

Read a signed 8 bit integer into @val and update the current position.

getPos
uint getPos()

Returns the current position of a #GstByteReader instance in bytes.

getRemaining
uint getRemaining()

Returns the remaining number of bytes of a #GstByteReader instance.

getSize
uint getSize()

Returns the total number of bytes of a #GstByteReader instance.

getStringUtf8
bool getStringUtf8(string str)

Returns a constant pointer to the current data position if there is a NUL-terminated string in the data (this could be just a NUL terminator), advancing the current position to the byte after the string. This will work for any NUL-terminated string with a character width of 8 bits, so ASCII, UTF-8, ISO-8859-N etc.

getStruct
void* getStruct()

the main Gtk struct as a void*

getSubReader
bool getSubReader(ByteReader subReader, uint size)

Initializes a #GstByteReader sub-reader instance to contain @size bytes of data from the current position of @reader. This is useful to read chunked formats and make sure that one doesn't read beyond the size of the sub-chunk.

getUint16Be
bool getUint16Be(ushort val)

Read an unsigned 16 bit big endian integer into @val and update the current position.

getUint16Le
bool getUint16Le(ushort val)

Read an unsigned 16 bit little endian integer into @val and update the current position.

getUint24Be
bool getUint24Be(uint val)

Read an unsigned 24 bit big endian integer into @val and update the current position.

getUint24Le
bool getUint24Le(uint val)

Read an unsigned 24 bit little endian integer into @val and update the current position.

getUint32Be
bool getUint32Be(uint val)

Read an unsigned 32 bit big endian integer into @val and update the current position.

getUint32Le
bool getUint32Le(uint val)

Read an unsigned 32 bit little endian integer into @val and update the current position.

getUint64Be
bool getUint64Be(ulong val)

Read an unsigned 64 bit big endian integer into @val and update the current position.

getUint64Le
bool getUint64Le(ulong val)

Read an unsigned 64 bit little endian integer into @val and update the current position.

getUint8
bool getUint8(ubyte val)

Read an unsigned 8 bit integer into @val and update the current position.

init
void init(ubyte[] data)

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

maskedScanUint32
uint maskedScanUint32(uint mask, uint pattern, uint offset, uint size)

Scan for pattern @pattern with applied mask @mask in the byte reader data, starting from offset @offset relative to the current position.

maskedScanUint32Peek
uint maskedScanUint32Peek(uint mask, uint pattern, uint offset, uint size, uint value)

Scan for pattern @pattern with applied mask @mask in the byte reader data, starting from offset @offset relative to the current position.

peekData
bool peekData(ubyte[] val)

Returns a constant pointer to the current data position if at least @size bytes are left and keeps the current position.

peekFloat32Be
bool peekFloat32Be(float val)

Read a 32 bit big endian floating point value into @val but keep the current position.

peekFloat32Le
bool peekFloat32Le(float val)

Read a 32 bit little endian floating point value into @val but keep the current position.

peekFloat64Be
bool peekFloat64Be(double val)

Read a 64 bit big endian floating point value into @val but keep the current position.

peekFloat64Le
bool peekFloat64Le(double val)

Read a 64 bit little endian floating point value into @val but keep the current position.

peekInt16Be
bool peekInt16Be(short val)

Read a signed 16 bit big endian integer into @val but keep the current position.

peekInt16Le
bool peekInt16Le(short val)

Read a signed 16 bit little endian integer into @val but keep the current position.

peekInt24Be
bool peekInt24Be(int val)

Read a signed 24 bit big endian integer into @val but keep the current position.

peekInt24Le
bool peekInt24Le(int val)

Read a signed 24 bit little endian integer into @val but keep the current position.

peekInt32Be
bool peekInt32Be(int val)

Read a signed 32 bit big endian integer into @val but keep the current position.

peekInt32Le
bool peekInt32Le(int val)

Read a signed 32 bit little endian integer into @val but keep the current position.

peekInt64Be
bool peekInt64Be(long val)

Read a signed 64 bit big endian integer into @val but keep the current position.

peekInt64Le
bool peekInt64Le(long val)

Read a signed 64 bit little endian integer into @val but keep the current position.

peekInt8
bool peekInt8(byte val)

Read a signed 8 bit integer into @val but keep the current position.

peekStringUtf8
bool peekStringUtf8(string str)

Returns a constant pointer to the current data position if there is a NUL-terminated string in the data (this could be just a NUL terminator). The current position will be maintained. This will work for any NUL-terminated string with a character width of 8 bits, so ASCII, UTF-8, ISO-8859-N etc.

peekSubReader
bool peekSubReader(ByteReader subReader, uint size)

Initializes a #GstByteReader sub-reader instance to contain @size bytes of data from the current position of @reader. This is useful to read chunked formats and make sure that one doesn't read beyond the size of the sub-chunk.

peekUint16Be
bool peekUint16Be(ushort val)

Read an unsigned 16 bit big endian integer into @val but keep the current position.

peekUint16Le
bool peekUint16Le(ushort val)

Read an unsigned 16 bit little endian integer into @val but keep the current position.

peekUint24Be
bool peekUint24Be(uint val)

Read an unsigned 24 bit big endian integer into @val but keep the current position.

peekUint24Le
bool peekUint24Le(uint val)

Read an unsigned 24 bit little endian integer into @val but keep the current position.

peekUint32Be
bool peekUint32Be(uint val)

Read an unsigned 32 bit big endian integer into @val but keep the current position.

peekUint32Le
bool peekUint32Le(uint val)

Read an unsigned 32 bit little endian integer into @val but keep the current position.

peekUint64Be
bool peekUint64Be(ulong val)

Read an unsigned 64 bit big endian integer into @val but keep the current position.

peekUint64Le
bool peekUint64Le(ulong val)

Read an unsigned 64 bit little endian integer into @val but keep the current position.

peekUint8
bool peekUint8(ubyte val)

Read an unsigned 8 bit integer into @val but keep the current position.

setPos
bool setPos(uint pos)

Sets the new position of a #GstByteReader instance to @pos in bytes.

skip
bool skip(uint nbytes)

Skips @nbytes bytes of the #GstByteReader instance.

skipStringUtf16
bool skipStringUtf16()

Skips a NUL-terminated UTF-16 string in the #GstByteReader instance, advancing the current position to the byte after the string.

skipStringUtf32
bool skipStringUtf32()

Skips a NUL-terminated UTF-32 string in the #GstByteReader instance, advancing the current position to the byte after the string.

skipStringUtf8
bool skipStringUtf8()

Skips a NUL-terminated string in the #GstByteReader instance, advancing the current position to the byte after the string. This will work for any NUL-terminated string with a character width of 8 bits, so ASCII, UTF-8, ISO-8859-N etc. No input checking for valid UTF-8 is done.

Variables

gstByteReader
GstByteReader* gstByteReader;

the main Gtk struct

ownedRef
bool ownedRef;
Undocumented in source.

Meta