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 <memory> | 10 #include <memory> |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // generated by the CDM. |cdm_created_cb| will be called when the CDM is | 57 // generated by the CDM. |cdm_created_cb| will be called when the CDM is |
58 // loaded and initialized. | 58 // loaded and initialized. |
59 static void Create( | 59 static void Create( |
60 const std::string& key_system, | 60 const std::string& key_system, |
61 const base::FilePath& cdm_path, | 61 const base::FilePath& cdm_path, |
62 const CdmConfig& cdm_config, | 62 const CdmConfig& cdm_config, |
63 std::unique_ptr<CdmAllocator> allocator, | 63 std::unique_ptr<CdmAllocator> allocator, |
64 const CreateCdmFileIOCB& create_cdm_file_io_cb, | 64 const CreateCdmFileIOCB& create_cdm_file_io_cb, |
65 const SessionMessageCB& session_message_cb, | 65 const SessionMessageCB& session_message_cb, |
66 const SessionClosedCB& session_closed_cb, | 66 const SessionClosedCB& session_closed_cb, |
67 const LegacySessionErrorCB& legacy_session_error_cb, | |
68 const SessionKeysChangeCB& session_keys_change_cb, | 67 const SessionKeysChangeCB& session_keys_change_cb, |
69 const SessionExpirationUpdateCB& session_expiration_update_cb, | 68 const SessionExpirationUpdateCB& session_expiration_update_cb, |
70 const CdmCreatedCB& cdm_created_cb); | 69 const CdmCreatedCB& cdm_created_cb); |
71 | 70 |
72 // MediaKeys implementation. | 71 // MediaKeys implementation. |
73 void SetServerCertificate(const std::vector<uint8_t>& certificate, | 72 void SetServerCertificate(const std::vector<uint8_t>& certificate, |
74 std::unique_ptr<SimpleCdmPromise> promise) final; | 73 std::unique_ptr<SimpleCdmPromise> promise) final; |
75 void CreateSessionAndGenerateRequest( | 74 void CreateSessionAndGenerateRequest( |
76 SessionType session_type, | 75 SessionType session_type, |
77 EmeInitDataType init_data_type, | 76 EmeInitDataType init_data_type, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 cdm::Status decoder_status) override; | 156 cdm::Status decoder_status) override; |
158 cdm::FileIO* CreateFileIO(cdm::FileIOClient* client) override; | 157 cdm::FileIO* CreateFileIO(cdm::FileIOClient* client) override; |
159 | 158 |
160 private: | 159 private: |
161 CdmAdapter(const std::string& key_system, | 160 CdmAdapter(const std::string& key_system, |
162 const CdmConfig& cdm_config, | 161 const CdmConfig& cdm_config, |
163 std::unique_ptr<CdmAllocator> allocator, | 162 std::unique_ptr<CdmAllocator> allocator, |
164 const CreateCdmFileIOCB& create_cdm_file_io_cb, | 163 const CreateCdmFileIOCB& create_cdm_file_io_cb, |
165 const SessionMessageCB& session_message_cb, | 164 const SessionMessageCB& session_message_cb, |
166 const SessionClosedCB& session_closed_cb, | 165 const SessionClosedCB& session_closed_cb, |
167 const LegacySessionErrorCB& legacy_session_error_cb, | |
168 const SessionKeysChangeCB& session_keys_change_cb, | 166 const SessionKeysChangeCB& session_keys_change_cb, |
169 const SessionExpirationUpdateCB& session_expiration_update_cb); | 167 const SessionExpirationUpdateCB& session_expiration_update_cb); |
170 ~CdmAdapter() final; | 168 ~CdmAdapter() final; |
171 | 169 |
172 // Load the CDM using |cdm_path| and initialize it. |promise| is resolved if | 170 // Load the CDM using |cdm_path| and initialize it. |promise| is resolved if |
173 // the CDM is successfully loaded and initialized, rejected otherwise. | 171 // the CDM is successfully loaded and initialized, rejected otherwise. |
174 void Initialize(const base::FilePath& cdm_path, | 172 void Initialize(const base::FilePath& cdm_path, |
175 std::unique_ptr<media::SimpleCdmPromise> promise); | 173 std::unique_ptr<media::SimpleCdmPromise> promise); |
176 | 174 |
177 // Create an instance of the |key_system| CDM contained in |cdm_path|. | 175 // Create an instance of the |key_system| CDM contained in |cdm_path|. |
(...skipping 18 matching lines...) Expand all Loading... |
196 // Used to keep track of promises while the CDM is processing the request. | 194 // Used to keep track of promises while the CDM is processing the request. |
197 CdmPromiseAdapter cdm_promise_adapter_; | 195 CdmPromiseAdapter cdm_promise_adapter_; |
198 | 196 |
199 std::unique_ptr<CdmWrapper> cdm_; | 197 std::unique_ptr<CdmWrapper> cdm_; |
200 std::string key_system_; | 198 std::string key_system_; |
201 CdmConfig cdm_config_; | 199 CdmConfig cdm_config_; |
202 | 200 |
203 // Callbacks for firing session events. | 201 // Callbacks for firing session events. |
204 SessionMessageCB session_message_cb_; | 202 SessionMessageCB session_message_cb_; |
205 SessionClosedCB session_closed_cb_; | 203 SessionClosedCB session_closed_cb_; |
206 LegacySessionErrorCB legacy_session_error_cb_; | |
207 SessionKeysChangeCB session_keys_change_cb_; | 204 SessionKeysChangeCB session_keys_change_cb_; |
208 SessionExpirationUpdateCB session_expiration_update_cb_; | 205 SessionExpirationUpdateCB session_expiration_update_cb_; |
209 | 206 |
210 // Callbacks for deferred initialization. | 207 // Callbacks for deferred initialization. |
211 DecoderInitCB audio_init_cb_; | 208 DecoderInitCB audio_init_cb_; |
212 DecoderInitCB video_init_cb_; | 209 DecoderInitCB video_init_cb_; |
213 | 210 |
214 // Callbacks for new keys added. | 211 // Callbacks for new keys added. |
215 NewKeyCB new_audio_key_cb_; | 212 NewKeyCB new_audio_key_cb_; |
216 NewKeyCB new_video_key_cb_; | 213 NewKeyCB new_video_key_cb_; |
(...skipping 13 matching lines...) Expand all Loading... |
230 | 227 |
231 // NOTE: Weak pointers must be invalidated before all other member variables. | 228 // NOTE: Weak pointers must be invalidated before all other member variables. |
232 base::WeakPtrFactory<CdmAdapter> weak_factory_; | 229 base::WeakPtrFactory<CdmAdapter> weak_factory_; |
233 | 230 |
234 DISALLOW_COPY_AND_ASSIGN(CdmAdapter); | 231 DISALLOW_COPY_AND_ASSIGN(CdmAdapter); |
235 }; | 232 }; |
236 | 233 |
237 } // namespace media | 234 } // namespace media |
238 | 235 |
239 #endif // MEDIA_CDM_CDM_ADAPTER_H_ | 236 #endif // MEDIA_CDM_CDM_ADAPTER_H_ |
OLD | NEW |