Index: chromecast/shell/renderer/key_systems_cast.cc |
diff --git a/chromecast/shell/renderer/key_systems_cast.cc b/chromecast/shell/renderer/key_systems_cast.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f55d93768307260e8ead95ce7c16198c61d95225 |
--- /dev/null |
+++ b/chromecast/shell/renderer/key_systems_cast.cc |
@@ -0,0 +1,67 @@ |
+// Copyright 2014 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 "chromecast/shell/renderer/key_systems_cast.h" |
+ |
+#include <string> |
+ |
+#include "base/command_line.h" |
+#include "base/logging.h" |
+#include "chromecast/media/base/key_systems_common.h" |
+#include "content/public/common/eme_codec.h" |
+ |
+#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
+ |
+using content::KeySystemInfo; |
+ |
+namespace { |
+ |
+// Return |name|'s parent key system. |
+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); |
+} |
+ |
+void AddKeySystemWithCodecs( |
+ const std::string& key_system_name, |
+ bool add_parent_name, |
+ std::vector<KeySystemInfo>* concrete_key_systems) { |
+ KeySystemInfo info(key_system_name); |
+ |
+ if (add_parent_name) |
+ info.parent_key_system = GetDirectParentName(key_system_name); |
+ |
+ info.supported_codecs = content::EME_CODEC_MP4_ALL; |
+ |
+ concrete_key_systems->push_back(info); |
+} |
+ |
+} // namespace anonymous |
+ |
+namespace content { |
+ |
+void AddChromecastKeySystems(std::vector<KeySystemInfo>* key_systems_info) { |
+ // Chromecast supports unprefixed clearkey, which upstream rewrites to |
ddorwin
2014/09/13 03:27:07
I don't think this comment is correct. Are you say
gunsch
2014/09/15 21:43:38
Ah, yes: we're expecting to handle "org.w3.clearke
|
+ // "unsupported-org.w3.clearkey". |
+ // TODO(gunsch): remove this when upstream supports unprefixed clearkey. |
+ // See: crbug/393397 |
+ AddKeySystemWithCodecs(media::kUnsupportedClearKeySystem, |
+ false, |
+ key_systems_info); |
+ |
+#if defined(WIDEVINE_CDM_AVAILABLE) |
+ AddKeySystemWithCodecs(kWidevineKeySystem, true, key_systems_info); |
ddorwin
2014/09/13 03:27:07
It may not be useful, but FYI: https://code.google
gunsch
2014/09/15 21:43:38
Thanks! That is useful. Updated.
|
+#endif |
+ |
+#if defined(PLAYREADY_CDM_AVAILABLE) |
+ for (size_t i = 0; media::kPlayreadyKeySystems[i] != NULL; i++) { |
+ AddKeySystemWithCodecs(media::kPlayreadyKeySystems[i], |
+ false, |
+ key_systems_info); |
+ } |
+#endif |
+} |
+ |
+} // namespace content |