Utils

class Utils {}

Members

Static functions

GDOUBLE_SWAP_LE_BE
double GDOUBLE_SWAP_LE_BE(double inn)

Swap byte order of a 64-bit floating point value (double).

GFLOAT_SWAP_LE_BE
float GFLOAT_SWAP_LE_BE(float inn)

Swap byte order of a 32-bit floating point value (float).

GST_READ_DOUBLE_BE
double GST_READ_DOUBLE_BE(ubyte* data)

Read a 64 bit double value in big endian format from the memory buffer.

GST_READ_DOUBLE_LE
double GST_READ_DOUBLE_LE(ubyte* data)

Read a 64 bit double value in little endian format from the memory buffer.

GST_READ_FLOAT_BE
float GST_READ_FLOAT_BE(ubyte* data)

Read a 32 bit float value in big endian format from the memory buffer.

GST_READ_FLOAT_LE
float GST_READ_FLOAT_LE(ubyte* data)

Read a 32 bit float value in little endian format from the memory buffer.

GST_WRITE_DOUBLE_BE
void GST_WRITE_DOUBLE_BE(ubyte* data, double num)

Store a 64 bit double value in big endian format into the memory buffer.

GST_WRITE_DOUBLE_LE
void GST_WRITE_DOUBLE_LE(ubyte* data, double num)

Store a 64 bit double value in little endian format into the memory buffer.

GST_WRITE_FLOAT_BE
void GST_WRITE_FLOAT_BE(ubyte* data, float num)

Store a 32 bit float value in big endian format into the memory buffer.

GST_WRITE_FLOAT_LE
void GST_WRITE_FLOAT_LE(ubyte* data, float num)

Store a 32 bit float value in little endian format into the memory buffer.

arrayBinarySearch
void* arrayBinarySearch(void* array, uint numElements, gsize elementSize, GCompareDataFunc searchFunc, GstSearchMode mode, void* searchData, void* userData)

Searches inside array for search_data by using the comparison function search_func. array must be sorted ascending. As search_data is always passed as second argument to search_func it's not required that search_data has the same type as the array elements. The complexity of this search function is O(log (num_elements)).

doubleToFraction
void doubleToFraction(double src, int destN, int destD)

Transforms a gdouble to a fraction and simplifies the result.

dumpMem
void dumpMem(char* mem, uint size)

Dumps the memory block into a hex representation. Useful for debugging.

fractionAdd
int fractionAdd(int aN, int aD, int bN, int bD, int resN, int resD)

Adds the fractions a_n/a_d and b_n/b_d and stores the result in res_n and res_d.

fractionCompare
int fractionCompare(int aN, int aD, int bN, int bD)

Compares the fractions a_n/a_d and b_n/b_d and returns -1 if a < b, 0 if a = b and 1 if a > b.

fractionMultiply
int fractionMultiply(int aN, int aD, int bN, int bD, int resN, int resD)

Multiplies the fractions a_n/a_d and b_n/b_d and stores the result in res_n and res_d.

fractionToDouble
void fractionToDouble(int srcN, int srcD, double dest)

Transforms a fraction to a gdouble.

getTimestamp
GstClockTime getTimestamp()

Get a timestamp as GstClockTime to be used for interval measurements. The timestamp should not be interpreted in any other way.

greatestCommonDivisor
int greatestCommonDivisor(int a, int b)

Calculates the greatest common divisor of a and b.

greatestCommonDivisorInt64
long greatestCommonDivisorInt64(long a, long b)

Calculates the greatest common divisor of a and b.

groupIdNext
uint groupIdNext()

Return a constantly incrementing group id. This function is used to generate a new group-id for the stream-start event.

seqnumCompare
int seqnumCompare(uint s1, uint s2)

Compare two sequence numbers, handling wraparound. The current implementation just returns (gint32)(s1 - s2).

seqnumNext
uint seqnumNext()

Return a constantly incrementing sequence number. This function is used internally to GStreamer to be able to determine which events and messages are "the same". For example, elements may set the seqnum on a segment-done message to be the same as that of the last seek event, to indicate that event and the message correspond to the same segment.

setObjectArg
void setObjectArg(ObjectG object, string name, string value)

Convertes the string value to the type of the objects argument and sets the argument with it. Note that this function silently returns if object has no property named name or when value cannot be converted to the type of the property.

setValueFromString
void setValueFromString(Value value, string valueStr)

Converts the string to the type of the value and sets the value with it. Note that this function is dangerous as it does not return any indication if the conversion worked or not.

uint64_Scale
ulong uint64_Scale(ulong val, ulong num, ulong denom)

Scale val by the rational number num / denom, avoiding overflows and underflows and without loss of precision. This function can potentially be very slow if val and num are both greater than G_MAXUINT32.

uint64_ScaleCeil
ulong uint64_ScaleCeil(ulong val, ulong num, ulong denom)

Scale val by the rational number num / denom, avoiding overflows and underflows and without loss of precision. This function can potentially be very slow if val and num are both greater than G_MAXUINT32.

uint64_ScaleInt
ulong uint64_ScaleInt(ulong val, int num, int denom)

Scale val by the rational number num / denom, avoiding overflows and underflows and without loss of precision. num must be non-negative and denom must be positive.

uint64_ScaleIntCeil
ulong uint64_ScaleIntCeil(ulong val, int num, int denom)

Scale val by the rational number num / denom, avoiding overflows and underflows and without loss of precision. num must be non-negative and denom must be positive.

uint64_ScaleIntRound
ulong uint64_ScaleIntRound(ulong val, int num, int denom)

Scale val by the rational number num / denom, avoiding overflows and underflows and without loss of precision. num must be non-negative and denom must be positive.

uint64_ScaleRound
ulong uint64_ScaleRound(ulong val, ulong num, ulong denom)

Scale val by the rational number num / denom, avoiding overflows and underflows and without loss of precision. This function can potentially be very slow if val and num are both greater than G_MAXUINT32.

Meta