libaacs | branch: refs/tags/0.3.0 | npzacs <[email protected]> | Fri Nov 18 
12:05:05 2011 +0200| [d22669379aa38289579256ccb1174ca561aa452b] | committer: 
Ano Nymous

Added version information to API

> http://git.videolan.org/gitweb.cgi/libaacs.git/?a=commit;h=d22669379aa38289579256ccb1174ca561aa452b
---

 .gitignore                    |    1 +
 configure.ac                  |   10 +++++++++-
 src/Makefile.am               |    2 +-
 src/libaacs/aacs-version.h.in |   37 +++++++++++++++++++++++++++++++++++++
 src/libaacs/aacs.c            |    8 ++++++++
 src/libaacs/aacs.h            |    2 ++
 6 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 2b31048..f04a8fe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,6 +21,7 @@ configure
 libtool
 .deps
 .libs
+src/libaacs/aacs-version.h
 src/examples/parser_test
 src/keydbcfg-lexer.c
 src/keydbcfg-parser.c
diff --git a/configure.ac b/configure.ac
index 2d1892a..e8a8460 100644
--- a/configure.ac
+++ b/configure.ac
@@ -175,9 +175,17 @@ if [[ $use_debug = "yes" ]]; then
     SET_DEBUG_OPTS="$SET_DEBUG_OPTS -g"
 fi
 
+# export library version number
+AACS_VERSION_MAJOR=aacs_major()
+AC_SUBST(AACS_VERSION_MAJOR)
+AACS_VERSION_MINOR=aacs_minor()
+AC_SUBST(AACS_VERSION_MINOR)
+AACS_VERSION_MICRO=aacs_micro()
+AC_SUBST(AACS_VERSION_MICRO)
+
 # generate output files
 AC_SUBST(SET_WARNINGS)
 AC_SUBST(SET_OPTIMIZATIONS)
 AC_SUBST(SET_DEBUG_OPTS)
-AC_CONFIG_FILES([Makefile src/Makefile src/examples/Makefile src/libaacs.pc])
+AC_CONFIG_FILES([Makefile src/Makefile src/examples/Makefile src/libaacs.pc 
src/libaacs/aacs-version.h])
 AC_OUTPUT
diff --git a/src/Makefile.am b/src/Makefile.am
index 6b5f254..42a33d5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -52,7 +52,7 @@ libaacs_la_SOURCES+= \
 endif
 
 libaacs_ladir= $(includedir)/libaacs
-libaacs_la_HEADERS= libaacs/aacs.h file/filesystem.h
+libaacs_la_HEADERS= libaacs/aacs.h file/filesystem.h libaacs/aacs-version.h
 libaacs_la_LDFLAGS= $(LIBGCRYPT_LIBS) -version-info $(LIB_VERSION_INFO)
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libaacs.pc
diff --git a/src/libaacs/aacs-version.h.in b/src/libaacs/aacs-version.h.in
new file mode 100644
index 0000000..1d86561
--- /dev/null
+++ b/src/libaacs/aacs-version.h.in
@@ -0,0 +1,37 @@
+/*
+ * This file is part of libaacs
+ * Copyright (C) 2011 libaacs
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef AACS_VERSION_H_
+#define AACS_VERSION_H_
+
+#define AACS_VERSION_CODE(major, minor, micro) \
+    (((major) * 10000) +                         \
+     ((minor) *   100) +                         \
+     ((micro) *     1))
+
+#define AACS_VERSION_MAJOR @AACS_VERSION_MAJOR@
+#define AACS_VERSION_MINOR @AACS_VERSION_MINOR@
+#define AACS_VERSION_MICRO @AACS_VERSION_MICRO@
+
+#define AACS_VERSION_STRING 
"@AACS_VERSION_MAJOR@.@AACS_VERSION_MINOR@.@AACS_VERSION_MICRO@"
+
+#define AACS_VERSION \
+    AACS_VERSION_CODE(AACS_VERSION_MAJOR, AACS_VERSION_MINOR, 
AACS_VERSION_MICRO)
+
+#endif /* AACS_VERSION_H_ */
diff --git a/src/libaacs/aacs.c b/src/libaacs/aacs.c
index efb43d7..5b7c7bd 100644
--- a/src/libaacs/aacs.c
+++ b/src/libaacs/aacs.c
@@ -24,6 +24,7 @@
 
 #include <util/attributes.h>
 
+#include "aacs-version.h"
 #include "aacs.h"
 #include "crypto.h"
 #include "mmc.h"
@@ -600,6 +601,13 @@ static int _load_config(AACS *aacs, const char 
*configfile_path)
     return config_ok;
 }
 
+void aacs_get_version(int *major, int *minor, int *micro)
+{
+  *major = AACS_VERSION_MAJOR;
+  *minor = AACS_VERSION_MINOR;
+  *micro = AACS_VERSION_MICRO;
+}
+
 AACS *aacs_open(const char *path, const char *configfile_path)
 {
     DEBUG(DBG_AACS, "libaacs [%zd]\n", sizeof(AACS));
diff --git a/src/libaacs/aacs.h b/src/libaacs/aacs.h
index 4740ab3..6848b21 100644
--- a/src/libaacs/aacs.h
+++ b/src/libaacs/aacs.h
@@ -28,6 +28,8 @@
 
 typedef struct aacs AACS;
 
+AACS_PUBLIC void aacs_get_version(int *major, int *minor, int *micro);
+
 AACS_PUBLIC AACS *aacs_open(const char *path, const char *keyfile_path);
 AACS_PUBLIC void aacs_close(AACS *aacs);
 AACS_PUBLIC void aacs_select_title(AACS *aacs, uint32_t title); /* 0 - top 
menu, 0xffff - first play */

_______________________________________________
libaacs-devel mailing list
[email protected]
http://mailman.videolan.org/listinfo/libaacs-devel

Reply via email to