Commit 389c3e91 authored by gates's avatar gates

Change dlopening of libs to call libraries with their major version on linux systems

parent ad22a894
......@@ -10,31 +10,13 @@
#include <dlfcn.h>
#include <string.h>
// Note the dlopen takes just the name part. "aacs", internally we
// translate to "libaacs.so" "libaacs.dylib" or "aacs.dll".
void *dl_dlopen ( const char* name )
void *dl_dlopen ( const char* path )
{
char *path;
int len;
void *result;
#ifdef __APPLE__
len = strlen(name) + 3 + 6 + 1;
path = (char *) malloc(len);
if (!path) return NULL;
snprintf(path, len, "lib%s.dylib", name);
#else
len = strlen(name) + 3 + 3 + 1;
path = (char *) malloc(len);
if (!path) return NULL;
snprintf(path, len, "lib%s.so", name);
#endif
DEBUG(DBG_BDPLUS, "searching for library '%s' ...\n", path);
result = dlopen(path, RTLD_LAZY);
void *result = dlopen(path, RTLD_LAZY);
if (!result) {
DEBUG(DBG_FILE | DBG_CRIT, "can't open library '%s': %s\n", path, dlerror());
}
free(path);
return result;
}
......
......@@ -60,7 +60,11 @@ static int _open_m2ts(BLURAY *bd)
static int _libaacs_open(BLURAY *bd, const char *keyfile_path)
{
#ifdef USING_DLOPEN
if ((bd->h_libaacs = dl_dlopen("aacs"))) {
#ifdef __APPLE__
if ((bd->h_libaacs = dl_dlopen("libaacs.dylib"))) {
#else
if ((bd->h_libaacs = dl_dlopen("libaacs.so.0"))) {
#endif
DEBUG(DBG_BLURAY, "Downloaded libaacs (%p)\n", bd->h_libaacs);
fptr_p_void fptr = dl_dlsym(bd->h_libaacs, "aacs_open");
......@@ -150,7 +154,11 @@ BLURAY *bd_open(const char* device_path, const char* keyfile_path)
DEBUG(DBG_BDPLUS, "attempting to load libbdplus\n");
#ifdef USING_DLOPEN
if ((bd->h_libbdplus = dl_dlopen("bdplus"))) {
#ifdef __APPLE__
if ((bd->h_libbdplus = dl_dlopen("libbdplus.dylib"))) {
#else
if ((bd->h_libbdplus = dl_dlopen("libbdplus.so.0"))) {
#endif
DEBUG(DBG_BLURAY, "Downloaded libbdplus (%p)\n",
bd->h_libbdplus);
......
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