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

Side by Side Diff: media/crypto/aes_decryptor.cc

Issue 11226019: Encrypted Media: Replace DecryptorClient with key event callbacks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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
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/crypto/aes_decryptor.h" 5 #include "media/crypto/aes_decryptor.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 decrypted->SetDuration(encrypted->GetDuration()); 232 decrypted->SetDuration(encrypted->GetDuration());
233 decrypt_cb.Run(kSuccess, decrypted); 233 decrypt_cb.Run(kSuccess, decrypted);
234 } 234 }
235 235
236 void AesDecryptor::CancelDecrypt(StreamType stream_type) { 236 void AesDecryptor::CancelDecrypt(StreamType stream_type) {
237 // Decrypt() calls the DecryptCB synchronously so there's nothing to cancel. 237 // Decrypt() calls the DecryptCB synchronously so there's nothing to cancel.
238 } 238 }
239 239
240 void AesDecryptor::InitializeAudioDecoder(scoped_ptr<AudioDecoderConfig> config, 240 void AesDecryptor::InitializeAudioDecoder(scoped_ptr<AudioDecoderConfig> config,
241 const DecoderInitCB& init_cb, 241 const DecoderInitCB& init_cb,
242 const KeyAddedCB& key_added_cb) { 242 const OnKeyAddedCB& key_added_cb) {
Ami GONE FROM CHROMIUM 2012/10/23 06:52:22 I wish you hadn't done all this renaming in a prot
xhwang 2012/10/23 07:32:13 Sorry for the noise. I realized that I need to do
243 // AesDecryptor does not support audio decoding. 243 // AesDecryptor does not support audio decoding.
244 init_cb.Run(false); 244 init_cb.Run(false);
245 } 245 }
246 246
247 void AesDecryptor::InitializeVideoDecoder(scoped_ptr<VideoDecoderConfig> config, 247 void AesDecryptor::InitializeVideoDecoder(scoped_ptr<VideoDecoderConfig> config,
248 const DecoderInitCB& init_cb, 248 const DecoderInitCB& init_cb,
249 const KeyAddedCB& key_added_cb) { 249 const OnKeyAddedCB& key_added_cb) {
250 // AesDecryptor does not support video decoding. 250 // AesDecryptor does not support video decoding.
251 init_cb.Run(false); 251 init_cb.Run(false);
252 } 252 }
253 253
254 void AesDecryptor::DecryptAndDecodeAudio( 254 void AesDecryptor::DecryptAndDecodeAudio(
255 const scoped_refptr<DecoderBuffer>& encrypted, 255 const scoped_refptr<DecoderBuffer>& encrypted,
256 const AudioDecodeCB& audio_decode_cb) { 256 const AudioDecodeCB& audio_decode_cb) {
257 NOTREACHED() << "AesDecryptor does not support audio decoding"; 257 NOTREACHED() << "AesDecryptor does not support audio decoding";
258 } 258 }
259 259
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 bool AesDecryptor::DecryptionKey::Init() { 301 bool AesDecryptor::DecryptionKey::Init() {
302 CHECK(!secret_.empty()); 302 CHECK(!secret_.empty());
303 decryption_key_.reset(crypto::SymmetricKey::Import( 303 decryption_key_.reset(crypto::SymmetricKey::Import(
304 crypto::SymmetricKey::AES, secret_)); 304 crypto::SymmetricKey::AES, secret_));
305 if (!decryption_key_.get()) 305 if (!decryption_key_.get())
306 return false; 306 return false;
307 return true; 307 return true;
308 } 308 }
309 309
310 } // namespace media 310 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698