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

Side by Side Diff: media/cdm/cdm_adapter.h

Issue 1673383002: Add allocator interface for use by cdm_adapter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
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
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 CdmBufferAllocator;
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|. Callbacks will be used for events generated by the CDM.
44 // |cdm_created_cb| will be called when the CDM is loaded and initialized. 45 // |cdm_created_cb| will be called when the CDM is loaded and initialized.
45 static void Create( 46 static void Create(
46 const std::string& key_system, 47 const std::string& key_system,
47 const base::FilePath& cdm_path, 48 const base::FilePath& cdm_path,
48 const CdmConfig& cdm_config, 49 const CdmConfig& cdm_config,
49 const SessionMessageCB& session_message_cb, 50 const SessionMessageCB& session_message_cb,
50 const SessionClosedCB& session_closed_cb, 51 const SessionClosedCB& session_closed_cb,
51 const LegacySessionErrorCB& legacy_session_error_cb, 52 const LegacySessionErrorCB& legacy_session_error_cb,
52 const SessionKeysChangeCB& session_keys_change_cb, 53 const SessionKeysChangeCB& session_keys_change_cb,
53 const SessionExpirationUpdateCB& session_expiration_update_cb, 54 const SessionExpirationUpdateCB& session_expiration_update_cb,
54 const CdmCreatedCB& cdm_created_cb); 55 const CdmCreatedCB& cdm_created_cb,
56 CdmBufferAllocator* allocator);
55 57
56 // MediaKeys implementation. 58 // MediaKeys implementation.
57 void SetServerCertificate(const std::vector<uint8_t>& certificate, 59 void SetServerCertificate(const std::vector<uint8_t>& certificate,
58 scoped_ptr<SimpleCdmPromise> promise) final; 60 scoped_ptr<SimpleCdmPromise> promise) final;
59 void CreateSessionAndGenerateRequest( 61 void CreateSessionAndGenerateRequest(
60 SessionType session_type, 62 SessionType session_type,
61 EmeInitDataType init_data_type, 63 EmeInitDataType init_data_type,
62 const std::vector<uint8_t>& init_data, 64 const std::vector<uint8_t>& init_data,
63 scoped_ptr<NewSessionCdmPromise> promise) final; 65 scoped_ptr<NewSessionCdmPromise> promise) final;
64 void LoadSession(SessionType session_type, 66 void LoadSession(SessionType session_type,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 cdm::Status decoder_status) override; 143 cdm::Status decoder_status) override;
142 cdm::FileIO* CreateFileIO(cdm::FileIOClient* client) override; 144 cdm::FileIO* CreateFileIO(cdm::FileIOClient* client) override;
143 145
144 private: 146 private:
145 CdmAdapter(const std::string& key_system, 147 CdmAdapter(const std::string& key_system,
146 const CdmConfig& cdm_config, 148 const CdmConfig& cdm_config,
147 const SessionMessageCB& session_message_cb, 149 const SessionMessageCB& session_message_cb,
148 const SessionClosedCB& session_closed_cb, 150 const SessionClosedCB& session_closed_cb,
149 const LegacySessionErrorCB& legacy_session_error_cb, 151 const LegacySessionErrorCB& legacy_session_error_cb,
150 const SessionKeysChangeCB& session_keys_change_cb, 152 const SessionKeysChangeCB& session_keys_change_cb,
151 const SessionExpirationUpdateCB& session_expiration_update_cb); 153 const SessionExpirationUpdateCB& session_expiration_update_cb,
154 CdmBufferAllocator* allocator);
152 ~CdmAdapter() final; 155 ~CdmAdapter() final;
153 156
154 // Load the CDM using |cdm_path| and initialize it. |promise| is resolved if 157 // Load the CDM using |cdm_path| and initialize it. |promise| is resolved if
155 // the CDM is successfully loaded and initialized, rejected otherwise. 158 // the CDM is successfully loaded and initialized, rejected otherwise.
156 void Initialize(const base::FilePath& cdm_path, 159 void Initialize(const base::FilePath& cdm_path,
157 scoped_ptr<media::SimpleCdmPromise> promise); 160 scoped_ptr<media::SimpleCdmPromise> promise);
158 161
159 // Create an instance of the |key_system| CDM contained in |cdm_path|. 162 // Create an instance of the |key_system| CDM contained in |cdm_path|.
160 // Caller owns the returned pointer. On error (unable to load, does not 163 // Caller owns the returned pointer. On error (unable to load, does not
161 // support |key_system|, does not support an supported interface, etc.) 164 // support |key_system|, does not support an supported interface, etc.)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 NewKeyCB new_video_key_cb_; 200 NewKeyCB new_video_key_cb_;
198 201
199 // Keep track of video frame natural size from the latest configuration 202 // Keep track of video frame natural size from the latest configuration
200 // as the CDM doesn't provide it. 203 // as the CDM doesn't provide it.
201 gfx::Size natural_size_; 204 gfx::Size natural_size_;
202 205
203 // Keep track of audio parameters. 206 // Keep track of audio parameters.
204 int audio_samples_per_second_; 207 int audio_samples_per_second_;
205 ChannelLayout audio_channel_layout_; 208 ChannelLayout audio_channel_layout_;
206 209
210 CdmBufferAllocator* allocator_;
211
207 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 212 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
208 213
209 // NOTE: Weak pointers must be invalidated before all other member variables. 214 // NOTE: Weak pointers must be invalidated before all other member variables.
210 base::WeakPtrFactory<CdmAdapter> weak_factory_; 215 base::WeakPtrFactory<CdmAdapter> weak_factory_;
211 216
212 DISALLOW_COPY_AND_ASSIGN(CdmAdapter); 217 DISALLOW_COPY_AND_ASSIGN(CdmAdapter);
213 }; 218 };
214 219
215 } // namespace media 220 } // namespace media
216 221
217 #endif // MEDIA_CDM_CDM_ADAPTER_H_ 222 #endif // MEDIA_CDM_CDM_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698