Browse Source

lavu/rational: add syntactic sugar.

Add a function to create a rational
and macros for common values.
Nicolas George 11 years ago
parent
commit
3532dd52c5
3 changed files with 15 additions and 1 deletions
  1. 3 0
      doc/APIchanges
  2. 11 0
      libavutil/rational.h
  3. 1 1
      libavutil/version.h

+ 3 - 0
doc/APIchanges

@@ -15,6 +15,9 @@ libavutil:     2012-10-22
 
 API changes, most recent first:
 
+2014-01-19 - xxxxxxx - lavu 52.63.100 - rational.h
+  Add av_make_q() function.
+
 2013-12-xx - xxxxxxx - lavu 53.2.0 - frame.h
   Add AV_FRAME_DATA_MATRIXENCODING value to the AVFrameSideDataType enum, which
   identifies AVMatrixEncoding data.

+ 11 - 0
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

+ 1 - 1
libavutil/version.h

@@ -56,7 +56,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  52
-#define LIBAVUTIL_VERSION_MINOR  62
+#define LIBAVUTIL_VERSION_MINOR  63
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \