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

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

Issue 10969028: Add video decoding methods in Decryptor and add DecryptingVideoDecoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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
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"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "crypto/encryptor.h" 12 #include "crypto/encryptor.h"
13 #include "crypto/symmetric_key.h" 13 #include "crypto/symmetric_key.h"
14 #include "media/base/decoder_buffer.h" 14 #include "media/base/decoder_buffer.h"
15 #include "media/base/decrypt_config.h" 15 #include "media/base/decrypt_config.h"
16 #include "media/base/decryptor_client.h" 16 #include "media/base/decryptor_client.h"
17 #include "media/base/video_decoder_config.h"
18 #include "media/base/video_frame.h"
17 19
18 namespace media { 20 namespace media {
19 21
20 uint32 AesDecryptor::next_session_id_ = 1; 22 uint32 AesDecryptor::next_session_id_ = 1;
21 23
22 enum ClearBytesBufferSel { 24 enum ClearBytesBufferSel {
23 kSrcContainsClearBytes, 25 kSrcContainsClearBytes,
24 kDstContainsClearBytes 26 kDstContainsClearBytes
25 }; 27 };
26 28
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 227 }
226 228
227 decrypted->SetTimestamp(encrypted->GetTimestamp()); 229 decrypted->SetTimestamp(encrypted->GetTimestamp());
228 decrypted->SetDuration(encrypted->GetDuration()); 230 decrypted->SetDuration(encrypted->GetDuration());
229 decrypt_cb.Run(kSuccess, decrypted); 231 decrypt_cb.Run(kSuccess, decrypted);
230 } 232 }
231 233
232 void AesDecryptor::Stop() { 234 void AesDecryptor::Stop() {
233 } 235 }
234 236
237 void AesDecryptor::InitializeVideoDecoder(const VideoDecoderConfig& config,
238 const InitializeCB& init_cb) {
239 init_cb.Run(false);
ddorwin 2012/09/21 00:36:08 Why not NOTREACHED();? If this is used to determin
xhwang 2012/09/25 23:52:32 Done.
240 }
241
242 void AesDecryptor::DecryptAndDecodeVideo(
243 const scoped_refptr<DecoderBuffer>& encrypted,
244 const VideoDecodeCB& video_decode_cb) {
245 NOTREACHED();
246 video_decode_cb.Run(kError, NULL);
247 }
248
249 void AesDecryptor::ResetVideoDecoder() {
250 NOTREACHED();
251 }
252
253 void AesDecryptor::StopVideoDecoder() {
254 NOTREACHED();
255 }
256
235 void AesDecryptor::SetKey(const std::string& key_id, 257 void AesDecryptor::SetKey(const std::string& key_id,
236 scoped_ptr<DecryptionKey> decryption_key) { 258 scoped_ptr<DecryptionKey> decryption_key) {
237 base::AutoLock auto_lock(key_map_lock_); 259 base::AutoLock auto_lock(key_map_lock_);
238 KeyMap::iterator found = key_map_.find(key_id); 260 KeyMap::iterator found = key_map_.find(key_id);
239 if (found != key_map_.end()) { 261 if (found != key_map_.end()) {
240 delete found->second; 262 delete found->second;
241 key_map_.erase(found); 263 key_map_.erase(found);
242 } 264 }
243 key_map_[key_id] = decryption_key.release(); 265 key_map_[key_id] = decryption_key.release();
244 } 266 }
(...skipping 17 matching lines...) Expand all
262 bool AesDecryptor::DecryptionKey::Init() { 284 bool AesDecryptor::DecryptionKey::Init() {
263 CHECK(!secret_.empty()); 285 CHECK(!secret_.empty());
264 decryption_key_.reset(crypto::SymmetricKey::Import( 286 decryption_key_.reset(crypto::SymmetricKey::Import(
265 crypto::SymmetricKey::AES, secret_)); 287 crypto::SymmetricKey::AES, secret_));
266 if (!decryption_key_.get()) 288 if (!decryption_key_.get())
267 return false; 289 return false;
268 return true; 290 return true;
269 } 291 }
270 292
271 } // namespace media 293 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698