It was never a good idea to have tehse values as defines in the first place,
since they are internal values, and may change.

This also fixes the impossibility of using AV_TIME_BASE_Q in pre-C99/C++
applications, which cannot use compound literals directly in their code.

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

diff --git a/doc/APIchanges b/doc/APIchanges
index 60e16d8..4fd7cfa 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,10 @@ libavutil:     2013-12-xx
 
 API changes, most recent first:
 
+2013-12-xx - xxxxxxx - lavu 52.21.0 - avutil.h
+  Add av_get_time_base() and deprecate AV_TIME_BASE.
+  Add av_get_time_base_q() and deprecate AV_TIME_BASE_Q.
+
 2013-12-xx - xxxxxxx - lavc 55.30.0 - avcodec.h
   Add HEVC profiles
 
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index a0d35d1..bc3b9d5 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -228,18 +228,6 @@ enum AVMediaType {
 #define AV_NOPTS_VALUE          INT64_C(0x8000000000000000)
 
 /**
- * Internal time base represented as integer
- */
-
-#define AV_TIME_BASE            1000000
-
-/**
- * Internal time base represented as fractional value
- */
-
-#define AV_TIME_BASE_Q          (AVRational){1, AV_TIME_BASE}
-
-/**
  * @}
  * @}
  * @defgroup lavu_picture Image related
@@ -273,6 +261,7 @@ char av_get_picture_type_char(enum AVPictureType pict_type);
  */
 
 #include "error.h"
+#include "rational.h"
 #include "version.h"
 #include "macros.h"
 
@@ -281,4 +270,32 @@ char av_get_picture_type_char(enum AVPictureType 
pict_type);
  * @}
  */
 
+/**
+ * Returns the integer representation of the internal time base.
+ */
+int av_get_time_base(void);
+
+/**
+ * Returns the fractional representation of the internal time base.
+ */
+AVRational av_get_time_base_q(void);
+
+#if FF_API_TIME_BASE
+/**
+ * Internal time base represented as integer
+ *
+ * @deprecated use av_get_time_base().
+ */
+
+#define AV_TIME_BASE            1000000
+
+/**
+ * Internal time base represented as fractional value
+ *
+ * @deprecated use av_get_time_base_q().
+ */
+
+#define AV_TIME_BASE_Q          (AVRational){1, AV_TIME_BASE}
+#endif
+
 #endif /* AVUTIL_AVUTIL_H */
diff --git a/libavutil/utils.c b/libavutil/utils.c
index 9b18c97..1c86e42 100644
--- a/libavutil/utils.c
+++ b/libavutil/utils.c
@@ -53,3 +53,13 @@ char av_get_picture_type_char(enum AVPictureType pict_type)
     default:                 return '?';
     }
 }
+
+int av_get_time_base(void)
+{
+    return 1000000;
+}
+
+AVRational av_get_time_base_q(void)
+{
+    return (AVRational){1, AV_TIME_BASE};
+}
diff --git a/libavutil/version.h b/libavutil/version.h
index ed7d13a..5b7161f 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -54,7 +54,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR 53
-#define LIBAVUTIL_VERSION_MINOR  0
+#define LIBAVUTIL_VERSION_MINOR  1
 #define LIBAVUTIL_VERSION_MICRO  0
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -108,6 +108,9 @@
 #ifndef FF_API_XVMC
 #define FF_API_XVMC                     (LIBAVUTIL_VERSION_MAJOR < 54)
 #endif
+#ifndef FF_API_TIME_BASE
+#define FF_API_TIME_BASE                (LIBAVUTIL_VERSION_MAJOR < 54)
+#endif
 
 /**
  * @}
-- 
1.8.5.2

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

Reply via email to