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

Side by Side Diff: media/webm/webm_content_encodings_client.cc

Issue 10807003: Revert 147169 - Add support for encrypted WebM files as defined in the RFC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « media/webm/webm_content_encodings.cc ('k') | media/webm/webm_parser.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/webm/webm_content_encodings_client.h" 5 #include "media/webm/webm_content_encodings_client.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "media/webm/webm_constants.h" 9 #include "media/webm/webm_constants.h"
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 if (id == kWebMIdContentEncryption) { 43 if (id == kWebMIdContentEncryption) {
44 DCHECK(cur_content_encoding_.get()); 44 DCHECK(cur_content_encoding_.get());
45 if (content_encryption_encountered_) { 45 if (content_encryption_encountered_) {
46 DVLOG(1) << "Unexpected multiple ContentEncryption."; 46 DVLOG(1) << "Unexpected multiple ContentEncryption.";
47 return NULL; 47 return NULL;
48 } 48 }
49 content_encryption_encountered_ = true; 49 content_encryption_encountered_ = true;
50 return this; 50 return this;
51 } 51 }
52 52
53 if (id == kWebMIdContentEncAESSettings) {
54 DCHECK(cur_content_encoding_.get());
55 return this;
56 }
57
58 // This should not happen if WebMListParser is working properly. 53 // This should not happen if WebMListParser is working properly.
59 DCHECK(false); 54 DCHECK(false);
60 return NULL; 55 return NULL;
61 } 56 }
62 57
63 // Mandatory occurrence restriction is checked in this function. Multiple 58 // Mandatory occurrence restriction is checked in this function. Multiple
64 // occurrence restriction is checked in OnUInt and OnBinary. 59 // occurrence restriction is checked in OnUInt and OnBinary.
65 bool WebMContentEncodingsClient::OnListEnd(int id) { 60 bool WebMContentEncodingsClient::OnListEnd(int id) {
66 if (id == kWebMIdContentEncodings) { 61 if (id == kWebMIdContentEncodings) {
67 // ContentEncoding element is mandatory. Check this! 62 // ContentEncoding element is mandatory. Check this!
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 DCHECK(cur_content_encoding_.get()); 114 DCHECK(cur_content_encoding_.get());
120 // Specify default value for elements that are not present. 115 // Specify default value for elements that are not present.
121 if (cur_content_encoding_->encryption_algo() == 116 if (cur_content_encoding_->encryption_algo() ==
122 ContentEncoding::kEncAlgoInvalid) { 117 ContentEncoding::kEncAlgoInvalid) {
123 cur_content_encoding_->set_encryption_algo( 118 cur_content_encoding_->set_encryption_algo(
124 ContentEncoding::kEncAlgoNotEncrypted); 119 ContentEncoding::kEncAlgoNotEncrypted);
125 } 120 }
126 return true; 121 return true;
127 } 122 }
128 123
129 if (id == kWebMIdContentEncAESSettings) {
130 if (cur_content_encoding_->cipher_mode() ==
131 ContentEncoding::kCipherModeInvalid)
132 cur_content_encoding_->set_cipher_mode(ContentEncoding::kCipherModeCtr);
133 return true;
134 }
135
136 // This should not happen if WebMListParser is working properly. 124 // This should not happen if WebMListParser is working properly.
137 DCHECK(false); 125 DCHECK(false);
138 return false; 126 return false;
139 } 127 }
140 128
141 // Multiple occurrence restriction and range are checked in this function. 129 // Multiple occurrence restriction and range are checked in this function.
142 // Mandatory occurrence restriction is checked in OnListEnd. 130 // Mandatory occurrence restriction is checked in OnListEnd.
143 bool WebMContentEncodingsClient::OnUInt(int id, int64 val) { 131 bool WebMContentEncodingsClient::OnUInt(int id, int64 val) {
144 DCHECK(cur_content_encoding_.get()); 132 DCHECK(cur_content_encoding_.get());
145 133
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 val > ContentEncoding::kEncAlgoAes) { 199 val > ContentEncoding::kEncAlgoAes) {
212 DVLOG(1) << "Unexpected ContentEncAlgo " << val << "."; 200 DVLOG(1) << "Unexpected ContentEncAlgo " << val << ".";
213 return false; 201 return false;
214 } 202 }
215 203
216 cur_content_encoding_->set_encryption_algo( 204 cur_content_encoding_->set_encryption_algo(
217 static_cast<ContentEncoding::EncryptionAlgo>(val)); 205 static_cast<ContentEncoding::EncryptionAlgo>(val));
218 return true; 206 return true;
219 } 207 }
220 208
221 if (id == kWebMIdAESSettingsCipherMode) {
222 if (cur_content_encoding_->cipher_mode() !=
223 ContentEncoding::kCipherModeInvalid) {
224 DVLOG(1) << "Unexpected multiple AESSettingsCipherMode.";
225 return false;
226 }
227
228 if (val != ContentEncoding::kCipherModeCtr) {
229 DVLOG(1) << "Unexpected AESSettingsCipherMode " << val << ".";
230 return false;
231 }
232
233 cur_content_encoding_->set_cipher_mode(
234 static_cast<ContentEncoding::CipherMode>(val));
235 return true;
236 }
237
238 // This should not happen if WebMListParser is working properly. 209 // This should not happen if WebMListParser is working properly.
239 DCHECK(false); 210 DCHECK(false);
240 return false; 211 return false;
241 } 212 }
242 213
243 // Multiple occurrence restriction is checked in this function. Mandatory 214 // Multiple occurrence restriction is checked in this function. Mandatory
244 // restriction is checked in OnListEnd. 215 // restriction is checked in OnListEnd.
245 bool WebMContentEncodingsClient::OnBinary(int id, const uint8* data, int size) { 216 bool WebMContentEncodingsClient::OnBinary(int id, const uint8* data, int size) {
246 DCHECK(cur_content_encoding_.get()); 217 DCHECK(cur_content_encoding_.get());
247 DCHECK(data); 218 DCHECK(data);
248 DCHECK_GT(size, 0); 219 DCHECK_GT(size, 0);
249 220
250 if (id == kWebMIdContentEncKeyID) { 221 if (id == kWebMIdContentEncKeyID) {
251 if (cur_content_encoding_->encryption_key_id() || 222 if (cur_content_encoding_->encryption_key_id() ||
252 cur_content_encoding_->encryption_key_id_size()) { 223 cur_content_encoding_->encryption_key_id_size()) {
253 DVLOG(1) << "Unexpected multiple ContentEncKeyID"; 224 DVLOG(1) << "Unexpected multiple ContentEncKeyID";
254 return false; 225 return false;
255 } 226 }
256 cur_content_encoding_->SetEncryptionKeyId(data, size); 227 cur_content_encoding_->SetEncryptionKeyId(data, size);
257 return true; 228 return true;
258 } 229 }
259 230
260 // This should not happen if WebMListParser is working properly. 231 // This should not happen if WebMListParser is working properly.
261 DCHECK(false); 232 DCHECK(false);
262 return false; 233 return false;
263 } 234 }
264 235
265 } // namespace media 236 } // namespace media
OLDNEW
« no previous file with comments | « media/webm/webm_content_encodings.cc ('k') | media/webm/webm_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698