#include "media/base/key_systems_impl.h"
#include <stddef.h>
#include <algorithm>
#include <memory>
#include <unordered_map>
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/memory/weak_ptr.h"
#include "base/notreached.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "media/base/eme_constants.h"
#include "media/base/key_system_names.h"
#include "media/base/media.h"
#include "media/base/media_client.h"
#include "media/base/media_switches.h"
#include "media/base/mime_util.h"
#include "media/cdm/clear_key_cdm_common.h"
#include "media/media_buildflags.h"
#include "third_party/widevine/cdm/widevine_cdm_common.h"
namespace media {
namespace {
struct MimeTypeToCodecs { … };
static const MimeTypeToCodecs kMimeTypeToCodecsMap[] = …;
EmeCodec ToAudioEmeCodec(AudioCodec codec) { … }
EmeCodec ToVideoEmeCodec(VideoCodec codec, VideoCodecProfile profile) { … }
class ClearKeyKeySystemInfo : public KeySystemInfo { … };
static bool IsPotentiallySupportedKeySystem(const std::string& key_system) { … }
static bool CanBlock(const KeySystemInfo& key_system_info) { … }
}
KeySystemsImpl::KeySystemsImpl(RegisterKeySystemsSupportCB cb)
: … { … }
KeySystemsImpl::~KeySystemsImpl() { … }
void KeySystemsImpl::Initialize() { … }
void KeySystemsImpl::UpdateSupportedKeySystems() { … }
void KeySystemsImpl::UpdateIfNeeded(base::OnceClosure done_cb) { … }
SupportedCodecs KeySystemsImpl::GetCodecMaskForMimeType(
const std::string& container_mime_type) const { … }
EmeCodec KeySystemsImpl::GetEmeCodecForString(
EmeMediaType media_type,
const std::string& container_mime_type,
const std::string& codec_string) const { … }
void KeySystemsImpl::OnSupportedKeySystemsUpdated(KeySystemInfos key_systems) { … }
void KeySystemsImpl::ProcessSupportedKeySystems(KeySystemInfos key_systems) { … }
const KeySystemInfo* KeySystemsImpl::GetKeySystemInfo(
const std::string& key_system) const { … }
void KeySystemsImpl::RegisterMimeType(const std::string& mime_type,
SupportedCodecs codecs) { … }
bool KeySystemsImpl::IsValidMimeTypeCodecsCombination(
const std::string& mime_type,
SupportedCodecs codecs) const { … }
bool KeySystemsImpl::IsSupportedInitDataType(
const std::string& key_system,
EmeInitDataType init_data_type) const { … }
EmeConfig::Rule KeySystemsImpl::GetEncryptionSchemeConfigRule(
const std::string& key_system,
EncryptionScheme encryption_scheme) const { … }
void KeySystemsImpl::AddCodecMaskForTesting(EmeMediaType media_type,
const std::string& codec,
uint32_t mask) { … }
void KeySystemsImpl::AddMimeTypeCodecMaskForTesting(
const std::string& mime_type,
uint32_t codecs_mask) { … }
void KeySystemsImpl::ResetForTesting() { … }
std::string KeySystemsImpl::GetBaseKeySystemName(
const std::string& key_system) const { … }
bool KeySystemsImpl::IsSupportedKeySystem(const std::string& key_system) const { … }
bool KeySystemsImpl::ShouldUseBaseKeySystemName(
const std::string& key_system) const { … }
bool KeySystemsImpl::CanUseAesDecryptor(const std::string& key_system) const { … }
EmeConfig::Rule KeySystemsImpl::GetContentTypeConfigRule(
const std::string& key_system,
EmeMediaType media_type,
const std::string& container_mime_type,
const std::vector<std::string>& codecs) const { … }
EmeConfig::Rule KeySystemsImpl::GetRobustnessConfigRule(
const std::string& key_system,
EmeMediaType media_type,
const std::string& requested_robustness,
const bool* hw_secure_requirement) const { … }
EmeConfig::Rule KeySystemsImpl::GetPersistentLicenseSessionSupport(
const std::string& key_system) const { … }
EmeFeatureSupport KeySystemsImpl::GetPersistentStateSupport(
const std::string& key_system) const { … }
EmeFeatureSupport KeySystemsImpl::GetDistinctiveIdentifierSupport(
const std::string& key_system) const { … }
}