blob: acc6f42571ecc8b6adb6fa3326360ec7211c0bad [file] [log] [blame]
halliwell8f42dd52016-04-29 16:06:331// Copyright 2016 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Vikram Pasupathyd2e5386d2022-09-02 17:32:255#ifndef COMPONENTS_CDM_RENDERER_WIDEVINE_KEY_SYSTEM_INFO_H_
6#define COMPONENTS_CDM_RENDERER_WIDEVINE_KEY_SYSTEM_INFO_H_
halliwell8f42dd52016-04-29 16:06:337
John Rummell6d57d9f62018-05-16 21:12:298#include <string>
John Rummell6d57d9f62018-05-16 21:12:299
10#include "base/containers/flat_set.h"
Xiaohan Wang1c3543f52022-05-16 21:20:5011#include "media/base/content_decryption_module.h"
Vikram Pasupathyd2e5386d2022-09-02 17:32:2512#include "media/base/key_system_info.h"
Vikram Pasupathy48f8ca42022-07-19 20:08:2913#include "third_party/abseil-cpp/absl/types/optional.h"
halliwell8f42dd52016-04-29 16:06:3314
15namespace cdm {
16
Vikram Pasupathyd2e5386d2022-09-02 17:32:2517// Implementation of KeySystemInfo for Widevine key system.
18class WidevineKeySystemInfo : public media::KeySystemInfo {
halliwell8f42dd52016-04-29 16:06:3319 public:
halliwell98237dc2016-06-01 02:10:5020 // Robustness values understood by the Widevine key system.
21 // Note: GetRobustnessConfigRule is dependent on the order of these.
22 enum class Robustness {
23 INVALID,
24 EMPTY,
25 SW_SECURE_CRYPTO,
26 SW_SECURE_DECODE,
27 HW_SECURE_CRYPTO,
28 HW_SECURE_DECODE,
29 HW_SECURE_ALL,
30 };
31
Vikram Pasupathyd2e5386d2022-09-02 17:32:2532 WidevineKeySystemInfo(
Xiaohan Wang611bde762018-06-28 21:37:3433 media::SupportedCodecs codecs,
Yuchen Liub33bfc12019-11-08 20:16:1234 base::flat_set<media::EncryptionScheme> encryption_schemes,
Xiaohan Wang1c3543f52022-05-16 21:20:5035 base::flat_set<media::CdmSessionType> session_types,
Xiaohan Wang611bde762018-06-28 21:37:3436 media::SupportedCodecs hw_secure_codecs,
Yuchen Liub33bfc12019-11-08 20:16:1237 base::flat_set<media::EncryptionScheme> hw_secure_encryption_schemes,
Xiaohan Wang1c3543f52022-05-16 21:20:5038 base::flat_set<media::CdmSessionType> hw_secure_session_types,
halliwell98237dc2016-06-01 02:10:5039 Robustness max_audio_robustness,
40 Robustness max_video_robustness,
halliwell8f42dd52016-04-29 16:06:3341 media::EmeFeatureSupport persistent_state_support,
42 media::EmeFeatureSupport distinctive_identifier_support);
Vikram Pasupathyd2e5386d2022-09-02 17:32:2543 ~WidevineKeySystemInfo() override;
halliwell8f42dd52016-04-29 16:06:3344
Xiaohan Wang9f90b2e762021-11-16 19:17:2145 std::string GetBaseKeySystemName() const override;
Xiaohan Wang9fd9be1c2021-11-17 17:20:1646 bool IsSupportedKeySystem(const std::string& key_system) const override;
47 bool ShouldUseBaseKeySystemName() const override;
halliwell8f42dd52016-04-29 16:06:3348 bool IsSupportedInitDataType(
49 media::EmeInitDataType init_data_type) const override;
Vikram Pasupathy9f6c2f92022-08-05 20:46:1050 media::EmeConfig::Rule GetEncryptionSchemeConfigRule(
Yuchen Liub33bfc12019-11-08 20:16:1251 media::EncryptionScheme encryption_scheme) const override;
halliwell8f42dd52016-04-29 16:06:3352 media::SupportedCodecs GetSupportedCodecs() const override;
Xiaohan Wang648b4322018-06-12 21:52:2853 media::SupportedCodecs GetSupportedHwSecureCodecs() const override;
Vikram Pasupathy9f6c2f92022-08-05 20:46:1054 media::EmeConfig::Rule GetRobustnessConfigRule(
Xiaohan Wang9fd9be1c2021-11-17 17:20:1655 const std::string& key_system,
halliwell8f42dd52016-04-29 16:06:3356 media::EmeMediaType media_type,
Jeffrey Kardatzkec1663f7f2021-05-07 00:01:0457 const std::string& requested_robustness,
58 const bool* hw_secure_requirement) const override;
Vikram Pasupathy9f6c2f92022-08-05 20:46:1059 media::EmeConfig::Rule GetPersistentLicenseSessionSupport() const override;
halliwell8f42dd52016-04-29 16:06:3360 media::EmeFeatureSupport GetPersistentStateSupport() const override;
61 media::EmeFeatureSupport GetDistinctiveIdentifierSupport() const override;
62
halliwell8f42dd52016-04-29 16:06:3363 private:
Xiaohan Wang611bde762018-06-28 21:37:3464 const media::SupportedCodecs codecs_;
Yuchen Liub33bfc12019-11-08 20:16:1265 const base::flat_set<media::EncryptionScheme> encryption_schemes_;
Xiaohan Wang1c3543f52022-05-16 21:20:5066 const base::flat_set<media::CdmSessionType> session_types_;
Xiaohan Wang611bde762018-06-28 21:37:3467 const media::SupportedCodecs hw_secure_codecs_;
Yuchen Liub33bfc12019-11-08 20:16:1268 const base::flat_set<media::EncryptionScheme> hw_secure_encryption_schemes_;
Xiaohan Wang1c3543f52022-05-16 21:20:5069 const base::flat_set<media::CdmSessionType> hw_secure_session_types_;
halliwell98237dc2016-06-01 02:10:5070 const Robustness max_audio_robustness_;
71 const Robustness max_video_robustness_;
halliwell8f42dd52016-04-29 16:06:3372 const media::EmeFeatureSupport persistent_state_support_;
73 const media::EmeFeatureSupport distinctive_identifier_support_;
74};
75
76} // namespace cdm
77
Vikram Pasupathyd2e5386d2022-09-02 17:32:2578#endif // COMPONENTS_CDM_RENDERER_WIDEVINE_KEY_SYSTEM_INFO_H_