Commit 99ebfa37 authored by hpi1's avatar hpi1

Make library version information visible to applications

parent 43f37a18
......@@ -22,6 +22,7 @@ configure
libtool
.deps
.libs
src/libbluray/bluray-version.h
src/examples/bdsplice
src/examples/clpi_dump
src/examples/index_dump
......
......@@ -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
......@@ -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
......
/*
* 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_ */
......@@ -23,6 +23,7 @@
#include "config.h"
#endif
#include "bluray-version.h"
#include "bluray.h"
#include "register.h"
#include "util/macro.h"
......@@ -149,6 +150,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);
......
......@@ -168,6 +168,12 @@ typedef struct bd_title_info {
BLURAY_TITLE_CHAPTER *chapters;
} 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().
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment