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/shell/renderer/key_systems_cast.h" | |
6 | |
7 #include <string> | |
8 | |
9 #include "base/command_line.h" | |
10 #include "base/logging.h" | |
11 #include "chromecast/media/base/key_systems_common.h" | |
12 #include "content/public/common/eme_codec.h" | |
13 | |
14 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | |
15 | |
16 using content::KeySystemInfo; | |
17 | |
18 namespace { | |
19 | |
20 // Return |name|'s parent key system. | |
21 std::string GetDirectParentName(const std::string& name) { | |
22 int last_period = name.find_last_of('.'); | |
23 DCHECK_GT(last_period, 0); | |
24 return name.substr(0, last_period); | |
25 } | |
26 | |
27 void AddKeySystemWithCodecs( | |
28 const std::string& key_system_name, | |
29 bool add_parent_name, | |
30 std::vector<KeySystemInfo>* concrete_key_systems) { | |
31 KeySystemInfo info(key_system_name); | |
32 | |
33 if (add_parent_name) | |
34 info.parent_key_system = GetDirectParentName(key_system_name); | |
35 | |
36 info.supported_codecs = content::EME_CODEC_MP4_ALL; | |
37 | |
38 concrete_key_systems->push_back(info); | |
39 } | |
40 | |
41 } // namespace anonymous | |
42 | |
43 namespace content { | |
44 | |
45 void AddChromecastKeySystems(std::vector<KeySystemInfo>* key_systems_info) { | |
46 // 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
| |
47 // "unsupported-org.w3.clearkey". | |
48 // TODO(gunsch): remove this when upstream supports unprefixed clearkey. | |
49 // See: crbug/393397 | |
50 AddKeySystemWithCodecs(media::kUnsupportedClearKeySystem, | |
51 false, | |
52 key_systems_info); | |
53 | |
54 #if defined(WIDEVINE_CDM_AVAILABLE) | |
55 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.
| |
56 #endif | |
57 | |
58 #if defined(PLAYREADY_CDM_AVAILABLE) | |
59 for (size_t i = 0; media::kPlayreadyKeySystems[i] != NULL; i++) { | |
60 AddKeySystemWithCodecs(media::kPlayreadyKeySystems[i], | |
61 false, | |
62 key_systems_info); | |
63 } | |
64 #endif | |
65 } | |
66 | |
67 } // namespace content | |
OLD | NEW |