Avi Drissman | 8ba1bad | 2022-09-13 19:22:36 | [diff] [blame] | 1 | // Copyright 2016 The Chromium Authors |
halliwell | 8f42dd5 | 2016-04-29 16:06:33 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Vikram Pasupathy | d2e5386d | 2022-09-02 17:32:25 | [diff] [blame] | 5 | #ifndef COMPONENTS_CDM_RENDERER_WIDEVINE_KEY_SYSTEM_INFO_H_ |
| 6 | #define COMPONENTS_CDM_RENDERER_WIDEVINE_KEY_SYSTEM_INFO_H_ |
halliwell | 8f42dd5 | 2016-04-29 16:06:33 | [diff] [blame] | 7 | |
John Rummell | 6d57d9f6 | 2018-05-16 21:12:29 | [diff] [blame] | 8 | #include <string> |
John Rummell | 6d57d9f6 | 2018-05-16 21:12:29 | [diff] [blame] | 9 | |
| 10 | #include "base/containers/flat_set.h" |
Xiaohan Wang | 1c3543f5 | 2022-05-16 21:20:50 | [diff] [blame] | 11 | #include "media/base/content_decryption_module.h" |
Vikram Pasupathy | d2e5386d | 2022-09-02 17:32:25 | [diff] [blame] | 12 | #include "media/base/key_system_info.h" |
halliwell | 8f42dd5 | 2016-04-29 16:06:33 | [diff] [blame] | 13 | |
| 14 | namespace cdm { |
| 15 | |
Vikram Pasupathy | d2e5386d | 2022-09-02 17:32:25 | [diff] [blame] | 16 | // Implementation of KeySystemInfo for Widevine key system. |
| 17 | class WidevineKeySystemInfo : public media::KeySystemInfo { |
halliwell | 8f42dd5 | 2016-04-29 16:06:33 | [diff] [blame] | 18 | public: |
halliwell | 98237dc | 2016-06-01 02:10:50 | [diff] [blame] | 19 | // Robustness values understood by the Widevine key system. |
| 20 | // Note: GetRobustnessConfigRule is dependent on the order of these. |
| 21 | enum class Robustness { |
| 22 | INVALID, |
| 23 | EMPTY, |
| 24 | SW_SECURE_CRYPTO, |
| 25 | SW_SECURE_DECODE, |
| 26 | HW_SECURE_CRYPTO, |
| 27 | HW_SECURE_DECODE, |
| 28 | HW_SECURE_ALL, |
| 29 | }; |
| 30 | |
Vikram Pasupathy | d2e5386d | 2022-09-02 17:32:25 | [diff] [blame] | 31 | WidevineKeySystemInfo( |
Xiaohan Wang | 611bde76 | 2018-06-28 21:37:34 | [diff] [blame] | 32 | media::SupportedCodecs codecs, |
Yuchen Liu | b33bfc1 | 2019-11-08 20:16:12 | [diff] [blame] | 33 | base::flat_set<media::EncryptionScheme> encryption_schemes, |
Xiaohan Wang | 1c3543f5 | 2022-05-16 21:20:50 | [diff] [blame] | 34 | base::flat_set<media::CdmSessionType> session_types, |
Xiaohan Wang | 611bde76 | 2018-06-28 21:37:34 | [diff] [blame] | 35 | media::SupportedCodecs hw_secure_codecs, |
Yuchen Liu | b33bfc1 | 2019-11-08 20:16:12 | [diff] [blame] | 36 | base::flat_set<media::EncryptionScheme> hw_secure_encryption_schemes, |
Xiaohan Wang | 1c3543f5 | 2022-05-16 21:20:50 | [diff] [blame] | 37 | base::flat_set<media::CdmSessionType> hw_secure_session_types, |
halliwell | 98237dc | 2016-06-01 02:10:50 | [diff] [blame] | 38 | Robustness max_audio_robustness, |
| 39 | Robustness max_video_robustness, |
halliwell | 8f42dd5 | 2016-04-29 16:06:33 | [diff] [blame] | 40 | media::EmeFeatureSupport persistent_state_support, |
| 41 | media::EmeFeatureSupport distinctive_identifier_support); |
Vikram Pasupathy | d2e5386d | 2022-09-02 17:32:25 | [diff] [blame] | 42 | ~WidevineKeySystemInfo() override; |
halliwell | 8f42dd5 | 2016-04-29 16:06:33 | [diff] [blame] | 43 | |
Xiaohan Wang | 9f90b2e76 | 2021-11-16 19:17:21 | [diff] [blame] | 44 | std::string GetBaseKeySystemName() const override; |
Xiaohan Wang | 9fd9be1c | 2021-11-17 17:20:16 | [diff] [blame] | 45 | bool IsSupportedKeySystem(const std::string& key_system) const override; |
| 46 | bool ShouldUseBaseKeySystemName() const override; |
halliwell | 8f42dd5 | 2016-04-29 16:06:33 | [diff] [blame] | 47 | bool IsSupportedInitDataType( |
| 48 | media::EmeInitDataType init_data_type) const override; |
Vikram Pasupathy | 9f6c2f9 | 2022-08-05 20:46:10 | [diff] [blame] | 49 | media::EmeConfig::Rule GetEncryptionSchemeConfigRule( |
Yuchen Liu | b33bfc1 | 2019-11-08 20:16:12 | [diff] [blame] | 50 | media::EncryptionScheme encryption_scheme) const override; |
halliwell | 8f42dd5 | 2016-04-29 16:06:33 | [diff] [blame] | 51 | media::SupportedCodecs GetSupportedCodecs() const override; |
Xiaohan Wang | 648b432 | 2018-06-12 21:52:28 | [diff] [blame] | 52 | media::SupportedCodecs GetSupportedHwSecureCodecs() const override; |
Vikram Pasupathy | 9f6c2f9 | 2022-08-05 20:46:10 | [diff] [blame] | 53 | media::EmeConfig::Rule GetRobustnessConfigRule( |
Xiaohan Wang | 9fd9be1c | 2021-11-17 17:20:16 | [diff] [blame] | 54 | const std::string& key_system, |
halliwell | 8f42dd5 | 2016-04-29 16:06:33 | [diff] [blame] | 55 | media::EmeMediaType media_type, |
Jeffrey Kardatzke | c1663f7f | 2021-05-07 00:01:04 | [diff] [blame] | 56 | const std::string& requested_robustness, |
| 57 | const bool* hw_secure_requirement) const override; |
Vikram Pasupathy | 9f6c2f9 | 2022-08-05 20:46:10 | [diff] [blame] | 58 | media::EmeConfig::Rule GetPersistentLicenseSessionSupport() const override; |
halliwell | 8f42dd5 | 2016-04-29 16:06:33 | [diff] [blame] | 59 | media::EmeFeatureSupport GetPersistentStateSupport() const override; |
| 60 | media::EmeFeatureSupport GetDistinctiveIdentifierSupport() const override; |
| 61 | |
Vikram Pasupathy | 21e4c83d | 2022-09-27 18:37:33 | [diff] [blame] | 62 | #if BUILDFLAG(IS_WIN) |
Vikram Pasupathy | f68683cc | 2023-02-15 05:39:30 | [diff] [blame] | 63 | // `is_experimental_` is used to differentiate between |
| 64 | // `kWidevineExperimentKeySystem` and `kWidevineKeySystem`. Please refer to |
| 65 | // b/219818166 for more information. |
Vikram Pasupathy | 21e4c83d | 2022-09-27 18:37:33 | [diff] [blame] | 66 | void set_experimental() { is_experimental_ = true; } |
| 67 | #endif // BUILDFLAG(IS_WIN) |
| 68 | |
halliwell | 8f42dd5 | 2016-04-29 16:06:33 | [diff] [blame] | 69 | private: |
Xiaohan Wang | 611bde76 | 2018-06-28 21:37:34 | [diff] [blame] | 70 | const media::SupportedCodecs codecs_; |
Yuchen Liu | b33bfc1 | 2019-11-08 20:16:12 | [diff] [blame] | 71 | const base::flat_set<media::EncryptionScheme> encryption_schemes_; |
Xiaohan Wang | 1c3543f5 | 2022-05-16 21:20:50 | [diff] [blame] | 72 | const base::flat_set<media::CdmSessionType> session_types_; |
Xiaohan Wang | 611bde76 | 2018-06-28 21:37:34 | [diff] [blame] | 73 | const media::SupportedCodecs hw_secure_codecs_; |
Yuchen Liu | b33bfc1 | 2019-11-08 20:16:12 | [diff] [blame] | 74 | const base::flat_set<media::EncryptionScheme> hw_secure_encryption_schemes_; |
Xiaohan Wang | 1c3543f5 | 2022-05-16 21:20:50 | [diff] [blame] | 75 | const base::flat_set<media::CdmSessionType> hw_secure_session_types_; |
halliwell | 98237dc | 2016-06-01 02:10:50 | [diff] [blame] | 76 | const Robustness max_audio_robustness_; |
| 77 | const Robustness max_video_robustness_; |
halliwell | 8f42dd5 | 2016-04-29 16:06:33 | [diff] [blame] | 78 | const media::EmeFeatureSupport persistent_state_support_; |
| 79 | const media::EmeFeatureSupport distinctive_identifier_support_; |
Vikram Pasupathy | 21e4c83d | 2022-09-27 18:37:33 | [diff] [blame] | 80 | #if BUILDFLAG(IS_WIN) |
| 81 | bool is_experimental_ = false; |
| 82 | #endif // BUILDFLAG(IS_WIN) |
halliwell | 8f42dd5 | 2016-04-29 16:06:33 | [diff] [blame] | 83 | }; |
| 84 | |
| 85 | } // namespace cdm |
| 86 | |
Vikram Pasupathy | d2e5386d | 2022-09-02 17:32:25 | [diff] [blame] | 87 | #endif // COMPONENTS_CDM_RENDERER_WIDEVINE_KEY_SYSTEM_INFO_H_ |