blob: 8163fa7a6b5164a61125e0556bea3d938e41610d [file] [log] [blame]
Avi Drissman8ba1bad2022-09-13 19:22:361// Copyright 2016 The Chromium Authors
halliwell8f42dd52016-04-29 16:06:332// 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"
halliwell8f42dd52016-04-29 16:06:3313
14namespace cdm {
15
Vikram Pasupathyd2e5386d2022-09-02 17:32:2516// Implementation of KeySystemInfo for Widevine key system.
17class WidevineKeySystemInfo : public media::KeySystemInfo {
halliwell8f42dd52016-04-29 16:06:3318 public:
halliwell98237dc2016-06-01 02:10:5019 // 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 Pasupathyd2e5386d2022-09-02 17:32:2531 WidevineKeySystemInfo(
Xiaohan Wang611bde762018-06-28 21:37:3432 media::SupportedCodecs codecs,
Yuchen Liub33bfc12019-11-08 20:16:1233 base::flat_set<media::EncryptionScheme> encryption_schemes,
Xiaohan Wang1c3543f52022-05-16 21:20:5034 base::flat_set<media::CdmSessionType> session_types,
Xiaohan Wang611bde762018-06-28 21:37:3435 media::SupportedCodecs hw_secure_codecs,
Yuchen Liub33bfc12019-11-08 20:16:1236 base::flat_set<media::EncryptionScheme> hw_secure_encryption_schemes,
Xiaohan Wang1c3543f52022-05-16 21:20:5037 base::flat_set<media::CdmSessionType> hw_secure_session_types,
halliwell98237dc2016-06-01 02:10:5038 Robustness max_audio_robustness,
39 Robustness max_video_robustness,
halliwell8f42dd52016-04-29 16:06:3340 media::EmeFeatureSupport persistent_state_support,
41 media::EmeFeatureSupport distinctive_identifier_support);
Vikram Pasupathyd2e5386d2022-09-02 17:32:2542 ~WidevineKeySystemInfo() override;
halliwell8f42dd52016-04-29 16:06:3343
Xiaohan Wang9f90b2e762021-11-16 19:17:2144 std::string GetBaseKeySystemName() const override;
Xiaohan Wang9fd9be1c2021-11-17 17:20:1645 bool IsSupportedKeySystem(const std::string& key_system) const override;
46 bool ShouldUseBaseKeySystemName() const override;
halliwell8f42dd52016-04-29 16:06:3347 bool IsSupportedInitDataType(
48 media::EmeInitDataType init_data_type) const override;
Vikram Pasupathy9f6c2f92022-08-05 20:46:1049 media::EmeConfig::Rule GetEncryptionSchemeConfigRule(
Yuchen Liub33bfc12019-11-08 20:16:1250 media::EncryptionScheme encryption_scheme) const override;
halliwell8f42dd52016-04-29 16:06:3351 media::SupportedCodecs GetSupportedCodecs() const override;
Xiaohan Wang648b4322018-06-12 21:52:2852 media::SupportedCodecs GetSupportedHwSecureCodecs() const override;
Vikram Pasupathy9f6c2f92022-08-05 20:46:1053 media::EmeConfig::Rule GetRobustnessConfigRule(
Xiaohan Wang9fd9be1c2021-11-17 17:20:1654 const std::string& key_system,
halliwell8f42dd52016-04-29 16:06:3355 media::EmeMediaType media_type,
Jeffrey Kardatzkec1663f7f2021-05-07 00:01:0456 const std::string& requested_robustness,
57 const bool* hw_secure_requirement) const override;
Vikram Pasupathy9f6c2f92022-08-05 20:46:1058 media::EmeConfig::Rule GetPersistentLicenseSessionSupport() const override;
halliwell8f42dd52016-04-29 16:06:3359 media::EmeFeatureSupport GetPersistentStateSupport() const override;
60 media::EmeFeatureSupport GetDistinctiveIdentifierSupport() const override;
61
Vikram Pasupathy21e4c83d2022-09-27 18:37:3362#if BUILDFLAG(IS_WIN)
Vikram Pasupathyf68683cc2023-02-15 05:39:3063 // `is_experimental_` is used to differentiate between
64 // `kWidevineExperimentKeySystem` and `kWidevineKeySystem`. Please refer to
65 // b/219818166 for more information.
Vikram Pasupathy21e4c83d2022-09-27 18:37:3366 void set_experimental() { is_experimental_ = true; }
67#endif // BUILDFLAG(IS_WIN)
68
halliwell8f42dd52016-04-29 16:06:3369 private:
Xiaohan Wang611bde762018-06-28 21:37:3470 const media::SupportedCodecs codecs_;
Yuchen Liub33bfc12019-11-08 20:16:1271 const base::flat_set<media::EncryptionScheme> encryption_schemes_;
Xiaohan Wang1c3543f52022-05-16 21:20:5072 const base::flat_set<media::CdmSessionType> session_types_;
Xiaohan Wang611bde762018-06-28 21:37:3473 const media::SupportedCodecs hw_secure_codecs_;
Yuchen Liub33bfc12019-11-08 20:16:1274 const base::flat_set<media::EncryptionScheme> hw_secure_encryption_schemes_;
Xiaohan Wang1c3543f52022-05-16 21:20:5075 const base::flat_set<media::CdmSessionType> hw_secure_session_types_;
halliwell98237dc2016-06-01 02:10:5076 const Robustness max_audio_robustness_;
77 const Robustness max_video_robustness_;
halliwell8f42dd52016-04-29 16:06:3378 const media::EmeFeatureSupport persistent_state_support_;
79 const media::EmeFeatureSupport distinctive_identifier_support_;
Vikram Pasupathy21e4c83d2022-09-27 18:37:3380#if BUILDFLAG(IS_WIN)
81 bool is_experimental_ = false;
82#endif // BUILDFLAG(IS_WIN)
halliwell8f42dd52016-04-29 16:06:3383};
84
85} // namespace cdm
86
Vikram Pasupathyd2e5386d2022-09-02 17:32:2587#endif // COMPONENTS_CDM_RENDERER_WIDEVINE_KEY_SYSTEM_INFO_H_