Current byte position
Data from which the bit reader will read
Size of data
in bytes
Free-function: g_free
Returns a newly-allocated copy of the current data
position if at least size
bytes are left and
updates the current position. Free with g_free() when no longer needed.
Free-function: g_free
Returns a newly-allocated copy of the current data position if there is a NUL-terminated UTF-16 string in the data (this could be an empty string as well), and advances the current position.
No input checking for valid UTF-16 is done. This function is endianness agnostic - you should not assume the UTF-16 characters are in host endianness.
This function will fail if no NUL-terminator was found in in the data.
Note: there is no peek or get variant of this function to ensure correct byte alignment of the UTF-16 string.
Free-function: g_free
Returns a newly-allocated copy of the current data position if there is a NUL-terminated UTF-32 string in the data (this could be an empty string as well), and advances the current position.
No input checking for valid UTF-32 is done. This function is endianness agnostic - you should not assume the UTF-32 characters are in host endianness.
This function will fail if no NUL-terminator was found in in the data.
Note: there is no peek or get variant of this function to ensure correct byte alignment of the UTF-32 string.
Free-function: g_free
FIXME:Reads (copies) 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.
This function will fail if no NUL-terminator was found in in the data.
Frees a #GstByteReader instance, which was previously allocated by gst_byte_reader_new().
Returns a constant pointer to the current data
position if at least size
bytes are left and
updates the current position.
Read a 32 bit big endian floating point value into val
and update the current position.
Read a 32 bit little endian floating point value into val
and update the current position.
Read a 64 bit big endian floating point value into val
and update the current position.
Read a 64 bit little endian floating point value into val
and update the current position.
Read a signed 16 bit big endian integer into val
and update the current position.
Read a signed 16 bit little endian integer into val
and update the current position.
Read a signed 24 bit big endian integer into val
and update the current position.
Read a signed 24 bit little endian integer into val
and update the current position.
Read a signed 32 bit big endian integer into val
and update the current position.
Read a signed 32 bit little endian integer into val
and update the current position.
Read a signed 64 bit big endian integer into val
and update the current position.
Read a signed 64 bit little endian integer into val
and update the current position.
Read a signed 8 bit integer into val
and update the current position.
Returns the current position of a #GstByteReader instance in bytes.
Returns the remaining number of bytes of a #GstByteReader instance.
Returns the total number of bytes of a #GstByteReader instance.
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.
No input checking for valid UTF-8 is done.
This function will fail if no NUL-terminator was found in in the data.
Read an unsigned 16 bit big endian integer into val
and update the current position.
Read an unsigned 16 bit little endian integer into val
and update the current position.
Read an unsigned 24 bit big endian integer into val
and update the current position.
Read an unsigned 24 bit little endian integer into val
and update the current position.
Read an unsigned 32 bit big endian integer into val
and update the current position.
Read an unsigned 32 bit little endian integer into val
and update the current position.
Read an unsigned 64 bit big endian integer into val
and update the current position.
Read an unsigned 64 bit little endian integer into val
and update the current position.
Read an unsigned 8 bit integer into val
and update the current position.
Initializes a #GstByteReader instance to read from data
. This function
can be called on already initialized instances.
data from which the #GstByteReader should read
Scan for pattern pattern
with applied mask mask
in the byte reader data,
starting from offset offset
relative to the current position.
The bytes in pattern
and mask
are interpreted left-to-right, regardless
of endianness. All four bytes of the pattern must be present in the
byte reader data for it to match, even if the first or last bytes are masked
out.
It is an error to call this function without making sure that there is enough data (offset+size bytes) in the byte reader.
mask to apply to data before matching against pattern
pattern to match (after mask is applied)
offset from which to start scanning, relative to the current position
number of bytes to scan from offset
Scan for pattern pattern
with applied mask mask
in the byte reader data,
starting from offset offset
relative to the current position.
The bytes in pattern
and mask
are interpreted left-to-right, regardless
of endianness. All four bytes of the pattern must be present in the
byte reader data for it to match, even if the first or last bytes are masked
out.
It is an error to call this function without making sure that there is enough data (offset+size bytes) in the byte reader.
mask to apply to data before matching against pattern
pattern to match (after mask is applied)
offset from which to start scanning, relative to the current position
number of bytes to scan from offset
Returns a constant pointer to the current data
position if at least size
bytes are left and
keeps the current position.
Read a 32 bit big endian floating point value into val
but keep the current position.
Read a 32 bit little endian floating point value into val
but keep the current position.
Read a 64 bit big endian floating point value into val
but keep the current position.
Read a 64 bit little endian floating point value into val
but keep the current position.
Read a signed 16 bit big endian integer into val
but keep the current position.
Read a signed 16 bit little endian integer into val
but keep the current position.
Read a signed 24 bit big endian integer into val
but keep the current position.
Read a signed 24 bit little endian integer into val
but keep the current position.
Read a signed 32 bit big endian integer into val
but keep the current position.
Read a signed 32 bit little endian integer into val
but keep the current position.
Read a signed 64 bit big endian integer into val
but keep the current position.
Read a signed 64 bit little endian integer into val
but keep the current position.
Read a signed 8 bit integer into val
but keep the current position.
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.
No input checking for valid UTF-8 is done.
This function will fail if no NUL-terminator was found in in the data.
Read an unsigned 16 bit big endian integer into val
but keep the current position.
Read an unsigned 16 bit little endian integer into val
but keep the current position.
Read an unsigned 24 bit big endian integer into val
but keep the current position.
Read an unsigned 24 bit little endian integer into val
but keep the current position.
Read an unsigned 32 bit big endian integer into val
but keep the current position.
Read an unsigned 32 bit little endian integer into val
but keep the current position.
Read an unsigned 64 bit big endian integer into val
but keep the current position.
Read an unsigned 64 bit little endian integer into val
but keep the current position.
Read an unsigned 8 bit integer into val
but keep the current position.
Sets the new position of a #GstByteReader instance to pos
in bytes.
The new position in bytes
Skips nbytes
bytes of the #GstByteReader instance.
the number of bytes to skip
Skips a NUL-terminated UTF-16 string in the #GstByteReader instance, advancing the current position to the byte after the string.
No input checking for valid UTF-16 is done.
This function will fail if no NUL-terminator was found in in the data.
Skips a NUL-terminated UTF-32 string in the #GstByteReader instance, advancing the current position to the byte after the string.
No input checking for valid UTF-32 is done.
This function will fail if no NUL-terminator was found in in the data.
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.
This function will fail if no NUL-terminator was found in in the data.
#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.