lavu/rational: add syntactic sugar.

Add a function to create a rational
and macros for common values.
This commit is contained in:
Nicolas George
2013-12-31 14:07:25 +01:00
parent 5607242155
commit 3532dd52c5
3 changed files with 15 additions and 1 deletions

View File

@@ -45,6 +45,17 @@ typedef struct AVRational{
int den; ///< denominator
} AVRational;
/**
* Create a rational.
* Useful for compilers that do not support compound literals.
* @note The return value is not reduced.
*/
static inline AVRational av_make_q(int num, int den)
{
AVRational r = { num, den };
return r;
}
/**
* Compare two rationals.
* @param a first rational