From 3532dd52c51f3d4b95f31d1b195e64a04a8aea5d Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Tue, 31 Dec 2013 14:07:25 +0100 Subject: lavu/rational: add syntactic sugar. Add a function to create a rational and macros for common values. --- libavutil/rational.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libavutil/rational.h') diff --git a/libavutil/rational.h b/libavutil/rational.h index b9800ee360..7439701db2 100644 --- a/libavutil/rational.h +++ b/libavutil/rational.h @@ -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 -- cgit v1.2.3