Group license support
This commit is contained in:
@@ -42,21 +42,19 @@ CasStatus WidevineCasSession::initialize(
|
||||
return CasStatusCode::kNoError;
|
||||
}
|
||||
|
||||
const KeySlot& WidevineCasSession::key(KeySlotId slot_id) const {
|
||||
// TODO(): Make this function private and assume the mutex is locked.
|
||||
// std::unique_lock<std::mutex> lock(lock_);
|
||||
const KeySlot& key_slot = keys_[slot_id];
|
||||
return key_slot;
|
||||
}
|
||||
|
||||
CasStatus WidevineCasSession::processEcm(const CasEcm& ecm,
|
||||
uint8_t parental_control_age) {
|
||||
uint8_t parental_control_age,
|
||||
const std::string& license_group_id) {
|
||||
if (ecm != current_ecm_) {
|
||||
LOGD("WidevineCasSession::processEcm: received new ecm");
|
||||
std::unique_ptr<const EcmParser> ecm_parser = getEcmParser(ecm);
|
||||
std::unique_ptr<EcmParser> ecm_parser = getEcmParser(ecm);
|
||||
if (ecm_parser == nullptr) {
|
||||
return CasStatus(CasStatusCode::kInvalidParameter, "invalid ecm");
|
||||
}
|
||||
if (!license_group_id.empty() &&
|
||||
!ecm_parser->set_group_id(license_group_id)) {
|
||||
return CasStatus(CasStatusCode::kInvalidParameter, "invalid group id");
|
||||
}
|
||||
|
||||
ecm_age_restriction_ = ecm_parser->age_restriction();
|
||||
// Parental control check.
|
||||
@@ -114,7 +112,8 @@ CasStatus WidevineCasSession::processEcm(const CasEcm& ecm,
|
||||
// Temporary key slots to only have successfully loaded keys in |keys_|.
|
||||
CasKeySlotData keys;
|
||||
do {
|
||||
if (keys_[keyslot_id].key_id != ecm_parser->content_key_id(keyslot_id)) {
|
||||
if (keys_[keyslot_id].wrapped_key !=
|
||||
ecm_parser->wrapped_key_data(keyslot_id)) {
|
||||
KeySlot& key = keys[keyslot_id];
|
||||
key.key_id = ecm_parser->content_key_id(keyslot_id);
|
||||
key.wrapped_key = ecm_parser->wrapped_key_data(keyslot_id);
|
||||
@@ -161,7 +160,7 @@ CasStatus WidevineCasSession::processEcm(const CasEcm& ecm,
|
||||
return CasStatusCode::kNoError;
|
||||
}
|
||||
|
||||
std::unique_ptr<const EcmParser> WidevineCasSession::getEcmParser(
|
||||
std::unique_ptr<EcmParser> WidevineCasSession::getEcmParser(
|
||||
const CasEcm& ecm) const {
|
||||
return EcmParser::Create(ecm);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user