This fixes usage of AV_TIME_BASE_Q in C++ applications, which
cannot use compound literals directly in their code.

Signed-off-by: Derek Buitenhuis <[email protected]>
---
 doc/APIchanges      | 3 +++
 libavutil/avutil.h  | 8 +++++++-
 libavutil/utils.c   | 5 +++++
 libavutil/version.h | 2 +-
 4 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 1e380e9..0a380f3 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil:     2012-10-22
 
 API changes, most recent first:
 
+2013-12-xx - xxxxxxx - lavu 52.20.0 - avutil.h
+  Add av_get_time_base_q().
+
 2013-11-xx - xxxxxxx- - lavu 52.19.0 - frame.h
   Add AV_FRAME_DATA_A53_CC value to the AVFrameSideDataType enum, which
   identifies ATSC A53 Part 4 Closed Captions data.
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index 6bb5510..94b909a 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -268,7 +268,7 @@ enum AVMediaType {
  * Internal time base represented as fractional value
  */
 
-#define AV_TIME_BASE_Q          (AVRational){1, AV_TIME_BASE}
+#define AV_TIME_BASE_Q          av_get_time_base_q()
 
 /**
  * @}
@@ -304,6 +304,7 @@ char av_get_picture_type_char(enum AVPictureType pict_type);
  */
 
 #include "error.h"
+#include "rational.h"
 #include "version.h"
 
 /**
@@ -311,4 +312,9 @@ char av_get_picture_type_char(enum AVPictureType pict_type);
  * @}
  */
 
+/**
+ * Returns the fractional representation of the internal time base.
+ */
+AVRational av_get_time_base_q(void);
+
 #endif /* AVUTIL_AVUTIL_H */
diff --git a/libavutil/utils.c b/libavutil/utils.c
index 9b18c97..d5428fd 100644
--- a/libavutil/utils.c
+++ b/libavutil/utils.c
@@ -53,3 +53,8 @@ char av_get_picture_type_char(enum AVPictureType pict_type)
     default:                 return '?';
     }
 }
+
+av_always_inline AVRational av_get_time_base_q(void)
+{
+    return (AVRational){1, AV_TIME_BASE};
+}
diff --git a/libavutil/version.h b/libavutil/version.h
index fa1f53b..dad8e2f 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -37,7 +37,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR 52
-#define LIBAVUTIL_VERSION_MINOR 19
+#define LIBAVUTIL_VERSION_MINOR 20
 #define LIBAVUTIL_VERSION_MICRO  0
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
1.8.5

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to