diff options
author | Nicolas George <george@nsup.org> | 2013-12-31 14:07:25 +0100 |
---|---|---|
committer | Nicolas George <george@nsup.org> | 2014-01-19 17:12:22 +0100 |
commit | 3532dd52c51f3d4b95f31d1b195e64a04a8aea5d (patch) | |
tree | 0e02b4f53b0e7df9c1971d1899068314a47af590 /libavutil/rational.h | |
parent | 56072421559342c959de87a402b9d65de598f41e (diff) | |
download | ffmpeg-3532dd52c51f3d4b95f31d1b195e64a04a8aea5d.tar.gz |
lavu/rational: add syntactic sugar.
Add a function to create a rational
and macros for common values.
Diffstat (limited to 'libavutil/rational.h')
-rw-r--r-- | libavutil/rational.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavutil/rational.h b/libavutil/rational.h index b9800ee360..7439701db2 100644 --- a/libavutil/rational.h +++ b/libavutil/rational.h @@ -46,6 +46,17 @@ typedef struct AVRational{ } 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 * @param b second rational |