OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chromecast/media/base/key_systems_common.h" | |
6 | |
7 #include <cstddef> | |
8 | |
9 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | |
10 | |
11 namespace media { | |
lcwu1
2014/09/15 18:09:50
s/media/chromecast
gunsch
2014/09/15 21:43:37
Done.
| |
12 | |
13 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
| |
14 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
| |
15 | |
16 const char* kPlayreadyKeySystems[] = { | |
17 "com.chromecast.playready", | |
18 NULL | |
19 }; | |
20 | |
21 CastKeySystem GetKeySystemByName(const std::string& key_system_name) { | |
22 #if defined(WIDEVINE_CDM_AVAILABLE) | |
23 if (key_system_name.compare(kWidevineKeySystem) == 0) { | |
24 return KEY_SYSTEM_WIDEVINE; | |
25 } | |
26 #endif // defined(WIDEVINE_CDM_AVAILABLE) | |
27 | |
28 #if defined(PLAYREADY_CDM_AVAILABLE) | |
29 for (size_t i = 0; kPlayreadyKeySystems[i] != NULL; i++) { | |
30 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.
| |
31 return KEY_SYSTEM_PLAYREADY; | |
32 } | |
33 } | |
34 #endif // defined(PLAYREADY_CDM_AVAILABLE) | |
35 | |
36 if (key_system_name.compare(kClearKeySystem) == 0 || | |
37 key_system_name.compare(kUnsupportedClearKeySystem) == 0) { | |
38 return KEY_SYSTEM_CLEAR_KEY; | |
39 } | |
40 | |
41 return KEY_SYSTEM_NONE; | |
42 } | |
43 | |
44 } // namespace media | |
OLD | NEW |