OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "android_webview/renderer/aw_key_systems.h" | 5 #include "android_webview/renderer/aw_key_systems.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "media/cdm/encrypted_media_codecs.h" |
11 #include "third_party/widevine/cdm/widevine_cdm_common.h" | 12 #include "third_party/widevine/cdm/widevine_cdm_common.h" |
12 | 13 |
13 using content::KeySystemInfo; | 14 using content::KeySystemInfo; |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 const char kAudioMp4[] = "audio/mp4"; | |
18 const char kVideoMp4[] = "video/mp4"; | |
19 const char kMp4a[] = "mp4a"; | |
20 const char kAvc1[] = "avc1"; | |
21 const char kAvc3[] = "avc3"; | |
22 | |
23 // Return |name|'s parent key system. | 18 // Return |name|'s parent key system. |
24 std::string GetDirectParentName(const std::string& name) { | 19 std::string GetDirectParentName(const std::string& name) { |
25 int last_period = name.find_last_of('.'); | 20 int last_period = name.find_last_of('.'); |
26 DCHECK_GT(last_period, 0); | 21 DCHECK_GT(last_period, 0); |
27 return name.substr(0, last_period); | 22 return name.substr(0, last_period); |
28 } | 23 } |
29 | 24 |
30 void AddWidevineWithCodecs(const std::string& key_system_name, | 25 void AddWidevineWithCodecs(const std::string& key_system_name, |
31 bool add_parent_name, | 26 bool add_parent_name, |
32 std::vector<KeySystemInfo>* concrete_key_systems) { | 27 std::vector<KeySystemInfo>* concrete_key_systems) { |
33 KeySystemInfo info(key_system_name); | 28 KeySystemInfo info(key_system_name); |
34 | 29 |
35 if (add_parent_name) | 30 if (add_parent_name) |
36 info.parent_key_system = GetDirectParentName(key_system_name); | 31 info.parent_key_system = GetDirectParentName(key_system_name); |
37 | 32 |
38 info.supported_types[kAudioMp4].insert(kMp4a); | 33 info.supported_codecs = media::MP4_CODECS; |
39 info.supported_types[kVideoMp4] = info.supported_types[kAudioMp4]; | |
40 info.supported_types[kVideoMp4].insert(kAvc1); | |
41 info.supported_types[kVideoMp4].insert(kAvc3); | |
42 | 34 |
43 concrete_key_systems->push_back(info); | 35 concrete_key_systems->push_back(info); |
44 } | 36 } |
45 | 37 |
46 } // namespace | 38 } // namespace |
47 | 39 |
48 namespace android_webview { | 40 namespace android_webview { |
49 | 41 |
50 void AwAddKeySystems( | 42 void AwAddKeySystems( |
51 std::vector<KeySystemInfo>* key_systems_info) { | 43 std::vector<KeySystemInfo>* key_systems_info) { |
52 AddWidevineWithCodecs(kWidevineKeySystem, true, key_systems_info); | 44 AddWidevineWithCodecs(kWidevineKeySystem, true, key_systems_info); |
53 } | 45 } |
54 | 46 |
55 } // namespace android_webview | 47 } // namespace android_webview |
OLD | NEW |