OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_CDM_ADAPTER_H_ | 5 #ifndef MEDIA_CDM_CDM_ADAPTER_H_ |
6 #define MEDIA_CDM_CDM_ADAPTER_H_ | 6 #define MEDIA_CDM_CDM_ADAPTER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 13 matching lines...) Expand all Loading... | |
24 #include "media/base/cdm_promise_adapter.h" | 24 #include "media/base/cdm_promise_adapter.h" |
25 #include "media/base/decryptor.h" | 25 #include "media/base/decryptor.h" |
26 #include "media/base/media_export.h" | 26 #include "media/base/media_export.h" |
27 #include "media/base/media_keys.h" | 27 #include "media/base/media_keys.h" |
28 #include "media/cdm/api/content_decryption_module.h" | 28 #include "media/cdm/api/content_decryption_module.h" |
29 #include "ui/gfx/geometry/size.h" | 29 #include "ui/gfx/geometry/size.h" |
30 | 30 |
31 namespace media { | 31 namespace media { |
32 | 32 |
33 class AudioFramesImpl; | 33 class AudioFramesImpl; |
34 class CdmAllocator; | |
34 class CdmWrapper; | 35 class CdmWrapper; |
35 | 36 |
36 class MEDIA_EXPORT CdmAdapter : public MediaKeys, | 37 class MEDIA_EXPORT CdmAdapter : public MediaKeys, |
37 public CdmContext, | 38 public CdmContext, |
38 public Decryptor, | 39 public Decryptor, |
39 NON_EXPORTED_BASE(public cdm::Host_7), | 40 NON_EXPORTED_BASE(public cdm::Host_7), |
40 NON_EXPORTED_BASE(public cdm::Host_8) { | 41 NON_EXPORTED_BASE(public cdm::Host_8) { |
41 public: | 42 public: |
42 // Create the CDM using |cdm_path| and initialize it using |key_system| and | 43 // Create the CDM using |cdm_path| and initialize it using |key_system| and |
43 // |cdm_config|. Callbacks will be used for events generated by the CDM. | 44 // |cdm_config|. |allocator| is to be used whenever the CDM needs memory. |
xhwang
2016/02/12 08:45:29
Also used to create VideoFrame?
jrummell
2016/02/12 23:14:20
Done.
| |
44 // |cdm_created_cb| will be called when the CDM is loaded and initialized. | 45 // Callbacks will be used for events generated by the CDM. |cdm_created_cb| |
46 // will be called when the CDM is loaded and initialized. | |
45 static void Create( | 47 static void Create( |
46 const std::string& key_system, | 48 const std::string& key_system, |
47 const base::FilePath& cdm_path, | 49 const base::FilePath& cdm_path, |
48 const CdmConfig& cdm_config, | 50 const CdmConfig& cdm_config, |
51 scoped_ptr<CdmAllocator> allocator, | |
49 const SessionMessageCB& session_message_cb, | 52 const SessionMessageCB& session_message_cb, |
50 const SessionClosedCB& session_closed_cb, | 53 const SessionClosedCB& session_closed_cb, |
51 const LegacySessionErrorCB& legacy_session_error_cb, | 54 const LegacySessionErrorCB& legacy_session_error_cb, |
52 const SessionKeysChangeCB& session_keys_change_cb, | 55 const SessionKeysChangeCB& session_keys_change_cb, |
53 const SessionExpirationUpdateCB& session_expiration_update_cb, | 56 const SessionExpirationUpdateCB& session_expiration_update_cb, |
54 const CdmCreatedCB& cdm_created_cb); | 57 const CdmCreatedCB& cdm_created_cb); |
55 | 58 |
56 // MediaKeys implementation. | 59 // MediaKeys implementation. |
57 void SetServerCertificate(const std::vector<uint8_t>& certificate, | 60 void SetServerCertificate(const std::vector<uint8_t>& certificate, |
58 scoped_ptr<SimpleCdmPromise> promise) final; | 61 scoped_ptr<SimpleCdmPromise> promise) final; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 uint32_t challenge_size) override; | 140 uint32_t challenge_size) override; |
138 void EnableOutputProtection(uint32_t desired_protection_mask) override; | 141 void EnableOutputProtection(uint32_t desired_protection_mask) override; |
139 void QueryOutputProtectionStatus() override; | 142 void QueryOutputProtectionStatus() override; |
140 void OnDeferredInitializationDone(cdm::StreamType stream_type, | 143 void OnDeferredInitializationDone(cdm::StreamType stream_type, |
141 cdm::Status decoder_status) override; | 144 cdm::Status decoder_status) override; |
142 cdm::FileIO* CreateFileIO(cdm::FileIOClient* client) override; | 145 cdm::FileIO* CreateFileIO(cdm::FileIOClient* client) override; |
143 | 146 |
144 private: | 147 private: |
145 CdmAdapter(const std::string& key_system, | 148 CdmAdapter(const std::string& key_system, |
146 const CdmConfig& cdm_config, | 149 const CdmConfig& cdm_config, |
150 scoped_ptr<CdmAllocator> allocator, | |
147 const SessionMessageCB& session_message_cb, | 151 const SessionMessageCB& session_message_cb, |
148 const SessionClosedCB& session_closed_cb, | 152 const SessionClosedCB& session_closed_cb, |
149 const LegacySessionErrorCB& legacy_session_error_cb, | 153 const LegacySessionErrorCB& legacy_session_error_cb, |
150 const SessionKeysChangeCB& session_keys_change_cb, | 154 const SessionKeysChangeCB& session_keys_change_cb, |
151 const SessionExpirationUpdateCB& session_expiration_update_cb); | 155 const SessionExpirationUpdateCB& session_expiration_update_cb); |
152 ~CdmAdapter() final; | 156 ~CdmAdapter() final; |
153 | 157 |
154 // Load the CDM using |cdm_path| and initialize it. |promise| is resolved if | 158 // Load the CDM using |cdm_path| and initialize it. |promise| is resolved if |
155 // the CDM is successfully loaded and initialized, rejected otherwise. | 159 // the CDM is successfully loaded and initialized, rejected otherwise. |
156 void Initialize(const base::FilePath& cdm_path, | 160 void Initialize(const base::FilePath& cdm_path, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 NewKeyCB new_video_key_cb_; | 201 NewKeyCB new_video_key_cb_; |
198 | 202 |
199 // Keep track of video frame natural size from the latest configuration | 203 // Keep track of video frame natural size from the latest configuration |
200 // as the CDM doesn't provide it. | 204 // as the CDM doesn't provide it. |
201 gfx::Size natural_size_; | 205 gfx::Size natural_size_; |
202 | 206 |
203 // Keep track of audio parameters. | 207 // Keep track of audio parameters. |
204 int audio_samples_per_second_; | 208 int audio_samples_per_second_; |
205 ChannelLayout audio_channel_layout_; | 209 ChannelLayout audio_channel_layout_; |
206 | 210 |
211 scoped_ptr<CdmAllocator> allocator_; | |
212 | |
207 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 213 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
208 | 214 |
209 // NOTE: Weak pointers must be invalidated before all other member variables. | 215 // NOTE: Weak pointers must be invalidated before all other member variables. |
210 base::WeakPtrFactory<CdmAdapter> weak_factory_; | 216 base::WeakPtrFactory<CdmAdapter> weak_factory_; |
211 | 217 |
212 DISALLOW_COPY_AND_ASSIGN(CdmAdapter); | 218 DISALLOW_COPY_AND_ASSIGN(CdmAdapter); |
213 }; | 219 }; |
214 | 220 |
215 } // namespace media | 221 } // namespace media |
216 | 222 |
217 #endif // MEDIA_CDM_CDM_ADAPTER_H_ | 223 #endif // MEDIA_CDM_CDM_ADAPTER_H_ |
OLD | NEW |