int libbdplus_init(BD_BDPLUS *p, const char *root, void *file_open_handle, void *file_open_fp, const uint8_t *vid, const uint8_t *mk) { fptr_p_void bdplus_init; fptr_void set_fopen; _libbdplus_close(p); *(void **)(&bdplus_init) = dl_dlsym(p->h_libbdplus, "bdplus_init"); *(void **)(&set_fopen) = dl_dlsym(p->h_libbdplus, "bdplus_set_fopen"); if (!bdplus_init) { BD_DEBUG(DBG_BLURAY | DBG_CRIT, "libbdplus dlsym(bdplus_init) failed! (%p)\n", p->h_libbdplus); return -1; } if (set_fopen) { p->bdplus = bdplus_init(NULL, NULL, vid); set_fopen(p->bdplus, file_open_handle, file_open_fp); } else { p->bdplus = bdplus_init(root, NULL, vid); } if (!p->bdplus) { BD_DEBUG(DBG_BLURAY | DBG_CRIT, "bdplus_init() failed! (%p)\n", p->h_libbdplus); return -1; } DL_CALL(p->h_libbdplus, bdplus_set_mk, p->bdplus, mk); return 0; }
void libbdplus_unload(BD_BDPLUS **p) { if (p && *p) { _libbdplus_close(*p); if ((*p)->h_libbdplus) { dl_dlclose((*p)->h_libbdplus); } X_FREE(*p); } }
int libbdplus_init(BD_BDPLUS *p, const char *device_path, const uint8_t *vid) { fptr_p_void bdplus_init; _libbdplus_close(p); *(void **)(&bdplus_init) = dl_dlsym(p->h_libbdplus, "bdplus_init"); if (!bdplus_init) { BD_DEBUG(DBG_BLURAY | DBG_CRIT, "libbdplus dlsym(bdplus_init) failed! (%p)\n", p->h_libbdplus); return -1; } p->bdplus = bdplus_init(device_path, NULL, vid); if (!p->bdplus) { BD_DEBUG(DBG_BLURAY | DBG_CRIT, "bdplus_init() failed! (%p)\n", p->h_libbdplus); return -1; } return 0; }