widevine_key_system_properties.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // 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. #ifndef COMPONENTS_CDM_RENDERER_WIDEVINE_KEY_SYSTEM_PROPERTIES_H_
  5. #define COMPONENTS_CDM_RENDERER_WIDEVINE_KEY_SYSTEM_PROPERTIES_H_
  6. #include <string>
  7. #include "base/containers/flat_set.h"
  8. #include "media/base/content_decryption_module.h"
  9. #include "media/base/key_system_properties.h"
  10. #include "third_party/abseil-cpp/absl/types/optional.h"
  11. namespace cdm {
  12. // Implementation of KeySystemProperties for Widevine key system.
  13. class WidevineKeySystemProperties : public media::KeySystemProperties {
  14. public:
  15. // Robustness values understood by the Widevine key system.
  16. // Note: GetRobustnessConfigRule is dependent on the order of these.
  17. enum class Robustness {
  18. INVALID,
  19. EMPTY,
  20. SW_SECURE_CRYPTO,
  21. SW_SECURE_DECODE,
  22. HW_SECURE_CRYPTO,
  23. HW_SECURE_DECODE,
  24. HW_SECURE_ALL,
  25. };
  26. WidevineKeySystemProperties(
  27. media::SupportedCodecs codecs,
  28. base::flat_set<media::EncryptionScheme> encryption_schemes,
  29. base::flat_set<media::CdmSessionType> session_types,
  30. media::SupportedCodecs hw_secure_codecs,
  31. base::flat_set<media::EncryptionScheme> hw_secure_encryption_schemes,
  32. base::flat_set<media::CdmSessionType> hw_secure_session_types,
  33. Robustness max_audio_robustness,
  34. Robustness max_video_robustness,
  35. media::EmeFeatureSupport persistent_state_support,
  36. media::EmeFeatureSupport distinctive_identifier_support);
  37. ~WidevineKeySystemProperties() override;
  38. std::string GetBaseKeySystemName() const override;
  39. bool IsSupportedKeySystem(const std::string& key_system) const override;
  40. bool ShouldUseBaseKeySystemName() const override;
  41. bool IsSupportedInitDataType(
  42. media::EmeInitDataType init_data_type) const override;
  43. media::EmeConfig::Rule GetEncryptionSchemeConfigRule(
  44. media::EncryptionScheme encryption_scheme) const override;
  45. media::SupportedCodecs GetSupportedCodecs() const override;
  46. media::SupportedCodecs GetSupportedHwSecureCodecs() const override;
  47. media::EmeConfig::Rule GetRobustnessConfigRule(
  48. const std::string& key_system,
  49. media::EmeMediaType media_type,
  50. const std::string& requested_robustness,
  51. const bool* hw_secure_requirement) const override;
  52. media::EmeConfig::Rule GetPersistentLicenseSessionSupport() const override;
  53. media::EmeFeatureSupport GetPersistentStateSupport() const override;
  54. media::EmeFeatureSupport GetDistinctiveIdentifierSupport() const override;
  55. private:
  56. const media::SupportedCodecs codecs_;
  57. const base::flat_set<media::EncryptionScheme> encryption_schemes_;
  58. const base::flat_set<media::CdmSessionType> session_types_;
  59. const media::SupportedCodecs hw_secure_codecs_;
  60. const base::flat_set<media::EncryptionScheme> hw_secure_encryption_schemes_;
  61. const base::flat_set<media::CdmSessionType> hw_secure_session_types_;
  62. const Robustness max_audio_robustness_;
  63. const Robustness max_video_robustness_;
  64. const media::EmeFeatureSupport persistent_state_support_;
  65. const media::EmeFeatureSupport distinctive_identifier_support_;
  66. };
  67. } // namespace cdm
  68. #endif // COMPONENTS_CDM_RENDERER_WIDEVINE_KEY_SYSTEM_PROPERTIES_H_