Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_BASE_KEY_SYSTEMS_H_ | 5 #ifndef MEDIA_BASE_KEY_SYSTEMS_H_ |
| 6 #define MEDIA_BASE_KEY_SYSTEMS_H_ | 6 #define MEDIA_BASE_KEY_SYSTEMS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "media/base/eme_constants.h" | 12 #include "media/base/eme_constants.h" |
| 13 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
| 14 | 14 |
| 15 namespace media { | 15 namespace media { |
| 16 | 16 |
| 17 class MEDIA_EXPORT KeySystems { | |
| 18 public: | |
| 19 static KeySystems& GetInstance(); | |
|
ddorwin
2015/03/20 00:55:03
const ref?
sandersd (OOO until July 31)
2015/03/20 22:53:19
No, we may need to provide access to methods that
| |
| 20 | |
| 21 // Returns whether the list of codecs are supported together by |key_system|. | |
| 22 // TODO(sandersd): Return a rule instead of a bool so that codec selection can | |
| 23 // affect other configuration options (namely robustness). | |
| 24 virtual bool IsSupportedCodecCombination( | |
| 25 const std::string& key_system, | |
| 26 EmeMediaType media_type, | |
| 27 const std::string& container_mime_type, | |
| 28 const std::vector<std::string>& codecs) const = 0; | |
| 29 | |
| 30 // Returns the configuration rule for supporting a robustness requirement. | |
| 31 virtual EmeConfigRule GetRobustnessConfigRule( | |
| 32 const std::string& key_system, | |
| 33 EmeMediaType media_type, | |
| 34 EmeRobustness robustness) const = 0; | |
| 35 | |
| 36 // Returns the configuration rule for supporting persistent-license sessions. | |
| 37 virtual EmeConfigRule GetPersistentLicenseSessionConfigRule( | |
| 38 const std::string& key_system) const = 0; | |
| 39 | |
| 40 // Returns the configuration rule for supporting persistent-release-message | |
| 41 // sessions. | |
| 42 virtual EmeConfigRule GetPersistentReleaseMessageSessionConfigRule( | |
| 43 const std::string& key_system) const = 0; | |
| 44 | |
| 45 // Returns the configuration rule for supporting a persistent state | |
| 46 // requirement. | |
| 47 virtual EmeConfigRule GetPersistentStateConfigRule( | |
| 48 const std::string& key_system, | |
| 49 EmeFeatureRequirement requirement) const = 0; | |
| 50 | |
| 51 // Returns the configuration rule for supporting a distinctive identifier | |
| 52 // requirement. | |
| 53 virtual EmeConfigRule GetDistinctiveIdentifierConfigRule( | |
| 54 const std::string& key_system, | |
| 55 EmeFeatureRequirement requirement) const = 0; | |
| 56 }; | |
| 57 | |
| 17 // Prefixed EME API only supports prefixed (webkit-) key system name for | 58 // Prefixed EME API only supports prefixed (webkit-) key system name for |
| 18 // certain key systems. But internally only unprefixed key systems are | 59 // certain key systems. But internally only unprefixed key systems are |
| 19 // supported. The following two functions help convert between prefixed and | 60 // supported. The following two functions help convert between prefixed and |
| 20 // unprefixed key system names. | 61 // unprefixed key system names. |
| 21 | 62 |
| 22 // Gets the unprefixed key system name for |key_system|. | 63 // Gets the unprefixed key system name for |key_system|. |
| 23 MEDIA_EXPORT std::string GetUnprefixedKeySystemName( | 64 MEDIA_EXPORT std::string GetUnprefixedKeySystemName( |
| 24 const std::string& key_system); | 65 const std::string& key_system); |
| 25 | 66 |
| 26 // Gets the prefixed key system name for |key_system|. | 67 // Gets the prefixed key system name for |key_system|. |
| 27 MEDIA_EXPORT std::string GetPrefixedKeySystemName( | 68 MEDIA_EXPORT std::string GetPrefixedKeySystemName( |
| 28 const std::string& key_system); | 69 const std::string& key_system); |
| 29 | 70 |
| 30 // Returns false if a container-specific |init_data_type| is specified with an | 71 // Returns false if a container-specific |init_data_type| is specified with an |
| 31 // inappropriate container. | 72 // inappropriate container. |
| 32 // TODO(sandersd): Remove this essentially internal detail if the spec is | 73 // TODO(sandersd): Remove this essentially internal detail if the spec is |
| 33 // updated to not convolve the two in a single method call. | 74 // updated to not convolve the two in a single method call. |
| 34 // TODO(sandersd): Use enum values instead of strings. http://crbug.com/417440 | 75 // TODO(sandersd): Use enum values instead of strings. http://crbug.com/417440 |
| 35 MEDIA_EXPORT bool IsSaneInitDataTypeWithContainer( | 76 MEDIA_EXPORT bool IsSaneInitDataTypeWithContainer( |
| 36 const std::string& init_data_type, | 77 const std::string& init_data_type, |
| 37 const std::string& container); | 78 const std::string& container); |
| 38 | 79 |
| 39 // Use for unprefixed EME only! | 80 // Use for unprefixed EME only! |
| 40 // Returns whether |key_system| is a supported key system. | 81 // Returns whether |key_system| is a supported key system. |
| 41 // Note: Shouldn't be used for prefixed API as the original | 82 // Note: Shouldn't be used for prefixed API as the original |
| 42 // IsSupportedKeySystemWithMediaMimeType() path reports UMAs, but this path does | 83 // IsSupportedKeySystemWithMediaMimeType() path reports UMAs, but this path does |
| 43 // not. | 84 // not. |
| 44 MEDIA_EXPORT bool IsSupportedKeySystem(const std::string& key_system); | 85 MEDIA_EXPORT bool IsSupportedKeySystem(const std::string& key_system); |
|
ddorwin
2015/03/20 00:55:03
re: The description: It would be good to at least
sandersd (OOO until July 31)
2015/03/20 22:53:19
Agreed, I scoped this CL to avoid having to change
| |
| 45 | 86 |
| 46 MEDIA_EXPORT bool IsSupportedKeySystemWithInitDataType( | 87 MEDIA_EXPORT bool IsSupportedKeySystemWithInitDataType( |
| 47 const std::string& key_system, | 88 const std::string& key_system, |
| 48 const std::string& init_data_type); | 89 const std::string& init_data_type); |
| 49 | 90 |
| 50 // Use for prefixed EME only! | 91 // Use for prefixed EME only! |
| 51 // Returns whether |key_system| is a real supported key system that can be | 92 // Returns whether |key_system| is a real supported key system that can be |
| 52 // instantiated. | 93 // instantiated. |
| 53 // Abstract parent |key_system| strings will return false. | 94 // Abstract parent |key_system| strings will return false. |
| 54 // Call IsSupportedKeySystemWithMediaMimeType() to determine whether a | 95 // Call IsSupportedKeySystemWithMediaMimeType() to determine whether a |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 78 // Returns whether AesDecryptor can be used for the given |concrete_key_system|. | 119 // Returns whether AesDecryptor can be used for the given |concrete_key_system|. |
| 79 MEDIA_EXPORT bool CanUseAesDecryptor(const std::string& concrete_key_system); | 120 MEDIA_EXPORT bool CanUseAesDecryptor(const std::string& concrete_key_system); |
| 80 | 121 |
| 81 #if defined(ENABLE_PEPPER_CDMS) | 122 #if defined(ENABLE_PEPPER_CDMS) |
| 82 // Returns the Pepper MIME type for |concrete_key_system|. | 123 // Returns the Pepper MIME type for |concrete_key_system|. |
| 83 // Returns empty string if |concrete_key_system| is unknown or not Pepper-based. | 124 // Returns empty string if |concrete_key_system| is unknown or not Pepper-based. |
| 84 MEDIA_EXPORT std::string GetPepperType( | 125 MEDIA_EXPORT std::string GetPepperType( |
| 85 const std::string& concrete_key_system); | 126 const std::string& concrete_key_system); |
| 86 #endif | 127 #endif |
| 87 | 128 |
| 88 // Returns the configuration rule for supporting a robustness requirement. | |
| 89 // TODO(sandersd): Also take a list of codecs, as they may affect the result. | |
| 90 MEDIA_EXPORT EmeConfigRule GetRobustnessConfigRule( | |
| 91 const std::string& key_system, | |
| 92 EmeMediaType media_type, | |
| 93 EmeRobustness robustness); | |
| 94 | |
| 95 // Returns the configuration rule for supporting persistent-license sessions. | |
| 96 MEDIA_EXPORT EmeConfigRule GetPersistentLicenseSessionConfigRule( | |
| 97 const std::string& key_system); | |
| 98 | |
| 99 // Returns the configuration rule for supporting persistent-release-message | |
| 100 // sessions. | |
| 101 MEDIA_EXPORT EmeConfigRule GetPersistentReleaseMessageSessionConfigRule( | |
| 102 const std::string& key_system); | |
| 103 | |
| 104 // Returns the configuration rule for supporting a persistent state requirement. | |
| 105 MEDIA_EXPORT EmeConfigRule GetPersistentStateConfigRule( | |
| 106 const std::string& key_system, | |
| 107 EmeFeatureRequirement requirement); | |
| 108 | |
| 109 // Returns the configuration rule for supporting a distinctive identifier | |
| 110 // requirement. | |
| 111 MEDIA_EXPORT EmeConfigRule GetDistinctiveIdentifierConfigRule( | |
| 112 const std::string& key_system, | |
| 113 EmeFeatureRequirement requirement); | |
| 114 | |
| 115 #if defined(UNIT_TEST) | 129 #if defined(UNIT_TEST) |
| 116 // Helper functions to add container/codec types for testing purposes. | 130 // Helper functions to add container/codec types for testing purposes. |
| 117 MEDIA_EXPORT void AddContainerMask(const std::string& container, uint32 mask); | 131 MEDIA_EXPORT void AddContainerMask(const std::string& container, uint32 mask); |
| 118 MEDIA_EXPORT void AddCodecMask(const std::string& codec, uint32 mask); | 132 MEDIA_EXPORT void AddCodecMask(const std::string& codec, uint32 mask); |
| 119 #endif // defined(UNIT_TEST) | 133 #endif // defined(UNIT_TEST) |
| 120 | 134 |
| 121 } // namespace media | 135 } // namespace media |
| 122 | 136 |
| 123 #endif // MEDIA_BASE_KEY_SYSTEMS_H_ | 137 #endif // MEDIA_BASE_KEY_SYSTEMS_H_ |
| OLD | NEW |