Add Properties to Query HDCP Status and Usage Reporting Support

This is a merge of http://go/wvgerrit/10846/ from the Widevine repository.

Change-Id: I682069073d9ec58c03781de25d9c6fa5ec5864ff
This commit is contained in:
John "Juce" Bruce
2014-08-05 15:09:53 -07:00
parent 3099da6170
commit b608e17e08
4 changed files with 84 additions and 0 deletions

View File

@@ -402,6 +402,21 @@ CdmResponseType CdmEngine::QueryStatus(CdmQueryMap* key_info) {
(*key_info)[QUERY_KEY_PROVISIONING_ID] = provisioning_id;
}
CryptoSession::OemCryptoHdcpVersion current_hdcp;
CryptoSession::OemCryptoHdcpVersion max_hdcp;
success = crypto_session.GetHdcpCapabilities(&current_hdcp, &max_hdcp);
if (success) {
(*key_info)[QUERY_KEY_CURRENT_HDCP_LEVEL] = MapHdcpVersion(current_hdcp);
(*key_info)[QUERY_KEY_MAX_HDCP_LEVEL] = MapHdcpVersion(max_hdcp);
}
bool supports_usage_reporting;
success = crypto_session.UsageInformationSupport(&supports_usage_reporting);
if (success) {
(*key_info)[QUERY_KEY_USAGE_SUPPORT] =
supports_usage_reporting ? QUERY_VALUE_TRUE : QUERY_VALUE_FALSE;
}
return NO_ERROR;
}
@@ -743,4 +758,23 @@ void CdmEngine::OnKeyReleaseEvent(const CdmKeySetId& key_set_id) {
}
}
std::string CdmEngine::MapHdcpVersion(
CryptoSession::OemCryptoHdcpVersion version) {
switch (version) {
case CryptoSession::kOemCryptoNoHdcpDeviceAttached:
return QUERY_VALUE_DISCONNECTED;
case CryptoSession::kOemCryptoHdcpNotSupported:
return QUERY_VALUE_UNPROTECTED;
case CryptoSession::kOemCryptoHdcpVersion1:
return QUERY_VALUE_HDCP_V1;
case CryptoSession::kOemCryptoHdcpVersion2:
return QUERY_VALUE_HDCP_V2_0;
case CryptoSession::kOemCryptoHdcpVersion2_1:
return QUERY_VALUE_HDCP_V2_1;
case CryptoSession::kOemCryptoHdcpVersion2_2:
return QUERY_VALUE_HDCP_V2_2;
}
return "";
}
} // namespace wvcdm