From d9636c5d1900006674ecb38c0ebe087a85f4cbf1 Mon Sep 17 00:00:00 2001
From: Jean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Date: Sun, 31 Jul 2011 22:29:05 -0400
Subject: [PATCH] Add a function to query the Opus version

---
 configure.ac | 2 +-
 src/opus.c   | 8 ++++++++
 src/opus.h   | 2 ++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 345d63d59..8c7a13252 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
 OPUS_MAJOR_VERSION=0
 OPUS_MINOR_VERSION=9
-OPUS_MICRO_VERSION=5
+OPUS_MICRO_VERSION=6
 OPUS_EXTRA_VERSION=
 OPUS_VERSION=$OPUS_MAJOR_VERSION.$OPUS_MINOR_VERSION.$OPUS_MICRO_VERSION$OPUS_EXTRA_VERSION
 LIBOPUS_SUFFIX=0
diff --git a/src/opus.c b/src/opus.c
index 14dc3d877..96e3063fb 100644
--- a/src/opus.c
+++ b/src/opus.c
@@ -25,6 +25,9 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 const char *opus_strerror(int error)
 {
@@ -43,3 +46,8 @@ const char *opus_strerror(int error)
    else
       return error_strings[-error];
 }
+
+const char *opus_get_version_string(void)
+{
+	return OPUS_VERSION;
+}
diff --git a/src/opus.h b/src/opus.h
index 75a7df0ec..6bbd65825 100644
--- a/src/opus.h
+++ b/src/opus.h
@@ -220,6 +220,8 @@ OPUS_EXPORT int opus_decoder_get_nb_samples(const OpusDecoder *dec, const unsign
 
 OPUS_EXPORT const char *opus_strerror(int error);
 
+OPUS_EXPORT const char *opus_get_version_string(void);
+
 /* For testing purposes: the encoder and decoder state should always be identical after coding a payload */
 OPUS_EXPORT int opus_encoder_get_final_range(OpusEncoder *st);
 OPUS_EXPORT int opus_decoder_get_final_range(OpusDecoder *st);
-- 
GitLab