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

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

Issue 15772012: Separate MediaKeys interface from Decryptor interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 #ifndef MEDIA_CRYPTO_AES_DECRYPTOR_H_ 5 #ifndef MEDIA_CRYPTO_AES_DECRYPTOR_H_
6 #define MEDIA_CRYPTO_AES_DECRYPTOR_H_ 6 #define MEDIA_CRYPTO_AES_DECRYPTOR_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/hash_tables.h" 11 #include "base/hash_tables.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/strings/string_piece.h" 14 #include "base/strings/string_piece.h"
15 #include "base/synchronization/lock.h" 15 #include "base/synchronization/lock.h"
16 #include "media/base/decryptor.h" 16 #include "media/base/decryptor.h"
17 #include "media/base/media_export.h" 17 #include "media/base/media_export.h"
18 #include "media/base/media_keys.h"
18 19
19 namespace crypto { 20 namespace crypto {
20 class SymmetricKey; 21 class SymmetricKey;
21 } 22 }
22 23
23 namespace media { 24 namespace media {
24 25
25 // Decrypts an AES encrypted buffer into an unencrypted buffer. The AES 26 // Decrypts an AES encrypted buffer into an unencrypted buffer. The AES
26 // encryption must be CTR with a key size of 128bits. 27 // encryption must be CTR with a key size of 128bits.
27 class MEDIA_EXPORT AesDecryptor : public Decryptor { 28 class MEDIA_EXPORT AesDecryptor : public MediaKeys, public Decryptor {
28 public: 29 public:
29 AesDecryptor(const KeyAddedCB& key_added_cb, 30 AesDecryptor(const KeyAddedCB& key_added_cb,
30 const KeyErrorCB& key_error_cb, 31 const KeyErrorCB& key_error_cb,
31 const KeyMessageCB& key_message_cb, 32 const KeyMessageCB& key_message_cb,
32 const NeedKeyCB& need_key_cb); 33 const NeedKeyCB& need_key_cb);
33 virtual ~AesDecryptor(); 34 virtual ~AesDecryptor();
34 35
35 // Decryptor implementation. 36 // MediaKeys implementation.
36 virtual bool GenerateKeyRequest(const std::string& key_system, 37 virtual bool GenerateKeyRequest(const std::string& key_system,
37 const std::string& type, 38 const std::string& type,
38 const uint8* init_data, 39 const uint8* init_data,
39 int init_data_length) OVERRIDE; 40 int init_data_length) OVERRIDE;
40 virtual void AddKey(const std::string& key_system, 41 virtual void AddKey(const std::string& key_system,
41 const uint8* key, 42 const uint8* key, int key_length,
42 int key_length, 43 const uint8* init_data, int init_data_length,
43 const uint8* init_data,
44 int init_data_length,
45 const std::string& session_id) OVERRIDE; 44 const std::string& session_id) OVERRIDE;
46 virtual void CancelKeyRequest(const std::string& key_system, 45 virtual void CancelKeyRequest(const std::string& key_system,
47 const std::string& session_id) OVERRIDE; 46 const std::string& session_id) OVERRIDE;
47
48 // Decryptor implementation.
48 virtual void RegisterNewKeyCB(StreamType stream_type, 49 virtual void RegisterNewKeyCB(StreamType stream_type,
49 const NewKeyCB& key_added_cb) OVERRIDE; 50 const NewKeyCB& key_added_cb) OVERRIDE;
50 virtual void Decrypt(StreamType stream_type, 51 virtual void Decrypt(StreamType stream_type,
51 const scoped_refptr<DecoderBuffer>& encrypted, 52 const scoped_refptr<DecoderBuffer>& encrypted,
52 const DecryptCB& decrypt_cb) OVERRIDE; 53 const DecryptCB& decrypt_cb) OVERRIDE;
53 virtual void CancelDecrypt(StreamType stream_type) OVERRIDE; 54 virtual void CancelDecrypt(StreamType stream_type) OVERRIDE;
54 virtual void InitializeAudioDecoder(const AudioDecoderConfig& config, 55 virtual void InitializeAudioDecoder(const AudioDecoderConfig& config,
55 const DecoderInitCB& init_cb) OVERRIDE; 56 const DecoderInitCB& init_cb) OVERRIDE;
56 virtual void InitializeVideoDecoder(const VideoDecoderConfig& config, 57 virtual void InitializeVideoDecoder(const VideoDecoderConfig& config,
57 const DecoderInitCB& init_cb) OVERRIDE; 58 const DecoderInitCB& init_cb) OVERRIDE;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 119
119 NewKeyCB new_audio_key_cb_; 120 NewKeyCB new_audio_key_cb_;
120 NewKeyCB new_video_key_cb_; 121 NewKeyCB new_video_key_cb_;
121 122
122 DISALLOW_COPY_AND_ASSIGN(AesDecryptor); 123 DISALLOW_COPY_AND_ASSIGN(AesDecryptor);
123 }; 124 };
124 125
125 } // namespace media 126 } // namespace media
126 127
127 #endif // MEDIA_CRYPTO_AES_DECRYPTOR_H_ 128 #endif // MEDIA_CRYPTO_AES_DECRYPTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698