Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "android_webview/renderer/aw_key_systems.h" | |
| 6 | |
| 7 #include <string> | |
| 8 | |
| 9 #include "base/command_line.h" | |
| 10 #include "base/logging.h" | |
| 11 #include "base/strings/string_split.h" | |
| 12 #include "media/base/media_switches.h" | |
| 13 | |
| 14 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | |
| 15 | |
| 16 using content::KeySystemInfo; | |
| 17 | |
| 18 const char kAudioWebM[] = "audio/webm"; | |
| 19 const char kVideoWebM[] = "video/webm"; | |
| 20 const char kVorbis[] = "vorbis"; | |
| 21 const char kVorbisVP8[] = "vorbis,vp8,vp8.0"; | |
| 22 | |
| 23 const char kAudioMp4[] = "audio/mp4"; | |
| 24 const char kVideoMp4[] = "video/mp4"; | |
| 25 const char kMp4a[] = "mp4a"; | |
| 26 const char kMp4aAvc1Avc3[] = "mp4a,avc1,avc3"; | |
| 27 | |
| 28 static const uint8 kWidevineUuid[16] = { | |
|
joth
2013/11/22 06:59:49
there's 3 copies of this uuid already in the code,
ycheo (away)
2013/11/22 11:49:35
I'll handle this in another CL.
Filed the bug: htt
| |
| 29 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE, | |
| 30 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED }; | |
| 31 | |
| 32 // Return |name|'s parent key system. | |
| 33 static std::string GetDirectParentName(std::string name) { | |
|
joth
2013/11/22 06:59:49
pass as const&
(although I think you could get aw
ycheo (away)
2013/11/22 11:49:35
Done.
| |
| 34 int last_period = name.find_last_of('.'); | |
| 35 DCHECK_GT(last_period, 0); | |
| 36 return name.substr(0, last_period); | |
| 37 } | |
| 38 | |
| 39 static void AddWidevineWithCodecs( | |
| 40 const std::string& key_system_name, | |
| 41 std::vector<KeySystemInfo>* concrete_key_systems) { | |
| 42 KeySystemInfo info(key_system_name); | |
| 43 | |
| 44 info.supported_types.push_back(std::make_pair(kAudioWebM, kVorbis)); | |
| 45 info.supported_types.push_back(std::make_pair(kVideoWebM, kVorbisVP8)); | |
| 46 | |
| 47 info.supported_types.push_back(std::make_pair(kAudioMp4, kMp4a)); | |
| 48 info.supported_types.push_back(std::make_pair(kVideoMp4, kMp4aAvc1Avc3)); | |
| 49 | |
| 50 info.uuid.assign(kWidevineUuid, kWidevineUuid + arraysize(kWidevineUuid)); | |
| 51 | |
| 52 concrete_key_systems->push_back(info); | |
| 53 } | |
| 54 | |
| 55 void AwAddKeySystems( | |
| 56 std::vector<KeySystemInfo>* key_systems_info) { | |
| 57 // For standard Widevine, add parent name. | |
| 58 std::string standard_widevine = GetDirectParentName(kWidevineKeySystem); | |
| 59 AddWidevineWithCodecs(standard_widevine, key_systems_info); | |
| 60 | |
| 61 if (CommandLine::ForCurrentProcess() | |
| 62 ->HasSwitch(switches::kMediaDrmEnableNonCompositing)) { | |
| 63 std::string widevine_hr_non_compositing = kWidevineKeySystem; | |
| 64 widevine_hr_non_compositing.append(".hrnoncompositing"); | |
| 65 AddWidevineWithCodecs(widevine_hr_non_compositing, key_systems_info); | |
| 66 } | |
| 67 } | |
| OLD | NEW |