void Session::GetSupportedDecrypterURN(std::pair<std::string, std::string> &urn) { typedef SSD_DECRYPTER *(*CreateDecryptorInstanceFunc)(SSD_HOST *host, uint32_t version); char specialpath[1024]; if (!xbmc->GetSetting("DECRYPTERPATH", specialpath)) { xbmc->Log(ADDON::LOG_DEBUG, "DECRYPTERPATH not specified in settings.xml"); return; } addonstring path(xbmc->TranslateSpecialProtocol(specialpath)); kodihost.SetLibraryPath(path.c_str()); VFSDirEntry *items(0); unsigned int num_items(0); xbmc->Log(ADDON::LOG_DEBUG, "Searching for decrypters in: %s", path.c_str()); if (!xbmc->GetDirectory(path.c_str(), "", &items, &num_items)) return; for (unsigned int i(0); i < num_items; ++i) { if (strncmp(items[i].label, "ssd_", 4) && strncmp(items[i].label, "libssd_", 7)) continue; void * mod(dlopen(items[i].path, RTLD_LAZY)); if (mod) { CreateDecryptorInstanceFunc startup; if ((startup = (CreateDecryptorInstanceFunc)dlsym(mod, "CreateDecryptorInstance"))) { SSD_DECRYPTER *decrypter = startup(&kodihost, SSD_HOST::version); const char *suppUrn(0); if (decrypter && (suppUrn = decrypter->Supported(license_type_.c_str(), license_key_.c_str()))) { xbmc->Log(ADDON::LOG_DEBUG, "Found decrypter: %s", items[i].path); decrypterModule_ = mod; decrypter_ = decrypter; urn.first = suppUrn; break; } } dlclose(mod); } } xbmc->FreeDirectory(items, num_items); }
void Session::GetSupportedDecrypterURN(std::pair<std::string, std::string> &urn) { typedef SSD_DECRYPTER *(*CreateDecryptorInstanceFunc)(SSD_HOST *host); const char *path = kodihost.GetDecrypterPath(); VFSDirEntry *items(0); unsigned int num_items(0); if (!xbmc->GetDirectory(path, "", &items, &num_items)) return; for (unsigned int i(0); i < num_items; ++i) { if (strncmp(items[i].label, "ssd_", 4)) continue; void * mod(dlopen(items[i].path, RTLD_LAZY)); if (mod) { CreateDecryptorInstanceFunc startup; if ((startup = (CreateDecryptorInstanceFunc)dlsym(mod, "CreateDecryptorInstance"))) { SSD_DECRYPTER *decrypter = startup(&kodihost); const char *suppUrn(0); if (decrypter && (suppUrn = decrypter->Supported(license_type_.c_str(), license_key_.c_str()))) { decrypterModule_ = mod; decrypter_ = decrypter; urn.first = suppUrn; break; } } dlclose(mod); } } xbmc->FreeDirectory(items, num_items); }