aacs_open fptr in libbluray
This commit is contained in:
parent
1ed5b372ba
commit
f0857ebe12
31
src/bluray.c
31
src/bluray.c
|
@ -1,4 +1,33 @@
|
|||
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "bluray.h"
|
||||
#include "libaacs/aacs.h"
|
||||
#include "util/macro.h"
|
||||
|
||||
BLURAY *bd_open(const char* device_path, const char* keyfile_path)
|
||||
{
|
||||
BLURAY *bd = malloc(sizeof(BLURAY));
|
||||
|
||||
// open aacs decryptor if present
|
||||
bd->aacs = NULL;
|
||||
if ((bd->libaacs_h = dlopen("libaacs", RTLD_NOW))) {
|
||||
typedef AACS_KEYS* (*fptr)();
|
||||
|
||||
fptr fptr_s = dlsym(bd->libaacs_h, "aacs_open");
|
||||
bd->aacs = fptr_s(device_path, keyfile_path);
|
||||
}
|
||||
|
||||
return bd;
|
||||
}
|
||||
|
||||
void bd_close(BLURAY *bd)
|
||||
{
|
||||
if (bd->libaacs_h) {
|
||||
aacs_close(bd->aacs);
|
||||
}
|
||||
|
||||
X_FREE(bd);
|
||||
|
||||
dlclose(bd->libbdplus_h);
|
||||
dlclose(bd->libaacs_h);
|
||||
}
|
||||
|
|
12
src/bluray.h
12
src/bluray.h
|
@ -6,18 +6,22 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include "file/file.h"
|
||||
#include "libaacs/aacs.h"
|
||||
|
||||
typedef struct bluray BLURAY;
|
||||
struct bluray {
|
||||
char device_path[100];
|
||||
uint64_t title;
|
||||
FILE_H *fp;
|
||||
off_t s_size, s_pos;
|
||||
uint64_t title;
|
||||
uint64_t s_size;
|
||||
off_t s_pos;
|
||||
AACS_KEYS *aacs;
|
||||
void *libaacs_h, *libbdplus_h;
|
||||
};
|
||||
|
||||
BLURAY *bd_open(BLURAY *bd);
|
||||
void bd_select_title(BLURAY *bd, uint64_t title);
|
||||
BLURAY *bd_open(const char* device_path, const char* keyfile_path);
|
||||
void bd_close(BLURAY *bd);
|
||||
void bd_select_title(BLURAY *bd, uint64_t title);
|
||||
off_t bd_seek(BLURAY *bd, off_t pos);
|
||||
int bd_read(BLURAY *bd, unsigned char *buf, int len);
|
||||
|
||||
|
|
Loading…
Reference in New Issue