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_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_H_ |
6 #define CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_H_ | 6 #define CONTENT_RENDERER_MEDIA_CRYPTO_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 "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 // Prefixed EME API only supports prefixed (webkit-) key system name for | 16 // Prefixed EME API only supports prefixed (webkit-) key system name for |
17 // certain key systems. But internally only unprefixed key systems are | 17 // certain key systems. But internally only unprefixed key systems are |
18 // supported. The following two functions help convert between prefixed and | 18 // supported. The following two functions help convert between prefixed and |
19 // unprefixed key system names. | 19 // unprefixed key system names. |
20 | 20 |
21 // Gets the unprefixed key system name for |key_system|. | 21 // Gets the unprefixed key system name for |key_system|. |
22 std::string GetUnprefixedKeySystemName(const std::string& key_system); | 22 std::string GetUnprefixedKeySystemName(const std::string& key_system); |
23 | 23 |
24 // Gets the prefixed key system name for |key_system|. | 24 // Gets the prefixed key system name for |key_system|. |
25 std::string GetPrefixedKeySystemName(const std::string& key_system); | 25 std::string GetPrefixedKeySystemName(const std::string& key_system); |
26 | 26 |
| 27 // Returns false if a container-specific |init_data_type| is specified with an |
| 28 // inappropriate container. |
| 29 // TODO(sandersd): Remove this essentially internal detail if the spec is |
| 30 // updated to not convolve the two in a single method call. |
| 31 // TODO(sandersd): Use enum values instead of strings. http://crbug.com/417440 |
| 32 bool IsSaneInitDataTypeWithContainer( |
| 33 const std::string& init_data_type, |
| 34 const std::string& container); |
| 35 |
| 36 // Note: Shouldn't be used for prefixed API as the original |
| 37 // IsSupportedKeySystemWithMediaMimeType() path reports UMAs, but this path does |
| 38 // not. |
| 39 bool IsSupportedKeySystem(const std::string& key_system); |
| 40 |
| 41 bool IsSupportedKeySystemWithInitDataType( |
| 42 const std::string& key_system, |
| 43 const std::string& init_data_type); |
| 44 |
27 // Returns whether |key_system| is a real supported key system that can be | 45 // Returns whether |key_system| is a real supported key system that can be |
28 // instantiated. | 46 // instantiated. |
29 // Abstract parent |key_system| strings will return false. | 47 // Abstract parent |key_system| strings will return false. |
30 // Call IsSupportedKeySystemWithMediaMimeType() to determine whether a | 48 // Call IsSupportedKeySystemWithMediaMimeType() to determine whether a |
31 // |key_system| supports a specific type of media or to check parent key | 49 // |key_system| supports a specific type of media or to check parent key |
32 // systems. | 50 // systems. |
33 CONTENT_EXPORT bool IsConcreteSupportedKeySystem(const std::string& key_system); | 51 CONTENT_EXPORT bool IsConcreteSupportedKeySystem(const std::string& key_system); |
34 | 52 |
35 // Returns whether |key_sytem| supports the specified media type and codec(s). | 53 // Returns whether |key_sytem| supports the specified media type and codec(s). |
36 CONTENT_EXPORT bool IsSupportedKeySystemWithMediaMimeType( | 54 CONTENT_EXPORT bool IsSupportedKeySystemWithMediaMimeType( |
(...skipping 16 matching lines...) Expand all Loading... |
53 | 71 |
54 #if defined(UNIT_TEST) | 72 #if defined(UNIT_TEST) |
55 // Helper functions to add container/codec types for testing purposes. | 73 // Helper functions to add container/codec types for testing purposes. |
56 CONTENT_EXPORT void AddContainerMask(const std::string& container, uint32 mask); | 74 CONTENT_EXPORT void AddContainerMask(const std::string& container, uint32 mask); |
57 CONTENT_EXPORT void AddCodecMask(const std::string& codec, uint32 mask); | 75 CONTENT_EXPORT void AddCodecMask(const std::string& codec, uint32 mask); |
58 #endif // defined(UNIT_TEST) | 76 #endif // defined(UNIT_TEST) |
59 | 77 |
60 } // namespace content | 78 } // namespace content |
61 | 79 |
62 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_H_ | 80 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_KEY_SYSTEMS_H_ |
OLD | NEW |