From 800c289a6693c5651072f13a0aafb634ba75ffc7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=C3=A5ns=20Rullg=C3=A5rd?= <mans@mansr.com>
Date: Tue, 26 Feb 2008 20:37:59 +0000
Subject: [PATCH] less preprocessor magic in version number macros

Originally committed as revision 12246 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 configure                 |  2 +-
 libavcodec/avcodec.h      | 14 ++++++++++----
 libavdevice/avdevice.h    | 12 +++++++++---
 libavformat/avformat.h    | 14 ++++++++++----
 libavutil/avutil.h        | 24 ++++++++++++++----------
 libpostproc/postprocess.h | 14 ++++++++++----
 6 files changed, 54 insertions(+), 26 deletions(-)

diff --git a/configure b/configure
index 065bccc8bc3..641602cb325 100755
--- a/configure
+++ b/configure
@@ -2009,7 +2009,7 @@ fi
 get_version(){
     name=$1
     file=$source_path/$2
-    grep "#define ${name}_VERSION_TRIPLET " "$file" | sed 's/[^0-9,]//g' | tr , .
+    printf '%s.%s.%s' $(grep "#define ${name}_VERSION_M" "$file" | sed 's/[^0-9]//g')
 }
 
 sws_version=$(get_version  LIBSWSCALE  libswscale/swscale.h)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index cf91954aec7..fe4705d8415 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -30,10 +30,16 @@
 #include "libavutil/avutil.h"
 #include <sys/types.h> /* size_t */
 
-#define LIBAVCODEC_VERSION_TRIPLET 51,50,1
-
-#define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_TRIPLET)
-#define LIBAVCODEC_VERSION      AV_VERSION(LIBAVCODEC_VERSION_TRIPLET)
+#define LIBAVCODEC_VERSION_MAJOR 51
+#define LIBAVCODEC_VERSION_MINOR 50
+#define LIBAVCODEC_VERSION_MICRO  1
+
+#define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
+                                               LIBAVCODEC_VERSION_MINOR, \
+                                               LIBAVCODEC_VERSION_MICRO)
+#define LIBAVCODEC_VERSION      AV_VERSION(LIBAVCODEC_VERSION_MAJOR,    \
+                                           LIBAVCODEC_VERSION_MINOR,    \
+                                           LIBAVCODEC_VERSION_MICRO)
 #define LIBAVCODEC_BUILD        LIBAVCODEC_VERSION_INT
 
 #define LIBAVCODEC_IDENT        "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h
index 15d6ee5b0b0..3d4a1a3c785 100644
--- a/libavdevice/avdevice.h
+++ b/libavdevice/avdevice.h
@@ -19,10 +19,16 @@
 #ifndef FFMPEG_AVDEVICE_H
 #define FFMPEG_AVDEVICE_H
 
-#define LIBAVDEVICE_VERSION_TRIPLET 52,0,0
+#define LIBAVDEVICE_VERSION_MAJOR 52
+#define LIBAVDEVICE_VERSION_MINOR  0
+#define LIBAVDEVICE_VERSION_MICRO  0
 
-#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_TRIPLET)
-#define LIBAVDEVICE_VERSION     AV_VERSION(LIBAVDEVICE_VERSION_TRIPLET)
+#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
+                                               LIBAVDEVICE_VERSION_MINOR, \
+                                               LIBAVDEVICE_VERSION_MICRO)
+#define LIBAVDEVICE_VERSION     AV_VERSION(LIBAVDEVICE_VERSION_MAJOR, \
+                                           LIBAVDEVICE_VERSION_MINOR, \
+                                           LIBAVDEVICE_VERSION_MICRO)
 #define LIBAVDEVICE_BUILD       LIBAVDEVICE_VERSION_INT
 
 /**
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 98d7e2e81f8..ad186e44327 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -21,10 +21,16 @@
 #ifndef FFMPEG_AVFORMAT_H
 #define FFMPEG_AVFORMAT_H
 
-#define LIBAVFORMAT_VERSION_TRIPLET 52,7,0
-
-#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_TRIPLET)
-#define LIBAVFORMAT_VERSION     AV_VERSION(LIBAVFORMAT_VERSION_TRIPLET)
+#define LIBAVFORMAT_VERSION_MAJOR 52
+#define LIBAVFORMAT_VERSION_MINOR  7
+#define LIBAVFORMAT_VERSION_MICRO  0
+
+#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
+                                               LIBAVFORMAT_VERSION_MINOR, \
+                                               LIBAVFORMAT_VERSION_MICRO)
+#define LIBAVFORMAT_VERSION     AV_VERSION(LIBAVFORMAT_VERSION_MAJOR,   \
+                                           LIBAVFORMAT_VERSION_MINOR,   \
+                                           LIBAVFORMAT_VERSION_MICRO)
 #define LIBAVFORMAT_BUILD       LIBAVFORMAT_VERSION_INT
 
 #define LIBAVFORMAT_IDENT       "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index b08d98deb9f..3d2bd4be285 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -30,16 +30,20 @@
 #define AV_STRINGIFY(s)         AV_TOSTRING(s)
 #define AV_TOSTRING(s) #s
 
-#define AV_VERSION_INT_3(a, b, c) (a<<16 | b<<8 | c)
-#define AV_VERSION_INT(x) AV_VERSION_INT_3(x)
-
-#define AV_VERSION_3(a, b, c) a ##.## b ##.## c
-#define AV_VERSION(x) AV_VERSION_3(x)
-
-#define LIBAVUTIL_VERSION_TRIPLET 49,6,0
-
-#define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_TRIPLET)
-#define LIBAVUTIL_VERSION       AV_VERSION(LIBAVUTIL_VERSION_TRIPLET)
+#define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c)
+#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c
+#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
+
+#define LIBAVUTIL_VERSION_MAJOR 49
+#define LIBAVUTIL_VERSION_MINOR  6
+#define LIBAVUTIL_VERSION_MICRO  0
+
+#define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
+                                               LIBAVUTIL_VERSION_MINOR, \
+                                               LIBAVUTIL_VERSION_MICRO)
+#define LIBAVUTIL_VERSION       AV_VERSION(LIBAVUTIL_VERSION_MAJOR,     \
+                                           LIBAVUTIL_VERSION_MINOR,     \
+                                           LIBAVUTIL_VERSION_MICRO)
 #define LIBAVUTIL_BUILD         LIBAVUTIL_VERSION_INT
 
 #define LIBAVUTIL_IDENT         "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
diff --git a/libpostproc/postprocess.h b/libpostproc/postprocess.h
index 7739d41eb69..818fb41bab6 100644
--- a/libpostproc/postprocess.h
+++ b/libpostproc/postprocess.h
@@ -29,10 +29,16 @@
 
 #include "libavutil/avutil.h"
 
-#define LIBPOSTPROC_VERSION_TRIPLET 51,1,0
-
-#define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_TRIPLET)
-#define LIBPOSTPROC_VERSION     AV_VERSION(LIBPOSTPROC_VERSION_TRIPLET)
+#define LIBPOSTPROC_VERSION_MAJOR 51
+#define LIBPOSTPROC_VERSION_MINOR  1
+#define LIBPOSTPROC_VERSION_MICRO  0
+
+#define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \
+                                               LIBPOSTPROC_VERSION_MINOR, \
+                                               LIBPOSTPROC_VERSION_MICRO)
+#define LIBPOSTPROC_VERSION     AV_VERSION(LIBPOSTPROC_VERSION_MAJOR, \
+                                           LIBPOSTPROC_VERSION_MINOR, \
+                                           LIBPOSTPROC_VERSION_MICRO)
 #define LIBPOSTPROC_BUILD       LIBPOSTPROC_VERSION_INT
 
 #define LIBPOSTPROC_IDENT       "postproc" AV_STRINGIFY(LIBPOSTPROC_VERSION)
-- 
GitLab