From: Derek Buitenhuis <[email protected]>

Deprecate AV_TIME_BASE{_Q, } and provide  av_time_base{_q, }()
to access this value.

This way the internal timebase can change without impacting the user
and using accessors makes the life of foreing language users much
easier.

Signed-off-by: Derek Buitenhuis <[email protected]>
Signed-off-by: Luca Barbato <[email protected]>
---

Different message, apichanges changed, doxy fixed, different naming.

 doc/APIchanges      |  4 ++++
 libavutil/avutil.h  | 50 ++++++++++++++++++++++++++++++++++++++------------
 libavutil/utils.c   | 10 ++++++++++
 libavutil/version.h |  5 ++++-
 4 files changed, 56 insertions(+), 13 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 60e16d8..c256548 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 53.1.0 - avutil.h
+  Add av_time_base() and deprecate AV_TIME_BASE.
+  Add av_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..0981dd3 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,41 @@ char av_get_picture_type_char(enum AVPictureType 
pict_type);
  * @}
  */

+/**
+ * @addtogroup lavu_time
+ * @{
+ */
+
+/**
+ * Return the integer representation of the internal time base
+ */
+int av_time_base(void);
+
+/**
+ * Return the fractional representation of the internal time base
+ */
+AVRational av_time_base_q(void);
+
+#if FF_API_TIME_BASE
+/**
+ * Internal time base represented as integer
+ *
+ * @deprecated use av_time_base().
+ */
+
+#define AV_TIME_BASE            1000000
+
+/**
+ * Internal time base represented as fractional value
+ *
+ * @deprecated use av_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..5a90662 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_time_base(void)
+{
+    return 1000000;
+}
+
+AVRational av_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.1

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

Reply via email to