ffmpeg.libavutil.rational

Undocumented in source.

Members

Functions

av_add_q
AVRational av_add_q(AVRational b, AVRational c)

Add two rationals. @param b first rational @param c second rational @return b+c

av_d2q
AVRational av_d2q(double d, int max)

Convert a double precision floating point number to a rational. inf is expressed as {1,0} or {-1,0} depending on the sign.

av_div_q
AVRational av_div_q(AVRational b, AVRational c)

Divide one rational by another. @param b first rational @param c second rational @return b/c

av_find_nearest_q_idx
int av_find_nearest_q_idx(AVRational q, AVRational* q_list)

Find the nearest value in q_list to q. @param q_list an array of rationals terminated by {0, 0} @return the index of the nearest value found in the array

av_mul_q
AVRational av_mul_q(AVRational b, AVRational c)

Multiply two rationals. @param b first rational @param c second rational @return b*c

av_nearer_q
int av_nearer_q(AVRational q, AVRational q1, AVRational q2)

@return 1 if q1 is nearer to q than q2, -1 if q2 is nearer than q1, 0 if they have the same distance.

av_q2intfloat
uint32_t av_q2intfloat(AVRational q)

Converts a AVRational to a IEEE 32bit float.

av_reduce
int av_reduce(int* dst_num, int* dst_den, int64_t num, int64_t den, int64_t max)

Reduce a fraction. This is useful for framerate calculations. @param dst_num destination numerator @param dst_den destination denominator @param num source numerator @param den source denominator @param max the maximum allowed for dst_num & dst_den @return 1 if exact, 0 otherwise

av_sub_q
AVRational av_sub_q(AVRational b, AVRational c)

Subtract one rational from another. @param b first rational @param c second rational @return b-c

Static functions

av_cmp_q
int av_cmp_q(AVRational a, AVRational b)

Compare two rationals. @param a first rational @param b second rational @return 0 if a==b, 1 if a>b, -1 if a<b, and INT_MIN if one of the values is of the form 0/0

av_inv_q
AVRational av_inv_q(AVRational q)

Invert a rational. @param q value @return 1 / q

av_make_q
AVRational av_make_q(int num, int den)

Create a rational. Useful for compilers that do not support compound literals. @note The return value is not reduced.

av_q2d
double av_q2d(AVRational a)

Convert rational to double. @param a rational to convert @return (double) a

Structs

AVRational
struct AVRational

rational number numerator/denominator

Meta