Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(700)

Unified Diff: chromecast/media/base/key_systems_common.cc

Issue 568243002: Adds initial key systems support for Chromecast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromecast/media/base/key_systems_common.cc
diff --git a/chromecast/media/base/key_systems_common.cc b/chromecast/media/base/key_systems_common.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d7a24db4605e3b62445e61187abf225282343d69
--- /dev/null
+++ b/chromecast/media/base/key_systems_common.cc
@@ -0,0 +1,44 @@
+// 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/media/base/key_systems_common.h"
+
+#include <cstddef>
+
+#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
+
+namespace media {
lcwu1 2014/09/15 18:09:50 s/media/chromecast
gunsch 2014/09/15 21:43:37 Done.
+
+const char kClearKeySystem[] = "org.w3.clearkey";
ddorwin 2014/09/13 03:27:06 Ideally, these names would only be in one place.
gunsch 2014/09/15 21:43:38 This is the only location they're in for chromecas
+const char kUnsupportedClearKeySystem[] = "unsupported-org.w3.clearkey";
ddorwin 2014/09/13 03:27:06 You don't need this. The intent of this is to caus
gunsch 2014/09/15 21:43:38 I think we currently expect those to be mixed (see
+
+const char* kPlayreadyKeySystems[] = {
+ "com.chromecast.playready",
+ NULL
+};
+
+CastKeySystem GetKeySystemByName(const std::string& key_system_name) {
+#if defined(WIDEVINE_CDM_AVAILABLE)
+ if (key_system_name.compare(kWidevineKeySystem) == 0) {
+ return KEY_SYSTEM_WIDEVINE;
+ }
+#endif // defined(WIDEVINE_CDM_AVAILABLE)
+
+#if defined(PLAYREADY_CDM_AVAILABLE)
+ for (size_t i = 0; kPlayreadyKeySystems[i] != NULL; i++) {
+ if (key_system_name.compare(kPlayreadyKeySystems[i]) == 0) {
ddorwin 2014/09/13 03:27:06 Use arraysize() instead of NULL marker
gunsch 2014/09/15 21:43:38 This list is exposed to other files (notably key_s
ddorwin 2014/09/15 22:50:53 You should be able to expose a size constant that
gunsch 2014/09/16 16:57:59 Done.
+ return KEY_SYSTEM_PLAYREADY;
+ }
+ }
+#endif // defined(PLAYREADY_CDM_AVAILABLE)
+
+ if (key_system_name.compare(kClearKeySystem) == 0 ||
+ key_system_name.compare(kUnsupportedClearKeySystem) == 0) {
+ return KEY_SYSTEM_CLEAR_KEY;
+ }
+
+ return KEY_SYSTEM_NONE;
+}
+
+} // namespace media

Powered by Google App Engine
This is Rietveld 408576698