OEMCrypto v16.1

Merge of http://go/wvgerrit/93404

This CL updates the Widevine CDM to support OEMCrypto v16.1

Test: Tested in 16.2 CL
Bug: 141247171
Change-Id: I69bd993500f6fb63bf6010c8b0250dc7acc3d71b
This commit is contained in:
Fred Gylys-Colwell
2020-01-18 10:11:24 -08:00
parent 7e2619e379
commit 7665614b2e
132 changed files with 12331 additions and 9341 deletions

View File

@@ -89,6 +89,11 @@ InitializationData::InitializationData(const std::string& type,
}
}
const std::string InitializationData::WidevineSystemID() {
return std::string(reinterpret_cast<const char*>(kWidevineSystemId),
sizeof(kWidevineSystemId));
}
std::vector<video_widevine::WidevinePsshData_EntitledKey>
InitializationData::ExtractWrappedKeys() const {
std::vector<video_widevine::WidevinePsshData_EntitledKey> keys;
@@ -671,4 +676,64 @@ bool InitializationData::DetectEntitlementPreference(
return std::stoul(oec_version_string) >= 14;
}
void InitializationData::DumpToLogs() const {
if (!is_supported()) {
LOGD("InitData: Not supported");
}
if (!IsEmpty()) {
LOGD("InitData: Empty");
}
std::string type_info = type();
if (is_cenc()) type_info += " (cenc)";
if (is_hls()) type_info += " (hls)";
if (is_webm()) type_info += " (webm)";
if (is_audio()) type_info += " (audio)";
LOGD("InitData: type = %s", type_info.c_str());
video_widevine::WidevinePsshData pssh;
if (!pssh.ParseFromString(data())) {
LOGD("InitData: invalid pssh: %s", b2a_hex(data()).c_str());
return;
}
if (pssh.has_content_id()) {
LOGD("InitData: content_id = '%s'", pssh.content_id().c_str());
}
if (pssh.has_protection_scheme()) {
uint32_t scheme = pssh.protection_scheme();
LOGD("InitData: Protection Scheme: %c%c%c%c", (scheme >> 24) & 0xFF,
(scheme >> 16) & 0xFF, (scheme >> 8) & 0xFF, (scheme >> 0) & 0xFF);
}
switch (pssh.type()) {
case video_widevine::WidevinePsshData_Type_SINGLE:
// Don't bother printing.
break;
case video_widevine::WidevinePsshData_Type_ENTITLEMENT:
LOGD("InitData: Entitlement License");
break;
case video_widevine::WidevinePsshData_Type_ENTITLED_KEY:
LOGD("InitData: Entitled Key");
break;
default:
LOGE("Undefine pssh type: %d", pssh.type());
break;
}
if (pssh.has_crypto_period_index())
LOGD("InitData: Crypto Period Index %u", pssh.crypto_period_index());
if (pssh.has_crypto_period_seconds())
LOGD("InitData: Crypto Period seconds %u", pssh.crypto_period_seconds());
if (pssh.has_key_sequence())
LOGD("InitData: Key Sequence %u", pssh.key_sequence());
for (int i = 0; i < pssh.key_ids_size(); i++) {
LOGD("InitData: key_id %d: %s", i, b2a_hex(pssh.key_ids(i)).c_str());
}
for (int i = 0; i < pssh.entitled_keys_size(); i++) {
video_widevine::WidevinePsshData_EntitledKey key = pssh.entitled_keys(i);
LOGD("InitData: entitlement_key_id %d: %s -> %s", i,
b2a_hex(key.entitlement_key_id()).c_str(),
b2a_hex(key.key_id()).c_str());
}
}
} // namespace wvcdm