Utils

Members

Static functions

arrayBinarySearch
void* arrayBinarySearch(void* array, uint numElements, size_t 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.

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
bool 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
bool 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.

gdoubleToGuint64
ulong gdoubleToGuint64(double value)
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.

guint64ToGdouble
double guint64ToGdouble(ulong value)
seqnumCompare
int seqnumCompare(uint s1, uint s2)

Compare two sequence numbers, handling wraparound.

seqnumNext
uint seqnumNext()

Return a constantly incrementing sequence number.

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

Converts the string value to the type of the objects argument and sets the argument with it.

setValueFromString
void setValueFromString(Value value, string valueStr)

Converts the string to the type of the value and sets the value with it.

uint64Scale
ulong uint64Scale(ulong val, ulong num, ulong denom)

Scale @val by the rational number @num / @denom, avoiding overflows and underflows and without loss of precision.

uint64ScaleCeil
ulong uint64ScaleCeil(ulong val, ulong num, ulong denom)

Scale @val by the rational number @num / @denom, avoiding overflows and underflows and without loss of precision.

uint64ScaleInt
ulong uint64ScaleInt(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.

uint64ScaleIntCeil
ulong uint64ScaleIntCeil(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.

uint64ScaleIntRound
ulong uint64ScaleIntRound(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.

uint64ScaleRound
ulong uint64ScaleRound(ulong val, ulong num, ulong denom)

Scale @val by the rational number @num / @denom, avoiding overflows and underflows and without loss of precision.

Meta