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 CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_INFO_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_INFO_H_ |
6 #define CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_INFO_H_ | 6 #define CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_INFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 | 11 |
12 namespace WebKit { | 12 namespace WebKit { |
13 class WebString; | 13 class WebString; |
14 } | 14 } |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 struct MediaFormatAndKeySystem { | 18 // TODO(ddorwin): Move registration to ContentClient. |
19 const char* mime_type; | 19 void RegisterKeySystems(); |
20 const char* codecs_list; | |
21 const char* key_system; | |
22 }; | |
23 | |
24 #if defined(ENABLE_PEPPER_CDMS) | |
25 struct KeySystemPepperTypePair { | |
26 const char* key_system; | |
27 const char* type; | |
28 }; | |
29 #endif // defined(ENABLE_PEPPER_CDMS) | |
30 | |
31 #if defined(OS_ANDROID) | |
32 struct KeySystemUUIDPair { | |
33 const char* key_system; | |
34 const uint8 uuid[16]; | |
35 }; | |
36 #endif // defined(OS_ANDROID) | |
37 | |
38 // Specifies the container and codec combinations supported by individual | |
39 // key systems. Each line is a container-codecs combination and the key system | |
40 // that supports it. Multiple codecs can be listed. In all cases, the container | |
41 // without a codec is also supported. | |
42 // This list is converted at runtime into individual container-codec-key system | |
43 // entries in KeySystems::key_system_map_. | |
44 extern const MediaFormatAndKeySystem kSupportedFormatKeySystemCombinations[]; | |
45 extern const int kNumSupportedFormatKeySystemCombinations; | |
46 | |
47 #if defined(ENABLE_PEPPER_CDMS) | |
48 // There should be one entry for each key system. | |
49 extern const KeySystemPepperTypePair kKeySystemToPepperTypeMapping[]; | |
50 extern const int kNumKeySystemToPepperTypeMapping; | |
51 #endif // defined(ENABLE_PEPPER_CDMS) | |
52 | |
53 #if defined(OS_ANDROID) | |
54 // Mapping from key system to UUID, one entry per key system. | |
55 extern const KeySystemUUIDPair kKeySystemToUUIDMapping[]; | |
56 extern const int kNumKeySystemToUUIDMapping; | |
57 #endif // defined(OS_ANDROID) | |
58 | |
59 // Returns a concrete key system supported by the platform that most closely | |
60 // corresponds to |key_system|. The result can be passed to other functions that | |
61 // require a concrete key system. | |
62 // Returns null if a conversion cannot be made or |key_system| is unrecognized. | |
63 // The primary use case is to convert a parent key system to a concrete key | |
64 // system to check properties. | |
65 // If we ever have multiple children for a single parent, we may need a more | |
66 // complex solution that checks all concrete children until it gets true. | |
67 std::string EnsureConcreteKeySystem(const std::string& key_system); | |
68 | |
69 // Returns whether |key_system| is a concrete key system. | |
70 // This is used for DCHECKs. Production code should use | |
71 // EnsureConcreteKeySystem(). | |
72 inline bool IsConcreteKeySystem(const std::string& key_system) { | |
73 return !key_system.empty() && | |
74 key_system == EnsureConcreteKeySystem(key_system); | |
75 } | |
76 | |
77 // Returns true if there is a known incompatibility with the operating system. | |
78 bool IsOSIncompatible(const std::string& actual_key_system); | |
79 | 20 |
80 // Returns true if canPlayType should return an empty string for |key_system|. | 21 // Returns true if canPlayType should return an empty string for |key_system|. |
81 bool IsCanPlayTypeSuppressed(const std::string& key_system); | 22 bool IsCanPlayTypeSuppressed(const std::string& key_system); |
82 | 23 |
83 // Returns the name that UMA will use for the given |key_system|. | 24 // Returns the name that UMA will use for the given |key_system|. |
84 // This function can be called frequently. Hence this function should be | 25 // This function can be called frequently. Hence this function should be |
85 // implemented not to impact performance. | 26 // implemented not to impact performance and does not rely on the main |
| 27 // key system map. |
86 std::string KeySystemNameForUMAInternal(const WebKit::WebString& key_system); | 28 std::string KeySystemNameForUMAInternal(const WebKit::WebString& key_system); |
87 | 29 |
88 // Returns whether built-in AesDecryptor can be used for the given |key_system|. | |
89 bool CanUseAesDecryptorInternal(const std::string& key_system); | |
90 | |
91 } // namespace content | 30 } // namespace content |
92 | 31 |
93 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_INFO_H_ | 32 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_INFO_H_ |
OLD | NEW |