Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 9 additions & 43 deletions OpenCDMi/FrameworkRPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ namespace Plugin {
if (systemExt)
{
std::vector<uint8_t> drmStoreHash(32);
Exchange::OCDM_RESULT hashResult = (Exchange::OCDM_RESULT) systemExt->GetSecureStoreHash(&drmStoreHash[0], drmStoreHash.size());
Exchange::OCDM_RESULT hashResult = (Exchange::OCDM_RESULT) systemExt->GetSecureStoreHash(_keySystem, &drmStoreHash[0], drmStoreHash.size());
if (hashResult == Exchange::OCDM_SUCCESS)
{
ReportSecureStoreHash("StoreLicenseData", _keySystem, &drmStoreHash[0], drmStoreHash.size());
Expand Down Expand Up @@ -1110,7 +1110,7 @@ namespace Plugin {
CDMi::IMediaKeysExt* systemExt = dynamic_cast<CDMi::IMediaKeysExt*>(_parent.KeySystem(keySystem));
if (systemExt) {
ODH_ERROR_REPORT_CTX_ERROR(0, "DeleteSecureStore", keySystem);
return (Exchange::OCDM_RESULT)systemExt->DeleteSecureStore();
return (Exchange::OCDM_RESULT)systemExt->DeleteSecureStore(keySystem);
}
return Exchange::OCDM_RESULT::OCDM_S_FALSE;
}
Expand All @@ -1122,7 +1122,7 @@ namespace Plugin {
{
CDMi::IMediaKeysExt* systemExt = dynamic_cast<CDMi::IMediaKeysExt*>(_parent.KeySystem(keySystem));
if (systemExt) {
return (Exchange::OCDM_RESULT)systemExt->GetSecureStoreHash(keyStoreHash, keyStoreHashLength);
return (Exchange::OCDM_RESULT)systemExt->GetSecureStoreHash(keySystem, keyStoreHash, keyStoreHashLength);
}
return Exchange::OCDM_RESULT::OCDM_S_FALSE;
}
Expand All @@ -1134,7 +1134,7 @@ namespace Plugin {
{
CDMi::IMediaKeysExt* systemExt = dynamic_cast<CDMi::IMediaKeysExt*>(_parent.KeySystem(keySystem));
if (systemExt) {
Exchange::OCDM_RESULT result = (Exchange::OCDM_RESULT)systemExt->GetSecureStoreHash(secureStoreHash, secureStoreHashLength);
Exchange::OCDM_RESULT result = (Exchange::OCDM_RESULT)systemExt->GetSecureStoreHash(keySystem, secureStoreHash, secureStoreHashLength);
if (result == Exchange::OCDM_SUCCESS)
{
ReportSecureStoreHash("GetSecureStoreHash", keySystem, secureStoreHash, secureStoreHashLength);
Expand Down Expand Up @@ -1235,36 +1235,6 @@ namespace Plugin {
Config(const Config&);
Config& operator=(const Config&);

public:
class Libs : public Core::JSON::Container {
private:
Libs& operator=(const Libs&);

public:
Libs()
: Core::JSON::Container()
, SystemName()
, LibFile()
{
Add("system_name", &SystemName);
Add("lib_file", &LibFile);
}
Libs(const Libs& copy)
: Core::JSON::Container()
, SystemName(copy.SystemName)
, LibFile(copy.LibFile)
{
Add("system_name", &SystemName);
Add("lib_file", &LibFile);
}

virtual ~Libs() = default;

public:
Core::JSON::String SystemName;
Core::JSON::String LibFile;
};

public:
class Systems : public Core::JSON::Container {
private:
Expand Down Expand Up @@ -1311,14 +1281,12 @@ namespace Plugin {
, Connector(_T("/tmp/ocdm"))
, SharePath(_T("/tmp/OCDM"))
, ShareSize(8 * 1024)
, DrmLibs()
, KeySystems()
{
Add(_T("location"), &Location);
Add(_T("connector"), &Connector);
Add(_T("sharepath"), &SharePath);
Add(_T("sharesize"), &ShareSize);
Add(_T("drm_libs"), &DrmLibs);
Add(_T("systems"), &KeySystems);
}
~Config()
Expand All @@ -1330,7 +1298,6 @@ namespace Plugin {
Core::JSON::String Connector;
Core::JSON::String SharePath;
Core::JSON::DecUInt32 ShareSize;
Core::JSON::ArrayType<Libs> DrmLibs;
Core::JSON::ArrayType<Systems> KeySystems;
};

Expand Down Expand Up @@ -1416,12 +1383,11 @@ namespace Plugin {
const string locator(_shell->DataPath() + config.Location.Value());

// Before we start loading the mapping of the Keys to the factories, load the factories :-)
Core::Directory entry(locator.c_str(), _T("*.drm"));
std::map<const string, SystemFactory> factories;

Core::JSON::ArrayType<Config::Libs>::ConstIterator libs(static_cast<const Config&>(config).DrmLibs.Elements());
while (libs.Next() == true) {
const std::string libFullPath = locator + libs.Current().LibFile.Value();
Core::Library library(libFullPath.c_str());
while (entry.Next() == true) {
Core::Library library(entry.Current().c_str());

if (library.IsLoaded() == true) {
GetDRMSystemFunction handle = reinterpret_cast<GetDRMSystemFunction>(library.LoadFunction(_T("GetSystemFactory")));
Expand All @@ -1431,15 +1397,15 @@ namespace Plugin {

if (entry != nullptr) {
SystemFactory element;
element.Name = libs.Current().SystemName.Value().c_str();
element.Name = Core::ClassNameOnly(entry->KeySystem()).Text();
element.Factory = entry;
_keySystems.push_back(element.Name);
factories.insert(std::pair<const string, SystemFactory>(element.Name, element));
_systemLibraries.push_back(library);
}
}
} else {
SYSLOG(Logging::Startup, (_T("Could not load factory [%s], error [%s]"), Core::File::FileNameExtended(libFullPath).c_str(), library.Error().c_str()));
SYSLOG(Logging::Startup, (_T("Could not load factory [%s], error [%s]"), Core::File::FileNameExtended(entry.Current()).c_str(), library.Error().c_str()));
result = Core::ERROR_OPENING_FAILED;
}
}
Expand Down
53 changes: 1 addition & 52 deletions OpenCDMi/OCDM.config
Original file line number Diff line number Diff line change
Expand Up @@ -38,40 +38,13 @@ ans(rootobject)
map()
kv(sharepath "/tmp/OCDM")
kv(connector "/tmp/OCDM/ocdm")
kv(drm_libs ___array___)
kv(systems ___array___)
if (NOT PLUGIN_OPENCDMI_MODE)
kv(outofprocess ${PLUGIN_OPENCDMI_OOP})
endif()
end()
ans(configuration)

if(PLUGIN_OPENCDMI_PLAYREADY OR PLUGIN_OPENCDMI_PLAYREADY_NEXUS OR PLUGIN_OPENCDMI_PLAYREADY_NEXUS_SVP OR PLUGIN_OPENCDMI_PLAYREADY_VGDRM)
map()
kv(system_name "PlayReady")
kv(lib_file "PlayReady.drm")
end()
ans(drm_lib)
map_append(${configuration} drm_libs ___array___ ${drm_lib})
endif()

if(PLUGIN_OPENCDMI_PLAYREADY_NETFLIX OR PLUGIN_OPENCDMI_PLAYREADY_NEXUS_NETFLIX OR PLUGIN_OPENCDMI_PLAYREADY_NEXUS_SVP_NETFLIX)
map()
kv(system_name "PlayReadyNetflix")
kv(lib_file "PlayReady.drm")
end()
ans(drm_lib)
map_append(${configuration} drm_libs ___array___ ${drm_lib})
endif()

if(PLUGIN_OPENCDMI_WIDEVINE OR OPENCDMI_WIDEVINE_NEXUS_SVP)
map()
kv(system_name "WideVine")
kv(lib_file "WideVine.drm")
end()
ans(drm_lib)
map_append(${configuration} drm_libs ___array___ ${drm_lib})
endif()

if(PLUGIN_OPENCDMI_CLEARKEY)
map()
Expand All @@ -85,7 +58,7 @@ endif()
if(PLUGIN_OPENCDMI_PLAYREADY OR PLUGIN_OPENCDMI_PLAYREADY_NEXUS OR PLUGIN_OPENCDMI_PLAYREADY_NEXUS_SVP OR PLUGIN_OPENCDMI_PLAYREADY_VGDRM)
map()
kv(name "PlayReady")
kv(designators "com.youtube.playready;com.microsoft.playready;com.microsoft.playready.recommendation")
kv(designators "com.youtube.playready;com.microsoft.playready;com.netflix.playready;com.amazon.playready;com.disney.playready;com.microsoft.playready.recommendation")
key(configuration)
map()
if(PLUGIN_OPENCDMI_PLAYREADY_METERING_CERTIFICATE)
Expand All @@ -106,30 +79,6 @@ ans(keysystem)
map_append(${configuration} systems ___array___ ${keysystem})
endif()

if(PLUGIN_OPENCDMI_PLAYREADY_NETFLIX OR PLUGIN_OPENCDMI_PLAYREADY_NEXUS_NETFLIX OR PLUGIN_OPENCDMI_PLAYREADY_NEXUS_SVP_NETFLIX)
map()
kv(name "PlayReadyNetflix")
kv(designators "___array___;com.netflix.playready")
key(configuration)
map()
if(PLUGIN_OPENCDMI_PLAYREADY_METERING_CERTIFICATE)
kv(metering ${PLUGIN_OPENCDMI_PLAYREADY_METERING_CERTIFICATE})
endif()
if(PLUGIN_OCDM_PLAYREADY_READ_DIR)
kv(read-dir "${PLUGIN_OCDM_PLAYREADY_READ_DIR_NETFLIX}")
endif()
if(PLUGIN_OCDM_PLAYREADY_STORE_LOCATION_NETFLIX)
kv(store-location "${PLUGIN_OCDM_PLAYREADY_STORE_LOCATION_NETFLIX}")
endif()
if(PLUGIN_OPENCDMI_PLAYREADY_CERTIFICATE_LABEL)
kv(certificatelabel "${PLUGIN_OPENCDMI_PLAYREADY_CERTIFICATE_LABEL}")
endif()
end()
end()
ans(keysystem)
map_append(${configuration} systems ___array___ ${keysystem})
endif()

if(PLUGIN_OPENCDMI_WIDEVINE OR OPENCDMI_WIDEVINE_NEXUS_SVP)
map()
kv(name "WideVine")
Expand Down
18 changes: 0 additions & 18 deletions OpenCDMi/OpenCDMiPlugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,6 @@
"description": "The sharesize",
"type": "string"
},
"drm_libs": {
"description": "A list of DRM libs to load with assigned names that 'systems' entries can refer to",
"type": "array",
"items": {
"description": "DRM lib properties",
"type": "object",
"properties": {
"system_name": {
"description": "Name under which the loaded library can be referred by 'systems' entries",
"type": "string"
},
"lib_file": {
"description": "*.drm file to load",
"type": "string"
}
}
}
},
"systems": {
"description": "A list of key systems",
"type": "array",
Expand Down