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

Side by Side Diff: chrome/renderer/media/chrome_key_systems.cc

Issue 665343002: Move KeySystemInfo to media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 6 years, 2 months 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
« no previous file with comments | « chrome/renderer/media/chrome_key_systems.h ('k') | chromecast/renderer/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/renderer/media/chrome_key_systems.h" 5 #include "chrome/renderer/media/chrome_key_systems.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "base/strings/string_split.h" 12 #include "base/strings/string_split.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/common/render_messages.h" 14 #include "chrome/common/render_messages.h"
15 #include "components/cdm/renderer/widevine_key_systems.h" 15 #include "components/cdm/renderer/widevine_key_systems.h"
16 #include "content/public/common/eme_constants.h"
17 #include "content/public/renderer/render_thread.h" 16 #include "content/public/renderer/render_thread.h"
17 #include "media/base/eme_constants.h"
18 18
19 #if defined(OS_ANDROID) 19 #if defined(OS_ANDROID)
20 #include "components/cdm/renderer/android_key_systems.h" 20 #include "components/cdm/renderer/android_key_systems.h"
21 #endif 21 #endif
22 22
23 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 23 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
24 24
25 // The following must be after widevine_cdm_version.h. 25 // The following must be after widevine_cdm_version.h.
26 26
27 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) 27 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_MIN_GLIBC_VERSION)
28 #include <gnu/libc-version.h> 28 #include <gnu/libc-version.h>
29 #include "base/version.h" 29 #include "base/version.h"
30 #endif 30 #endif
31 31
32 using content::KeySystemInfo; 32 using media::KeySystemInfo;
33 using content::SupportedCodecs; 33 using media::SupportedCodecs;
34 34
35 #if defined(ENABLE_PEPPER_CDMS) 35 #if defined(ENABLE_PEPPER_CDMS)
36 static bool IsPepperCdmAvailable( 36 static bool IsPepperCdmAvailable(
37 const std::string& pepper_type, 37 const std::string& pepper_type,
38 std::vector<base::string16>* additional_param_names, 38 std::vector<base::string16>* additional_param_names,
39 std::vector<base::string16>* additional_param_values) { 39 std::vector<base::string16>* additional_param_values) {
40 bool is_available = false; 40 bool is_available = false;
41 content::RenderThread::Get()->Send( 41 content::RenderThread::Get()->Send(
42 new ChromeViewHostMsg_IsInternalPluginAvailableForMimeType( 42 new ChromeViewHostMsg_IsInternalPluginAvailableForMimeType(
43 pepper_type, 43 pepper_type,
(...skipping 23 matching lines...) Expand all
67 std::vector<base::string16> additional_param_names; 67 std::vector<base::string16> additional_param_names;
68 std::vector<base::string16> additional_param_values; 68 std::vector<base::string16> additional_param_values;
69 if (!IsPepperCdmAvailable(kExternalClearKeyPepperType, 69 if (!IsPepperCdmAvailable(kExternalClearKeyPepperType,
70 &additional_param_names, 70 &additional_param_names,
71 &additional_param_values)) { 71 &additional_param_values)) {
72 return; 72 return;
73 } 73 }
74 74
75 KeySystemInfo info(kExternalClearKeyKeySystem); 75 KeySystemInfo info(kExternalClearKeyKeySystem);
76 76
77 info.supported_codecs = content::EME_CODEC_WEBM_ALL; 77 info.supported_codecs = media::EME_CODEC_WEBM_ALL;
78 info.supported_init_data_types = content::EME_INIT_DATA_TYPE_WEBM; 78 info.supported_init_data_types = media::EME_INIT_DATA_TYPE_WEBM;
79 #if defined(USE_PROPRIETARY_CODECS) 79 #if defined(USE_PROPRIETARY_CODECS)
80 info.supported_codecs |= content::EME_CODEC_MP4_ALL; 80 info.supported_codecs |= media::EME_CODEC_MP4_ALL;
81 info.supported_init_data_types |= content::EME_INIT_DATA_TYPE_CENC; 81 info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_CENC;
82 #endif // defined(USE_PROPRIETARY_CODECS) 82 #endif // defined(USE_PROPRIETARY_CODECS)
83 83
84 info.pepper_type = kExternalClearKeyPepperType; 84 info.pepper_type = kExternalClearKeyPepperType;
85 85
86 concrete_key_systems->push_back(info); 86 concrete_key_systems->push_back(info);
87 87
88 // Add support of decrypt-only mode in ClearKeyCdm. 88 // Add support of decrypt-only mode in ClearKeyCdm.
89 info.key_system = kExternalClearKeyDecryptOnlyKeySystem; 89 info.key_system = kExternalClearKeyDecryptOnlyKeySystem;
90 concrete_key_systems->push_back(info); 90 concrete_key_systems->push_back(info);
91 91
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 &additional_param_values)) { 149 &additional_param_values)) {
150 DVLOG(1) << "Widevine CDM is not currently available."; 150 DVLOG(1) << "Widevine CDM is not currently available.";
151 return; 151 return;
152 } 152 }
153 153
154 std::vector<std::string> codecs; 154 std::vector<std::string> codecs;
155 GetSupportedCodecsForPepperCdm(additional_param_names, 155 GetSupportedCodecsForPepperCdm(additional_param_names,
156 additional_param_values, 156 additional_param_values,
157 &codecs); 157 &codecs);
158 158
159 SupportedCodecs supported_codecs = content::EME_CODEC_NONE; 159 SupportedCodecs supported_codecs = media::EME_CODEC_NONE;
160 for (size_t i = 0; i < codecs.size(); ++i) { 160 for (size_t i = 0; i < codecs.size(); ++i) {
161 if (codecs[i] == kCdmSupportedCodecVorbis) 161 if (codecs[i] == kCdmSupportedCodecVorbis)
162 supported_codecs |= content::EME_CODEC_WEBM_VORBIS; 162 supported_codecs |= media::EME_CODEC_WEBM_VORBIS;
163 if (codecs[i] == kCdmSupportedCodecVp8) 163 if (codecs[i] == kCdmSupportedCodecVp8)
164 supported_codecs |= content::EME_CODEC_WEBM_VP8; 164 supported_codecs |= media::EME_CODEC_WEBM_VP8;
165 if (codecs[i] == kCdmSupportedCodecVp9) 165 if (codecs[i] == kCdmSupportedCodecVp9)
166 supported_codecs |= content::EME_CODEC_WEBM_VP9; 166 supported_codecs |= media::EME_CODEC_WEBM_VP9;
167 #if defined(USE_PROPRIETARY_CODECS) 167 #if defined(USE_PROPRIETARY_CODECS)
168 if (codecs[i] == kCdmSupportedCodecAac) 168 if (codecs[i] == kCdmSupportedCodecAac)
169 supported_codecs |= content::EME_CODEC_MP4_AAC; 169 supported_codecs |= media::EME_CODEC_MP4_AAC;
170 if (codecs[i] == kCdmSupportedCodecAvc1) 170 if (codecs[i] == kCdmSupportedCodecAvc1)
171 supported_codecs |= content::EME_CODEC_MP4_AVC1; 171 supported_codecs |= media::EME_CODEC_MP4_AVC1;
172 #endif // defined(USE_PROPRIETARY_CODECS) 172 #endif // defined(USE_PROPRIETARY_CODECS)
173 } 173 }
174 174
175 cdm::AddWidevineWithCodecs(cdm::WIDEVINE, 175 cdm::AddWidevineWithCodecs(cdm::WIDEVINE,
176 supported_codecs, 176 supported_codecs,
177 concrete_key_systems); 177 concrete_key_systems);
178 } 178 }
179 #endif // defined(WIDEVINE_CDM_AVAILABLE) 179 #endif // defined(WIDEVINE_CDM_AVAILABLE)
180 #endif // defined(ENABLE_PEPPER_CDMS) 180 #endif // defined(ENABLE_PEPPER_CDMS)
181 181
182 void AddChromeKeySystems(std::vector<KeySystemInfo>* key_systems_info) { 182 void AddChromeKeySystems(std::vector<KeySystemInfo>* key_systems_info) {
183 #if defined(ENABLE_PEPPER_CDMS) 183 #if defined(ENABLE_PEPPER_CDMS)
184 AddExternalClearKey(key_systems_info); 184 AddExternalClearKey(key_systems_info);
185 185
186 #if defined(WIDEVINE_CDM_AVAILABLE) 186 #if defined(WIDEVINE_CDM_AVAILABLE)
187 AddPepperBasedWidevine(key_systems_info); 187 AddPepperBasedWidevine(key_systems_info);
188 #endif // defined(WIDEVINE_CDM_AVAILABLE) 188 #endif // defined(WIDEVINE_CDM_AVAILABLE)
189 #endif // defined(ENABLE_PEPPER_CDMS) 189 #endif // defined(ENABLE_PEPPER_CDMS)
190 190
191 #if defined(OS_ANDROID) 191 #if defined(OS_ANDROID)
192 cdm::AddAndroidWidevine(key_systems_info); 192 cdm::AddAndroidWidevine(key_systems_info);
193 #endif // defined(OS_ANDROID) 193 #endif // defined(OS_ANDROID)
194 } 194 }
OLDNEW
« no previous file with comments | « chrome/renderer/media/chrome_key_systems.h ('k') | chromecast/renderer/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698