libbluray | branch: master | hpi1 <[email protected]> | Fri Nov 18 09:32:04 2011 +0200| [99ebfa37c99ed06cba32f7198756249247f6656e] | committer: hpi1
Make library version information visible to applications > http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=99ebfa37c99ed06cba32f7198756249247f6656e --- .gitignore | 1 + configure.ac | 11 ++++++++++- src/Makefile.am | 2 +- src/libbluray/bluray-version.h.in | 37 +++++++++++++++++++++++++++++++++++++ src/libbluray/bluray.c | 13 +++++++++++++ src/libbluray/bluray.h | 6 ++++++ 6 files changed, 68 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 751c269..c269f63 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ configure libtool .deps .libs +src/libbluray/bluray-version.h src/examples/bdsplice src/examples/clpi_dump src/examples/index_dump diff --git a/configure.ac b/configure.ac index 02bfc68..eb918c5 100644 --- a/configure.ac +++ b/configure.ac @@ -239,11 +239,20 @@ AM_CONDITIONAL([USING_BDJAVA], [ test $use_bdjava = "yes" ]) # generate documentation DX_INIT_DOXYGEN(libbluray, doc/doxygen-config, [doc/doxygen]) + +# export library version number +BLURAY_VERSION_MAJOR=bluray_major() +AC_SUBST(BLURAY_VERSION_MAJOR) +BLURAY_VERSION_MINOR=bluray_minor() +AC_SUBST(BLURAY_VERSION_MINOR) +BLURAY_VERSION_MICRO=bluray_micro() +AC_SUBST(BLURAY_VERSION_MICRO) + # generate output files AC_SUBST(BDJAVA_CFLAGS) AC_SUBST(DLOPEN_LDFLAGS) AC_SUBST(SET_WARNINGS) AC_SUBST(SET_OPTIMIZATIONS) AC_SUBST(SET_DEBUG_OPTS) -AC_CONFIG_FILES([Makefile src/Makefile src/examples/Makefile src/libbluray.pc]) +AC_CONFIG_FILES([Makefile src/Makefile src/examples/Makefile src/libbluray.pc src/libbluray/bluray-version.h]) AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index 8b65cb5..cb9aca3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -90,7 +90,7 @@ libbluray_la_SOURCES=libbluray/bluray.h \ util/log_control.h \ util/bits.h \ util/logging.h -libbluray_la_HEADERS= libbluray/bluray.h file/filesystem.h util/log_control.h libbluray/keys.h libbluray/decoders/overlay.h libbluray/bdnav/meta_data.h libbluray/bdnav/clpi_data.h +libbluray_la_HEADERS= libbluray/bluray.h file/filesystem.h util/log_control.h libbluray/keys.h libbluray/decoders/overlay.h libbluray/bdnav/meta_data.h libbluray/bdnav/clpi_data.h libbluray/bluray-version.h libbluray_la_LDFLAGS= -version-info $(LIB_VERSION_INFO) $(DLOPEN_LDFLAGS) $(LIBXML2_LIBS) if USING_BDJAVA diff --git a/src/libbluray/bluray-version.h.in b/src/libbluray/bluray-version.h.in new file mode 100644 index 0000000..7dd4783 --- /dev/null +++ b/src/libbluray/bluray-version.h.in @@ -0,0 +1,37 @@ +/* + * This file is part of libbluray + * Copyright (C) 2011 hpi1 + * + * 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 BLURAY_VERSION_H_ +#define BLURAY_VERSION_H_ + +#define BLURAY_VERSION_CODE(major, minor, micro) \ + (((major) * 10000) + \ + ((minor) * 100) + \ + ((micro) * 1)) + +#define BLURAY_VERSION_MAJOR @BLURAY_VERSION_MAJOR@ +#define BLURAY_VERSION_MINOR @BLURAY_VERSION_MINOR@ +#define BLURAY_VERSION_MICRO @BLURAY_VERSION_MICRO@ + +#define BLURAY_VERSION_STRING "@BLURAY_VERSION_MAJOR@.@BLURAY_VERSION_MINOR@.@BLURAY_VERSION_MICRO@" + +#define BLURAY_VERSION \ + BLURAY_VERSION_CODE(BLURAY_VERSION_MAJOR, BLURAY_VERSION_MINOR, BLURAY_VERSION_MICRO) + +#endif /* BLURAY_VERSION_H_ */ diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c index c56d61d..be8f460 100644 --- a/src/libbluray/bluray.c +++ b/src/libbluray/bluray.c @@ -23,6 +23,7 @@ #include "config.h" #endif +#include "bluray-version.h" #include "bluray.h" #include "register.h" #include "util/macro.h" @@ -150,6 +151,16 @@ struct bluray { } while (0) /* + * Library version + */ +void bd_get_version(int *major, int *minor, int *micro) +{ + *major = BLURAY_VERSION_MAJOR; + *minor = BLURAY_VERSION_MINOR; + *micro = BLURAY_VERSION_MICRO; +} + +/* * Navigation mode event queue */ @@ -829,6 +840,8 @@ BLURAY *bd_open(const char* device_path, const char* keyfile_path) { BLURAY *bd = calloc(1, sizeof(BLURAY)); + BD_DEBUG(DBG_BLURAY, "libbluray version "BLURAY_VERSION_STRING"\n"); + if (device_path) { bd->device_path = (char*)malloc(strlen(device_path) + 1); diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h index 83cf1a1..7dddb58 100644 --- a/src/libbluray/bluray.h +++ b/src/libbluray/bluray.h @@ -169,6 +169,12 @@ typedef struct bd_title_info { } BLURAY_TITLE_INFO; /** + * Get library version + * + */ +void bd_get_version(int *major, int *minor, int *micro); + +/** * * This must be called after bd_open() and before bd_select_title(). * Populates the title list in BLURAY. _______________________________________________ libbluray-devel mailing list [email protected] http://mailman.videolan.org/listinfo/libbluray-devel
