[vlc-commits] AVformat: use a similar compat detection than AVcodec

Jean-Baptiste Kempf git at videolan.org
Tue May 20 11:07:26 CEST 2014


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue May 20 10:58:17 2014 +0200| [5e192e1ed443194fc554a90c8fdd018a4d77d68c] | committer: Jean-Baptiste Kempf

AVformat: use a similar compat detection than AVcodec

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5e192e1ed443194fc554a90c8fdd018a4d77d68c
---

 modules/codec/avcodec/avcommon_compat.h |   14 ++++++++++++++
 modules/demux/avformat/demux.c          |   11 ++---------
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h
index 0c02010..12b598d 100644
--- a/modules/codec/avcodec/avcommon_compat.h
+++ b/modules/codec/avcodec/avcommon_compat.h
@@ -506,4 +506,18 @@ enum {
 
 #endif /* HAVE_LIBAVUTIL_AVUTIL_H */
 
+#ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
+# include <libavformat/avformat.h>
+
+#define LIBAVFORMAT_VERSION_CHECK( a, b, c, d, e ) \
+    ( (LIBAVFORMAT_VERSION_MICRO <  100 && LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \
+      (LIBAVFORMAT_VERSION_MICRO >= 100 && LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) )
+
+#if LIBAVFORMAT_VERSION_MAJOR < 54
+# define AVDictionaryEntry AVMetadataTag
+# define av_dict_get av_metadata_get
+#endif
+
+#endif
+
 #endif
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 9eebac6..8f64d20 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -38,21 +38,14 @@
 #include <vlc_charset.h>
 #include <vlc_avcodec.h>
 
-#include <libavformat/avformat.h>
-
 #include "../../codec/avcodec/avcodec.h"
 #include "../../codec/avcodec/chroma.h"
-#include "../../codec/avcodec/avcommon.h"
+#include "../../codec/avcodec/avcommon_compat.h"
 #include "avformat.h"
 #include "../xiph.h"
 #include "../vobsub.h"
 
-/* Support for deprecated APIs */
-
-#if LIBAVFORMAT_VERSION_MAJOR < 54
-# define AVDictionaryEntry AVMetadataTag
-# define av_dict_get av_metadata_get
-#endif
+#include <libavformat/avformat.h>
 
 //#define AVFORMAT_DEBUG 1
 



More information about the vlc-commits mailing list