Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(741)

Side by Side Diff: android_webview/renderer/aw_key_systems.cc

Issue 82803002: Register WideVine keysystem for WebView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed the reviewers' comments. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « android_webview/renderer/aw_key_systems.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #include "third_party/widevine/cdm/widevine_cdm_common.h"
14
15 using content::KeySystemInfo;
16
17 namespace android_webview {
18
19 static const char kAudioMp4[] = "audio/mp4";
joth 2013/11/23 23:00:14 nit: prefer anonymous namespace rather than static
20 static const char kVideoMp4[] = "video/mp4";
21 static const char kMp4a[] = "mp4a";
22 static const char kMp4aAvc1Avc3[] = "mp4a,avc1,avc3";
23
24 static const uint8 kWidevineUuid[16] = {
25 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE,
26 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED };
27
28 // Return |name|'s parent key system.
29 static std::string GetDirectParentName(const std::string& name) {
30 int last_period = name.find_last_of('.');
31 DCHECK_GT(last_period, 0);
32 return name.substr(0, last_period);
33 }
34
35 static void AddWidevineWithCodecs(
36 const std::string& key_system_name,
37 std::vector<KeySystemInfo>* concrete_key_systems) {
38 KeySystemInfo info(key_system_name);
39
40 info.supported_types.push_back(std::make_pair(kAudioMp4, kMp4a));
41 info.supported_types.push_back(std::make_pair(kVideoMp4, kMp4aAvc1Avc3));
42
43 info.uuid.assign(kWidevineUuid, kWidevineUuid + arraysize(kWidevineUuid));
44
45 concrete_key_systems->push_back(info);
46 }
47
48 void AwAddKeySystems(
49 std::vector<KeySystemInfo>* key_systems_info) {
50 // For standard Widevine, add parent name.
51 std::string widevine_parent = GetDirectParentName(kWidevineKeySystem);
52 AddWidevineWithCodecs(widevine_parent, key_systems_info);
53
54 if (CommandLine::ForCurrentProcess()
55 ->HasSwitch(switches::kMediaDrmEnableNonCompositing)) {
56 std::string widevine_hr_non_compositing = kWidevineKeySystem;
57 widevine_hr_non_compositing.append(".hrnoncompositing");
58 AddWidevineWithCodecs(widevine_hr_non_compositing, key_systems_info);
59 }
60 }
61
62 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/renderer/aw_key_systems.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698