Utils

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

calculateLinearRegression
bool calculateLinearRegression(GstClockTime* xy, GstClockTime* temp, uint n, GstClockTime mNum, GstClockTime mDenom, GstClockTime b, GstClockTime xbase, double rSquared)

Calculates the linear regression of the values @xy and places the result in @m_num, @m_denom, @b and @xbase, representing the function y(x) = m_num/m_denom * (x - xbase) + b that has the least-square distance from all points @x and @y.

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

Transforms a #gdouble to a fraction and simplifies the result.

dumpMem
void dumpMem(char[] mem)

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

dynamicTypeRegister
bool dynamicTypeRegister(Plugin plugin, GType type)

Registers a new #GstDynamicTypeFactory in the registry

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)
getObjectArray
bool getObjectArray(ObjectG object, string name, ValueArray array)

Get a property of type %GST_TYPE_ARRAY and transform it into a #GValueArray. This allow language bindings to get GST_TYPE_ARRAY properties which are otherwise not an accessible type.

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.

setObjectArray
bool setObjectArray(ObjectG object, string name, ValueArray array)

Transfer a #GValueArray to %GST_TYPE_ARRAY and set this value on the specified property name. This allow language bindings to set GST_TYPE_ARRAY properties which are otherwise not an accessible type.

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