Remove extra enumeration

This is a merge of http://go/wvgerrit/13751 from the widevine
repository.

The CryptoSession had an enumeration for HDCP levels that was copied
from OEMCryptoCENC.h by hand.  Since that header is included, there is
no need to have two enumerations.

b/16303994

Change-Id: Ief16ba62163776f9ca80375f3638ef4c7770e742
This commit is contained in:
Fred Gylys-Colwell
2015-03-27 15:34:18 -07:00
parent 170485f771
commit d78a0696bb
9 changed files with 55 additions and 76 deletions

View File

@@ -428,8 +428,8 @@ CdmResponseType CdmEngine::QueryStatus(CdmQueryMap* key_info) {
(*key_info)[QUERY_KEY_PROVISIONING_ID] = provisioning_id;
}
CryptoSession::OemCryptoHdcpVersion current_hdcp;
CryptoSession::OemCryptoHdcpVersion max_hdcp;
CryptoSession::HdcpCapability current_hdcp;
CryptoSession::HdcpCapability max_hdcp;
success = crypto_session.GetHdcpCapabilities(&current_hdcp, &max_hdcp);
if (success) {
(*key_info)[QUERY_KEY_CURRENT_HDCP_LEVEL] = MapHdcpVersion(current_hdcp);
@@ -927,20 +927,20 @@ void CdmEngine::OnKeyReleaseEvent(const CdmKeySetId& key_set_id) {
}
std::string CdmEngine::MapHdcpVersion(
CryptoSession::OemCryptoHdcpVersion version) {
CryptoSession::HdcpCapability version) {
switch (version) {
case CryptoSession::kOemCryptoNoHdcpDeviceAttached:
return QUERY_VALUE_DISCONNECTED;
case CryptoSession::kOemCryptoHdcpNotSupported:
case HDCP_NONE:
return QUERY_VALUE_UNPROTECTED;
case CryptoSession::kOemCryptoHdcpVersion1:
case HDCP_V1:
return QUERY_VALUE_HDCP_V1;
case CryptoSession::kOemCryptoHdcpVersion2:
case HDCP_V2:
return QUERY_VALUE_HDCP_V2_0;
case CryptoSession::kOemCryptoHdcpVersion2_1:
case HDCP_V2_1:
return QUERY_VALUE_HDCP_V2_1;
case CryptoSession::kOemCryptoHdcpVersion2_2:
case HDCP_V2_2:
return QUERY_VALUE_HDCP_V2_2;
case HDCP_NO_DIGITAL_OUTPUT:
return QUERY_VALUE_DISCONNECTED;
}
return "";
}

View File

@@ -994,27 +994,20 @@ bool CryptoSession::RewrapDeviceRSAKey(const std::string& message,
return true;
}
bool CryptoSession::GetHdcpCapabilities(OemCryptoHdcpVersion* current_version,
OemCryptoHdcpVersion* max_version) {
bool CryptoSession::GetHdcpCapabilities(HdcpCapability* current,
HdcpCapability* max) {
LOGV("GetHdcpCapabilities: id=%ld", (uint32_t)oec_session_id_);
if (!initialized_) return false;
if (current_version == NULL || max_version == NULL) {
LOGE(
"CryptoSession::GetHdcpCapabilities: |current_version|, "
"|max_version| cannot be NULL");
if (current == NULL || max == NULL) {
LOGE("CryptoSession::GetHdcpCapabilities: |current|, |max| cannot be NULL");
return false;
}
OEMCrypto_HDCP_Capability current, max;
OEMCryptoResult status = OEMCrypto_GetHDCPCapability(
requested_security_level_, &current, &max);
requested_security_level_, current, max);
if (OEMCrypto_SUCCESS != status) {
LOGW("OEMCrypto_GetHDCPCapability fails with %d", status);
return false;
}
*current_version = static_cast<OemCryptoHdcpVersion>(current);
*max_version = static_cast<OemCryptoHdcpVersion>(max);
return true;
}

View File

@@ -282,35 +282,35 @@ bool CdmLicense::PrepareKeyRequest(const InitializationData& init_data,
client_capabilities->set_oem_crypto_api_version(api_version);
}
CryptoSession::OemCryptoHdcpVersion current_version, max_version;
CryptoSession::HdcpCapability current_version, max_version;
if (session_->GetHdcpCapabilities(&current_version, &max_version)) {
switch (max_version) {
case CryptoSession::kOemCryptoHdcpNotSupported:
case HDCP_NONE:
client_capabilities->set_max_hdcp_version(
video_widevine_server::sdk::
ClientIdentification_ClientCapabilities_HdcpVersion_HDCP_NONE);
break;
case CryptoSession::kOemCryptoHdcpVersion1:
case HDCP_V1:
client_capabilities->set_max_hdcp_version(
video_widevine_server::sdk::
ClientIdentification_ClientCapabilities_HdcpVersion_HDCP_V1);
break;
case CryptoSession::kOemCryptoHdcpVersion2:
case HDCP_V2:
client_capabilities->set_max_hdcp_version(
video_widevine_server::sdk::
ClientIdentification_ClientCapabilities_HdcpVersion_HDCP_V2);
break;
case CryptoSession::kOemCryptoHdcpVersion2_1:
case HDCP_V2_1:
client_capabilities->set_max_hdcp_version(
video_widevine_server::sdk::
ClientIdentification_ClientCapabilities_HdcpVersion_HDCP_V2_1);
break;
case CryptoSession::kOemCryptoHdcpVersion2_2:
case HDCP_V2_2:
client_capabilities->set_max_hdcp_version(
video_widevine_server::sdk::
ClientIdentification_ClientCapabilities_HdcpVersion_HDCP_V2_2);
break;
case CryptoSession::kOemCryptoNoHdcpDeviceAttached:
case HDCP_NO_DIGITAL_OUTPUT:
client_capabilities->set_max_hdcp_version(
video_widevine_server::sdk::
ClientIdentification_ClientCapabilities_HdcpVersion_HDCP_NO_DIGITAL_OUTPUT);

View File

@@ -76,10 +76,10 @@ void MaxResEngine::OnTimerEvent() {
int64_t current_time = clock_->GetCurrentTime();
if (!keys_.empty() && current_resolution_ != kNoResolution &&
current_time >= next_check_time_) {
CryptoSession::OemCryptoHdcpVersion current_hdcp_level;
CryptoSession::OemCryptoHdcpVersion ignored;
CryptoSession::HdcpCapability current_hdcp_level;
CryptoSession::HdcpCapability ignored;
if (!crypto_session_->GetHdcpCapabilities(&current_hdcp_level, &ignored)) {
current_hdcp_level = CryptoSession::kOemCryptoHdcpNotSupported;
current_hdcp_level = HDCP_NONE;
}
for (KeyIterator i = keys_.begin(); i != keys_.end(); ++i) {
i->second->Update(current_resolution_, current_hdcp_level);
@@ -95,7 +95,7 @@ void MaxResEngine::DeleteAllKeys() {
}
MaxResEngine::KeyStatus::KeyStatus(const ConstraintList& constraints)
: default_hdcp_level_(CryptoSession::kOemCryptoHdcpNotSupported) {
: default_hdcp_level_(HDCP_NONE) {
Init(constraints);
}
@@ -113,7 +113,7 @@ void MaxResEngine::KeyStatus::Init(const ConstraintList& constraints) {
}
void MaxResEngine::KeyStatus::Update(
uint32_t res, CryptoSession::OemCryptoHdcpVersion current_hdcp_level) {
uint32_t res, CryptoSession::HdcpCapability current_hdcp_level) {
VideoResolutionConstraint* current_constraint = GetConstraintForRes(res);
if (current_constraint == NULL) {
@@ -121,7 +121,7 @@ void MaxResEngine::KeyStatus::Update(
return;
}
CryptoSession::OemCryptoHdcpVersion desired_hdcp_level;
CryptoSession::HdcpCapability desired_hdcp_level;
if (current_constraint->has_required_protection()) {
desired_hdcp_level = ProtobufHdcpToOemCryptoHdcp(
current_constraint->required_protection().hdcp());
@@ -147,25 +147,26 @@ MaxResEngine::KeyStatus::GetConstraintForRes(uint32_t res) {
return NULL;
}
CryptoSession::OemCryptoHdcpVersion
CryptoSession::HdcpCapability
MaxResEngine::KeyStatus::ProtobufHdcpToOemCryptoHdcp(
const OutputProtection::HDCP& input) {
switch (input) {
case OutputProtection::HDCP_NONE:
return CryptoSession::kOemCryptoHdcpNotSupported;
return HDCP_NONE;
case OutputProtection::HDCP_V1:
return CryptoSession::kOemCryptoHdcpVersion1;
return HDCP_V1;
case OutputProtection::HDCP_V2:
return CryptoSession::kOemCryptoHdcpVersion2;
return HDCP_V2;
case OutputProtection::HDCP_V2_1:
return CryptoSession::kOemCryptoHdcpVersion2_1;
return HDCP_V2_1;
case OutputProtection::HDCP_V2_2:
return CryptoSession::kOemCryptoHdcpVersion2_2;
return HDCP_V2_2;
case OutputProtection::HDCP_NO_DIGITAL_OUTPUT:
return HDCP_NO_DIGITAL_OUTPUT;
default:
LOGE(
"MaxResEngine::KeyStatus::ProtobufHdcpToOemCryptoHdcp: "
"Unknown HDCP Level");
return CryptoSession::kOemCryptoNoHdcpDeviceAttached;
LOGE("MaxResEngine::KeyStatus::ProtobufHdcpToOemCryptoHdcp: "
"Unknown HDCP Level");
return HDCP_NO_DIGITAL_OUTPUT;
}
}