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 // Provides an interface for querying registered key systems. The exposed API is | |
18 // only intended to support the unprefixed API. | |
ddorwin
2015/03/23 17:22:14
... support unprefixed EME.
sandersd (OOO until July 31)
2015/03/23 22:27:59
Done.
| |
19 // | |
20 // Many of the original static methods are still available, they should be | |
21 // migrated into this interface over time (or removed). | |
22 // | |
23 // TODO(sandersd): Provide GetKeySystem() so that it is not necessary to pass | |
24 // |key_system| to every method. http://crbug.com/457438 | |
25 class MEDIA_EXPORT KeySystems { | |
26 public: | |
27 static KeySystems& GetInstance(); | |
28 | |
29 // Returns whether |key_system| is a supported key system. | |
30 virtual bool IsSupportedKeySystem(const std::string& key_system) const = 0; | |
31 | |
32 // Returns whether the list of codecs are supported together by |key_system|. | |
33 // TODO(sandersd): Return a rule instead of a bool so that codec selection can | |
34 // affect other configuration options (namely robustness). | |
35 virtual bool IsSupportedCodecCombination( | |
36 const std::string& key_system, | |
37 EmeMediaType media_type, | |
38 const std::string& container_mime_type, | |
39 const std::vector<std::string>& codecs) const = 0; | |
40 | |
41 // Returns the configuration rule for supporting a robustness requirement. | |
42 virtual EmeConfigRule GetRobustnessConfigRule( | |
43 const std::string& key_system, | |
44 EmeMediaType media_type, | |
45 EmeRobustness robustness) const = 0; | |
46 | |
47 // Returns the configuration rule for supporting persistent-license sessions. | |
48 virtual EmeConfigRule GetPersistentLicenseSessionConfigRule( | |
49 const std::string& key_system) const = 0; | |
50 | |
51 // Returns the configuration rule for supporting persistent-release-message | |
52 // sessions. | |
53 virtual EmeConfigRule GetPersistentReleaseMessageSessionConfigRule( | |
54 const std::string& key_system) const = 0; | |
55 | |
56 // Returns the configuration rule for supporting a persistent state | |
57 // requirement. | |
58 virtual EmeConfigRule GetPersistentStateConfigRule( | |
59 const std::string& key_system, | |
60 EmeFeatureRequirement requirement) const = 0; | |
61 | |
62 // Returns the configuration rule for supporting a distinctive identifier | |
63 // requirement. | |
64 virtual EmeConfigRule GetDistinctiveIdentifierConfigRule( | |
65 const std::string& key_system, | |
66 EmeFeatureRequirement requirement) const = 0; | |
67 }; | |
68 | |
17 // Prefixed EME API only supports prefixed (webkit-) key system name for | 69 // Prefixed EME API only supports prefixed (webkit-) key system name for |
18 // certain key systems. But internally only unprefixed key systems are | 70 // certain key systems. But internally only unprefixed key systems are |
19 // supported. The following two functions help convert between prefixed and | 71 // supported. The following two functions help convert between prefixed and |
20 // unprefixed key system names. | 72 // unprefixed key system names. |
21 | 73 |
22 // Gets the unprefixed key system name for |key_system|. | 74 // Gets the unprefixed key system name for |key_system|. |
23 MEDIA_EXPORT std::string GetUnprefixedKeySystemName( | 75 MEDIA_EXPORT std::string GetUnprefixedKeySystemName( |
24 const std::string& key_system); | 76 const std::string& key_system); |
25 | 77 |
26 // Gets the prefixed key system name for |key_system|. | 78 // Gets the prefixed key system name for |key_system|. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 // Returns whether AesDecryptor can be used for the given |concrete_key_system|. | 130 // Returns whether AesDecryptor can be used for the given |concrete_key_system|. |
79 MEDIA_EXPORT bool CanUseAesDecryptor(const std::string& concrete_key_system); | 131 MEDIA_EXPORT bool CanUseAesDecryptor(const std::string& concrete_key_system); |
80 | 132 |
81 #if defined(ENABLE_PEPPER_CDMS) | 133 #if defined(ENABLE_PEPPER_CDMS) |
82 // Returns the Pepper MIME type for |concrete_key_system|. | 134 // Returns the Pepper MIME type for |concrete_key_system|. |
83 // Returns empty string if |concrete_key_system| is unknown or not Pepper-based. | 135 // Returns empty string if |concrete_key_system| is unknown or not Pepper-based. |
84 MEDIA_EXPORT std::string GetPepperType( | 136 MEDIA_EXPORT std::string GetPepperType( |
85 const std::string& concrete_key_system); | 137 const std::string& concrete_key_system); |
86 #endif | 138 #endif |
87 | 139 |
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) | 140 #if defined(UNIT_TEST) |
116 // Helper functions to add container/codec types for testing purposes. | 141 // Helper functions to add container/codec types for testing purposes. |
117 MEDIA_EXPORT void AddContainerMask(const std::string& container, uint32 mask); | 142 MEDIA_EXPORT void AddContainerMask(const std::string& container, uint32 mask); |
118 MEDIA_EXPORT void AddCodecMask(const std::string& codec, uint32 mask); | 143 MEDIA_EXPORT void AddCodecMask(const std::string& codec, uint32 mask); |
119 #endif // defined(UNIT_TEST) | 144 #endif // defined(UNIT_TEST) |
120 | 145 |
121 } // namespace media | 146 } // namespace media |
122 | 147 |
123 #endif // MEDIA_BASE_KEY_SYSTEMS_H_ | 148 #endif // MEDIA_BASE_KEY_SYSTEMS_H_ |
OLD | NEW |