| 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 "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
| 12 #include "third_party/widevine/cdm/widevine_cdm_common.h" | 12 #include "third_party/widevine/cdm/widevine_cdm_common.h" |
| 13 | 13 |
| 14 using content::KeySystemInfo; | 14 using content::KeySystemInfo; |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 const char kAudioMp4[] = "audio/mp4"; | 18 const char kAudioMp4[] = "audio/mp4"; |
| 19 const char kVideoMp4[] = "video/mp4"; | 19 const char kVideoMp4[] = "video/mp4"; |
| 20 const char kMp4a[] = "mp4a"; | 20 const char kMp4a[] = "mp4a"; |
| 21 const char kMp4aAvc1Avc3[] = "mp4a,avc1,avc3"; | 21 const char kMp4aAvc1Avc3[] = "mp4a,avc1,avc3"; |
| 22 | 22 |
| 23 const uint8 kWidevineUuid[16] = { | |
| 24 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE, | |
| 25 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED }; | |
| 26 | |
| 27 // Return |name|'s parent key system. | 23 // Return |name|'s parent key system. |
| 28 std::string GetDirectParentName(const std::string& name) { | 24 std::string GetDirectParentName(const std::string& name) { |
| 29 int last_period = name.find_last_of('.'); | 25 int last_period = name.find_last_of('.'); |
| 30 DCHECK_GT(last_period, 0); | 26 DCHECK_GT(last_period, 0); |
| 31 return name.substr(0, last_period); | 27 return name.substr(0, last_period); |
| 32 } | 28 } |
| 33 | 29 |
| 34 void AddWidevineWithCodecs( | 30 void AddWidevineWithCodecs(const std::string& key_system_name, |
| 35 const std::string& key_system_name, | 31 bool add_parent_name, |
| 36 bool add_parent_name, | 32 std::vector<KeySystemInfo>* concrete_key_systems) { |
| 37 std::vector<KeySystemInfo>* concrete_key_systems) { | |
| 38 KeySystemInfo info(key_system_name); | 33 KeySystemInfo info(key_system_name); |
| 39 | 34 |
| 40 if (add_parent_name) | 35 if (add_parent_name) |
| 41 info.parent_key_system = GetDirectParentName(key_system_name); | 36 info.parent_key_system = GetDirectParentName(key_system_name); |
| 42 | 37 |
| 43 info.supported_types.push_back(std::make_pair(kAudioMp4, kMp4a)); | 38 info.supported_types.push_back(std::make_pair(kAudioMp4, kMp4a)); |
| 44 info.supported_types.push_back(std::make_pair(kVideoMp4, kMp4aAvc1Avc3)); | 39 info.supported_types.push_back(std::make_pair(kVideoMp4, kMp4aAvc1Avc3)); |
| 45 | 40 |
| 46 info.uuid.assign(kWidevineUuid, kWidevineUuid + arraysize(kWidevineUuid)); | |
| 47 | |
| 48 concrete_key_systems->push_back(info); | 41 concrete_key_systems->push_back(info); |
| 49 } | 42 } |
| 50 | 43 |
| 51 } // namespace | 44 } // namespace |
| 52 | 45 |
| 53 namespace android_webview { | 46 namespace android_webview { |
| 54 | 47 |
| 55 void AwAddKeySystems( | 48 void AwAddKeySystems( |
| 56 std::vector<KeySystemInfo>* key_systems_info) { | 49 std::vector<KeySystemInfo>* key_systems_info) { |
| 57 AddWidevineWithCodecs(kWidevineKeySystem, true, key_systems_info); | 50 AddWidevineWithCodecs(kWidevineKeySystem, true, key_systems_info); |
| 58 } | 51 } |
| 59 | 52 |
| 60 } // namespace android_webview | 53 } // namespace android_webview |
| OLD | NEW |