OLD | NEW |
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 #ifndef MEDIA_CDM_AES_DECRYPTOR_H_ | 5 #ifndef MEDIA_CDM_AES_DECRYPTOR_H_ |
6 #define MEDIA_CDM_AES_DECRYPTOR_H_ | 6 #define MEDIA_CDM_AES_DECRYPTOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/containers/scoped_ptr_hash_map.h" | 15 #include "base/containers/scoped_ptr_hash_map.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
19 #include "media/base/cdm_context.h" | 19 #include "media/base/cdm_context.h" |
| 20 #include "media/base/content_decryption_module.h" |
20 #include "media/base/decryptor.h" | 21 #include "media/base/decryptor.h" |
21 #include "media/base/media_export.h" | 22 #include "media/base/media_export.h" |
22 #include "media/base/media_keys.h" | |
23 | 23 |
24 class GURL; | 24 class GURL; |
25 | 25 |
26 namespace crypto { | 26 namespace crypto { |
27 class SymmetricKey; | 27 class SymmetricKey; |
28 } | 28 } |
29 | 29 |
30 namespace media { | 30 namespace media { |
31 | 31 |
32 // Decrypts an AES encrypted buffer into an unencrypted buffer. The AES | 32 // Decrypts an AES encrypted buffer into an unencrypted buffer. The AES |
33 // encryption must be CTR with a key size of 128bits. | 33 // encryption must be CTR with a key size of 128bits. |
34 class MEDIA_EXPORT AesDecryptor : public MediaKeys, | 34 class MEDIA_EXPORT AesDecryptor : public ContentDecryptionModule, |
35 public CdmContext, | 35 public CdmContext, |
36 public Decryptor { | 36 public Decryptor { |
37 public: | 37 public: |
38 AesDecryptor(const GURL& security_origin, | 38 AesDecryptor(const GURL& security_origin, |
39 const SessionMessageCB& session_message_cb, | 39 const SessionMessageCB& session_message_cb, |
40 const SessionClosedCB& session_closed_cb, | 40 const SessionClosedCB& session_closed_cb, |
41 const SessionKeysChangeCB& session_keys_change_cb); | 41 const SessionKeysChangeCB& session_keys_change_cb); |
42 | 42 |
43 // MediaKeys implementation. | 43 // ContentDecryptionModule implementation. |
44 void SetServerCertificate(const std::vector<uint8_t>& certificate, | 44 void SetServerCertificate(const std::vector<uint8_t>& certificate, |
45 std::unique_ptr<SimpleCdmPromise> promise) override; | 45 std::unique_ptr<SimpleCdmPromise> promise) override; |
46 void CreateSessionAndGenerateRequest( | 46 void CreateSessionAndGenerateRequest( |
47 SessionType session_type, | 47 SessionType session_type, |
48 EmeInitDataType init_data_type, | 48 EmeInitDataType init_data_type, |
49 const std::vector<uint8_t>& init_data, | 49 const std::vector<uint8_t>& init_data, |
50 std::unique_ptr<NewSessionCdmPromise> promise) override; | 50 std::unique_ptr<NewSessionCdmPromise> promise) override; |
51 void LoadSession(SessionType session_type, | 51 void LoadSession(SessionType session_type, |
52 const std::string& session_id, | 52 const std::string& session_id, |
53 std::unique_ptr<NewSessionCdmPromise> promise) override; | 53 std::unique_ptr<NewSessionCdmPromise> promise) override; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // Protect |new_audio_key_cb_| and |new_video_key_cb_| as they are set on the | 159 // Protect |new_audio_key_cb_| and |new_video_key_cb_| as they are set on the |
160 // main thread but called on the media thread. | 160 // main thread but called on the media thread. |
161 mutable base::Lock new_key_cb_lock_; | 161 mutable base::Lock new_key_cb_lock_; |
162 | 162 |
163 DISALLOW_COPY_AND_ASSIGN(AesDecryptor); | 163 DISALLOW_COPY_AND_ASSIGN(AesDecryptor); |
164 }; | 164 }; |
165 | 165 |
166 } // namespace media | 166 } // namespace media |
167 | 167 |
168 #endif // MEDIA_CDM_AES_DECRYPTOR_H_ | 168 #endif // MEDIA_CDM_AES_DECRYPTOR_H_ |
OLD | NEW |