ByteWriter

#GstByteWriter provides a byte writer and reader that can write/read different integer and floating point types to/from a memory buffer. It provides functions for writing/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 write/read NUL-terminated strings in various character encodings.

Constructors

this
this(GstByteWriter* gstByteWriter, bool ownedRef)

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

this
this()

Creates a new, empty #GstByteWriter instance

this
this(ubyte[] data, bool initialized)

Creates a new #GstByteWriter instance with the given memory area. If @initialized is %TRUE it is possible to read @size bytes from the #GstByteWriter from the beginning.

this
this(uint size, bool fixed)

Creates a new #GstByteWriter instance with the given initial data size.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

ensureFreeSpace
bool ensureFreeSpace(uint size)

Checks if enough free space from the current write cursor is available and reallocates if necessary.

fill
bool fill(ubyte value, uint size)

Writes @size bytes containing @value to @writer.

free
void free()

Frees @writer and all memory allocated by it.

freeAndGetBuffer
Buffer freeAndGetBuffer()

Frees @writer and all memory allocated by it except the current data, which is returned as #GstBuffer.

freeAndGetData
ubyte[] freeAndGetData()

Frees @writer and all memory allocated by it except the current data, which is returned.

getByteWriterStruct
GstByteWriter* getByteWriterStruct(bool transferOwnership)

Get the main Gtk struct

getRemaining
uint getRemaining()

Returns the remaining size of data that can still be written. If -1 is returned the remaining size is only limited by system resources.

getStruct
void* getStruct()

the main Gtk struct as a void*

init
void init()

Initializes @writer to an empty instance

initWithData
void initWithData(ubyte[] data, bool initialized)

Initializes @writer with the given memory area. If @initialized is %TRUE it is possible to read @size bytes from the #GstByteWriter from the beginning.

initWithSize
void initWithSize(uint size, bool fixed)

Initializes @writer with the given initial data size.

putBuffer
bool putBuffer(Buffer buffer, size_t offset, ptrdiff_t size)

Writes @size bytes of @data to @writer.

putData
bool putData(ubyte[] data)

Writes @size bytes of @data to @writer.

putFloat32Be
bool putFloat32Be(float val)

Writes a big endian 32 bit float to @writer.

putFloat32Le
bool putFloat32Le(float val)

Writes a little endian 32 bit float to @writer.

putFloat64Be
bool putFloat64Be(double val)

Writes a big endian 64 bit float to @writer.

putFloat64Le
bool putFloat64Le(double val)

Writes a little endian 64 bit float to @writer.

putInt16Be
bool putInt16Be(short val)

Writes a signed big endian 16 bit integer to @writer.

putInt16Le
bool putInt16Le(short val)

Writes a signed little endian 16 bit integer to @writer.

putInt24Be
bool putInt24Be(int val)

Writes a signed big endian 24 bit integer to @writer.

putInt24Le
bool putInt24Le(int val)

Writes a signed little endian 24 bit integer to @writer.

putInt32Be
bool putInt32Be(int val)

Writes a signed big endian 32 bit integer to @writer.

putInt32Le
bool putInt32Le(int val)

Writes a signed little endian 32 bit integer to @writer.

putInt64Be
bool putInt64Be(long val)

Writes a signed big endian 64 bit integer to @writer.

putInt64Le
bool putInt64Le(long val)

Writes a signed little endian 64 bit integer to @writer.

putInt8
bool putInt8(byte val)

Writes a signed 8 bit integer to @writer.

putStringUtf16
bool putStringUtf16(ushort[] data)

Writes a NUL-terminated UTF16 string to @writer (including the terminator).

putStringUtf32
bool putStringUtf32(uint[] data)

Writes a NUL-terminated UTF32 string to @writer (including the terminator).

putStringUtf8
bool putStringUtf8(string data)

Writes a NUL-terminated UTF8 string to @writer (including the terminator).

putUint16Be
bool putUint16Be(ushort val)

Writes a unsigned big endian 16 bit integer to @writer.

putUint16Le
bool putUint16Le(ushort val)

Writes a unsigned little endian 16 bit integer to @writer.

putUint24Be
bool putUint24Be(uint val)

Writes a unsigned big endian 24 bit integer to @writer.

putUint24Le
bool putUint24Le(uint val)

Writes a unsigned little endian 24 bit integer to @writer.

putUint32Be
bool putUint32Be(uint val)

Writes a unsigned big endian 32 bit integer to @writer.

putUint32Le
bool putUint32Le(uint val)

Writes a unsigned little endian 32 bit integer to @writer.

putUint64Be
bool putUint64Be(ulong val)

Writes a unsigned big endian 64 bit integer to @writer.

putUint64Le
bool putUint64Le(ulong val)

Writes a unsigned little endian 64 bit integer to @writer.

putUint8
bool putUint8(ubyte val)

Writes a unsigned 8 bit integer to @writer.

reset
void reset()

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

resetAndGetBuffer
Buffer resetAndGetBuffer()

Resets @writer and returns the current data as buffer.

resetAndGetData
ubyte[] resetAndGetData()

Resets @writer and returns the current data.

Variables

gstByteWriter
GstByteWriter* gstByteWriter;

the main Gtk struct

ownedRef
bool ownedRef;
Undocumented in source.

Meta