Index: android_webview/renderer/aw_key_systems.cc |
diff --git a/android_webview/renderer/aw_key_systems.cc b/android_webview/renderer/aw_key_systems.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7eb7807421a466402d42f81a49d3367838c38fff |
--- /dev/null |
+++ b/android_webview/renderer/aw_key_systems.cc |
@@ -0,0 +1,67 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "android_webview/renderer/aw_key_systems.h" |
+ |
+#include <string> |
+ |
+#include "base/command_line.h" |
+#include "base/logging.h" |
+#include "base/strings/string_split.h" |
+#include "media/base/media_switches.h" |
+ |
+#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
+ |
+using content::KeySystemInfo; |
+ |
+const char kAudioWebM[] = "audio/webm"; |
ddorwin
2013/11/22 21:21:08
We now have these types (and UUID) and maybe some
ycheo (away)
2013/11/23 01:27:19
Thanks for the suggestion.
I'll consider these als
|
+const char kVideoWebM[] = "video/webm"; |
+const char kVorbis[] = "vorbis"; |
+const char kVorbisVP8[] = "vorbis,vp8,vp8.0"; |
+ |
+const char kAudioMp4[] = "audio/mp4"; |
+const char kVideoMp4[] = "video/mp4"; |
+const char kMp4a[] = "mp4a"; |
+const char kMp4aAvc1Avc3[] = "mp4a,avc1,avc3"; |
+ |
+static const uint8 kWidevineUuid[16] = { |
+ 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE, |
+ 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED }; |
+ |
+// Return |name|'s parent key system. |
+static std::string GetDirectParentName(const std::string& name) { |
+ int last_period = name.find_last_of('.'); |
+ DCHECK_GT(last_period, 0); |
+ return name.substr(0, last_period); |
+} |
+ |
+static void AddWidevineWithCodecs( |
+ const std::string& key_system_name, |
+ std::vector<KeySystemInfo>* concrete_key_systems) { |
+ KeySystemInfo info(key_system_name); |
+ |
+ info.supported_types.push_back(std::make_pair(kAudioWebM, kVorbis)); |
qinmin
2013/11/22 18:36:34
chrome on android does not support webM for widevi
ycheo (away)
2013/11/23 01:27:19
Thanks for letting me know this.
BTW, the MediaCod
qinmin
2013/11/23 01:36:14
although MediaCodec supports vorbis and vp8, widev
ddorwin
2013/11/25 19:14:03
Yes, it's the container that is not currently supp
|
+ info.supported_types.push_back(std::make_pair(kVideoWebM, kVorbisVP8)); |
+ |
+ info.supported_types.push_back(std::make_pair(kAudioMp4, kMp4a)); |
+ info.supported_types.push_back(std::make_pair(kVideoMp4, kMp4aAvc1Avc3)); |
+ |
+ info.uuid.assign(kWidevineUuid, kWidevineUuid + arraysize(kWidevineUuid)); |
+ |
+ concrete_key_systems->push_back(info); |
+} |
+ |
+void AwAddKeySystems( |
+ std::vector<KeySystemInfo>* key_systems_info) { |
+ // For standard Widevine, add parent name. |
+ std::string standard_widevine = GetDirectParentName(kWidevineKeySystem); |
ddorwin
2013/11/22 21:21:08
"standard" is confusing. It's really just widevine
ycheo (away)
2013/11/23 01:27:19
Done.
|
+ AddWidevineWithCodecs(standard_widevine, key_systems_info); |
+ |
+ if (CommandLine::ForCurrentProcess() |
+ ->HasSwitch(switches::kMediaDrmEnableNonCompositing)) { |
+ std::string widevine_hr_non_compositing = kWidevineKeySystem; |
+ widevine_hr_non_compositing.append(".hrnoncompositing"); |
+ AddWidevineWithCodecs(widevine_hr_non_compositing, key_systems_info); |
+ } |
+} |