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 #include "content/renderer/media/crypto/key_systems.h" | 5 #include "content/renderer/media/crypto/key_systems.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "content/public/common/content_client.h" | 12 #include "content/public/common/content_client.h" |
13 #include "content/public/renderer/content_renderer_client.h" | 13 #include "content/public/renderer/content_renderer_client.h" |
14 #include "content/public/renderer/key_system_info.h" | 14 #include "content/public/renderer/key_system_info.h" |
15 #include "content/renderer/media/crypto/key_systems_info.h" | 15 #include "content/renderer/media/crypto/key_systems_info.h" |
16 #include "net/base/mime_util.h" | 16 #include "net/base/mime_util.h" |
17 #include "third_party/WebKit/public/platform/WebCString.h" | 17 #include "third_party/WebKit/public/platform/WebCString.h" |
18 #include "third_party/WebKit/public/platform/WebString.h" | 18 #include "third_party/WebKit/public/platform/WebString.h" |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 // Convert a WebString to ASCII, falling back on an empty string in the case | 22 // Convert a WebString to ASCII, falling back on an empty string in the case |
23 // of a non-ASCII string. | 23 // of a non-ASCII string. |
24 static std::string ToASCIIOrEmpty(const WebKit::WebString& string) { | 24 static std::string ToASCIIOrEmpty(const WebKit::WebString& string) { |
25 return IsStringASCII(string) ? UTF16ToASCII(string) : std::string(); | 25 return IsStringASCII(string) ? UTF16ToASCII(string) : std::string(); |
26 } | 26 } |
27 | 27 |
28 static const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey"; | 28 const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey"; |
29 | 29 |
30 static const char kAudioWebM[] = "audio/webm"; | 30 const char kAudioWebM[] = "audio/webm"; |
31 static const char kVideoWebM[] = "video/webm"; | 31 const char kVideoWebM[] = "video/webm"; |
32 static const char kVorbis[] = "vorbis"; | 32 const char kVorbis[] = "vorbis"; |
33 static const char kVorbisVP8[] = "vorbis,vp8,vp8.0"; | 33 const char kVorbisVP8[] = "vorbis,vp8,vp8.0"; |
34 | 34 |
35 static const char kAudioMp4[] = "audio/mp4"; | 35 #if defined(USE_PROPRIETARY_CODECS) |
36 static const char kVideoMp4[] = "video/mp4"; | 36 const char kAudioMp4[] = "audio/mp4"; |
37 static const char kMp4a[] = "mp4a"; | 37 const char kVideoMp4[] = "video/mp4"; |
38 static const char kAvc1[] = "avc1"; | 38 const char kMp4a[] = "mp4a"; |
39 static const char kMp4aAvc1[] = "mp4a,avc1"; | 39 const char kMp4aAvc1[] = "mp4a,avc1"; |
| 40 #endif // defined(USE_PROPRIETARY_CODECS) |
40 | 41 |
41 static void AddClearKey(std::vector<KeySystemInfo>* concrete_key_systems) { | 42 static void AddClearKey(std::vector<KeySystemInfo>* concrete_key_systems) { |
42 KeySystemInfo info(kClearKeyKeySystem); | 43 KeySystemInfo info(kClearKeyKeySystem); |
43 | 44 |
44 info.supported_types.push_back(std::make_pair(kAudioWebM, kVorbis)); | 45 info.supported_types.push_back(std::make_pair(kAudioWebM, kVorbis)); |
45 info.supported_types.push_back(std::make_pair(kVideoWebM, kVorbisVP8)); | 46 info.supported_types.push_back(std::make_pair(kVideoWebM, kVorbisVP8)); |
46 #if defined(USE_PROPRIETARY_CODECS) | 47 #if defined(USE_PROPRIETARY_CODECS) |
47 info.supported_types.push_back(std::make_pair(kAudioMp4, kMp4a)); | 48 info.supported_types.push_back(std::make_pair(kAudioMp4, kMp4a)); |
48 info.supported_types.push_back(std::make_pair(kVideoMp4, kMp4aAvc1)); | 49 info.supported_types.push_back(std::make_pair(kVideoMp4, kMp4aAvc1)); |
49 #endif // defined(USE_PROPRIETARY_CODECS) | 50 #endif // defined(USE_PROPRIETARY_CODECS) |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 std::string GetPepperType(const std::string& concrete_key_system) { | 347 std::string GetPepperType(const std::string& concrete_key_system) { |
347 return KeySystems::GetInstance().GetPepperType(concrete_key_system); | 348 return KeySystems::GetInstance().GetPepperType(concrete_key_system); |
348 } | 349 } |
349 #elif defined(OS_ANDROID) | 350 #elif defined(OS_ANDROID) |
350 std::vector<uint8> GetUUID(const std::string& concrete_key_system) { | 351 std::vector<uint8> GetUUID(const std::string& concrete_key_system) { |
351 return KeySystems::GetInstance().GetUUID(concrete_key_system); | 352 return KeySystems::GetInstance().GetUUID(concrete_key_system); |
352 } | 353 } |
353 #endif | 354 #endif |
354 | 355 |
355 } // namespace content | 356 } // namespace content |
OLD | NEW |