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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "media/base/eme_constants.h" | 14 #include "media/base/eme_constants.h" |
15 #include "media/base/media_export.h" | 15 #include "media/base/media_export.h" |
16 | 16 |
17 namespace media { | 17 namespace media { |
18 | 18 |
19 // Provides an interface for querying registered key systems. The exposed API is | 19 // Provides an interface for querying registered key systems. |
20 // only intended to support unprefixed EME. | |
21 // | 20 // |
22 // Many of the original static methods are still available, they should be | 21 // Many of the original static methods are still available, they should be |
23 // migrated into this interface over time (or removed). | 22 // migrated into this interface over time (or removed). |
24 // | 23 // |
25 // TODO(sandersd): Provide GetKeySystem() so that it is not necessary to pass | 24 // TODO(sandersd): Provide GetKeySystem() so that it is not necessary to pass |
26 // |key_system| to every method. http://crbug.com/457438 | 25 // |key_system| to every method. http://crbug.com/457438 |
27 class MEDIA_EXPORT KeySystems { | 26 class MEDIA_EXPORT KeySystems { |
28 public: | 27 public: |
29 static KeySystems* GetInstance(); | 28 static KeySystems* GetInstance(); |
30 | 29 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 const std::string& key_system) const = 0; | 63 const std::string& key_system) const = 0; |
65 | 64 |
66 // Returns the support |key_system| provides for distinctive identifiers. | 65 // Returns the support |key_system| provides for distinctive identifiers. |
67 virtual EmeFeatureSupport GetDistinctiveIdentifierSupport( | 66 virtual EmeFeatureSupport GetDistinctiveIdentifierSupport( |
68 const std::string& key_system) const = 0; | 67 const std::string& key_system) const = 0; |
69 | 68 |
70 protected: | 69 protected: |
71 virtual ~KeySystems() {}; | 70 virtual ~KeySystems() {}; |
72 }; | 71 }; |
73 | 72 |
74 // Prefixed EME API only supports prefixed (webkit-) key system name for | 73 // TODO(ddorwin): WebContentDecryptionModuleSessionImpl::initializeNewSession() |
75 // certain key systems. But internally only unprefixed key systems are | 74 // is violating this rule! https://crbug.com/249976. |
76 // supported. The following two functions help convert between prefixed and | |
77 // unprefixed key system names. | |
78 | |
79 // Gets the unprefixed key system name for |key_system|. | |
80 MEDIA_EXPORT std::string GetUnprefixedKeySystemName( | |
81 const std::string& key_system); | |
82 | |
83 // Gets the prefixed key system name for |key_system|. | |
84 MEDIA_EXPORT std::string GetPrefixedKeySystemName( | |
85 const std::string& key_system); | |
86 | |
87 // Use for prefixed EME only! | 75 // Use for prefixed EME only! |
88 MEDIA_EXPORT bool IsSupportedKeySystemWithInitDataType( | 76 MEDIA_EXPORT bool IsSupportedKeySystemWithInitDataType( |
89 const std::string& key_system, | 77 const std::string& key_system, |
90 EmeInitDataType init_data_type); | 78 EmeInitDataType init_data_type); |
91 | 79 |
92 // Use for prefixed EME only! | |
93 // Returns whether |key_system| is a real supported key system that can be | |
94 // instantiated. | |
95 // Abstract parent |key_system| strings will return false. | |
96 MEDIA_EXPORT bool PrefixedIsSupportedConcreteKeySystem( | |
97 const std::string& key_system); | |
98 | |
99 // Use for prefixed EME only! | |
100 // Returns whether |key_system| supports the specified media type and codec(s). | |
101 // To be used with prefixed EME only as it generates UMAs based on the query. | |
102 MEDIA_EXPORT bool PrefixedIsSupportedKeySystemWithMediaMimeType( | |
103 const std::string& mime_type, | |
104 const std::vector<std::string>& codecs, | |
105 const std::string& key_system); | |
106 | |
107 // Returns a name for |key_system| suitable to UMA logging. | 80 // Returns a name for |key_system| suitable to UMA logging. |
108 MEDIA_EXPORT std::string GetKeySystemNameForUMA(const std::string& key_system); | 81 MEDIA_EXPORT std::string GetKeySystemNameForUMA(const std::string& key_system); |
109 | 82 |
110 // Returns whether AesDecryptor can be used for the given |concrete_key_system|. | 83 // Returns whether AesDecryptor can be used for the given |concrete_key_system|. |
111 MEDIA_EXPORT bool CanUseAesDecryptor(const std::string& concrete_key_system); | 84 MEDIA_EXPORT bool CanUseAesDecryptor(const std::string& concrete_key_system); |
112 | 85 |
113 #if defined(ENABLE_PEPPER_CDMS) | 86 #if defined(ENABLE_PEPPER_CDMS) |
114 // Returns the Pepper MIME type for |concrete_key_system|. | 87 // Returns the Pepper MIME type for |concrete_key_system|. |
115 // Returns empty string if |concrete_key_system| is unknown or not Pepper-based. | 88 // Returns empty string if |concrete_key_system| is unknown or not Pepper-based. |
116 MEDIA_EXPORT std::string GetPepperType( | 89 MEDIA_EXPORT std::string GetPepperType( |
117 const std::string& concrete_key_system); | 90 const std::string& concrete_key_system); |
118 #endif | 91 #endif |
119 | 92 |
120 #if defined(UNIT_TEST) | 93 #if defined(UNIT_TEST) |
121 // Helper functions to add container/codec types for testing purposes. | 94 // Helper functions to add container/codec types for testing purposes. |
122 MEDIA_EXPORT void AddContainerMask(const std::string& container, uint32_t mask); | 95 MEDIA_EXPORT void AddContainerMask(const std::string& container, uint32_t mask); |
123 MEDIA_EXPORT void AddCodecMask(EmeMediaType media_type, | 96 MEDIA_EXPORT void AddCodecMask(EmeMediaType media_type, |
124 const std::string& codec, | 97 const std::string& codec, |
125 uint32_t mask); | 98 uint32_t mask); |
126 #endif // defined(UNIT_TEST) | 99 #endif // defined(UNIT_TEST) |
127 | 100 |
128 } // namespace media | 101 } // namespace media |
129 | 102 |
130 #endif // MEDIA_BASE_KEY_SYSTEMS_H_ | 103 #endif // MEDIA_BASE_KEY_SYSTEMS_H_ |
OLD | NEW |