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

Side by Side Diff: webkit/media/crypto/ppapi/cdm_wrapper.cc

Issue 11023004: Update PPP side of Pepper CDM API to support video decoding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Set PPP interface version to 0.2 Created 8 years, 2 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 #include <cstring> 5 #include <cstring>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 class CdmWrapper : public pp::Instance, 212 class CdmWrapper : public pp::Instance,
213 public pp::ContentDecryptor_Private { 213 public pp::ContentDecryptor_Private {
214 public: 214 public:
215 CdmWrapper(PP_Instance instance, pp::Module* module); 215 CdmWrapper(PP_Instance instance, pp::Module* module);
216 virtual ~CdmWrapper(); 216 virtual ~CdmWrapper();
217 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]) { 217 virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]) {
218 return true; 218 return true;
219 } 219 }
220 220
221 // PPP_ContentDecryptor_Private methods 221 // PPP_ContentDecryptor_Private methods
222 // Note: As per comments in PPP_ContentDecryptor_Private, these calls should 222 // Note: Results of calls to these methods must be reported through the
223 // return false if the call was not forwarded to the CDM and should return 223 // PPB_ContentDecryptor_Private interface.
224 // true otherwise. Once the call reaches the CDM, the call result/status
225 // should be reported through the PPB_ContentDecryptor_Private interface.
226 virtual void GenerateKeyRequest(const std::string& key_system, 224 virtual void GenerateKeyRequest(const std::string& key_system,
227 pp::VarArrayBuffer init_data) OVERRIDE; 225 pp::VarArrayBuffer init_data) OVERRIDE;
228 virtual void AddKey(const std::string& session_id, 226 virtual void AddKey(const std::string& session_id,
229 pp::VarArrayBuffer key, 227 pp::VarArrayBuffer key,
230 pp::VarArrayBuffer init_data) OVERRIDE; 228 pp::VarArrayBuffer init_data) OVERRIDE;
231 virtual void CancelKeyRequest(const std::string& session_id) OVERRIDE; 229 virtual void CancelKeyRequest(const std::string& session_id) OVERRIDE;
232 virtual void Decrypt( 230 virtual void Decrypt(
233 pp::Buffer_Dev encrypted_buffer, 231 pp::Buffer_Dev encrypted_buffer,
234 const PP_EncryptedBlockInfo& encrypted_block_info) OVERRIDE; 232 const PP_EncryptedBlockInfo& encrypted_block_info) OVERRIDE;
235 virtual void DecryptAndDecode( 233 virtual void DecryptAndDecodeFrame(
236 pp::Buffer_Dev encrypted_buffer, 234 pp::Buffer_Dev encrypted_frame,
237 const PP_EncryptedBlockInfo& encrypted_block_info) OVERRIDE; 235 const PP_EncryptedVideoFrameInfo& encrypted_video_frame_info) OVERRIDE;
238 236
239 private: 237 private:
240 typedef linked_ptr<KeyMessageImpl> LinkedKeyMessage; 238 typedef linked_ptr<KeyMessageImpl> LinkedKeyMessage;
241 typedef linked_ptr<OutputBufferImpl> LinkedOutputBuffer; 239 typedef linked_ptr<OutputBufferImpl> LinkedOutputBuffer;
242 240
243 // <code>PPB_ContentDecryptor_Private</code> dispatchers. These are passed to 241 // <code>PPB_ContentDecryptor_Private</code> dispatchers. These are passed to
244 // <code>callback_factory_</code> to ensure that calls into 242 // <code>callback_factory_</code> to ensure that calls into
245 // <code>PPP_ContentDecryptor_Private</code> are asynchronous. 243 // <code>PPP_ContentDecryptor_Private</code> are asynchronous.
246 void KeyAdded(int32_t result, const std::string& session_id); 244 void KeyAdded(int32_t result, const std::string& session_id);
247 void KeyMessage(int32_t result, const LinkedKeyMessage& message); 245 void KeyMessage(int32_t result, const LinkedKeyMessage& message);
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 LinkedOutputBuffer output_buffer(new OutputBufferImpl()); 390 LinkedOutputBuffer output_buffer(new OutputBufferImpl());
393 cdm::Status status = cdm_->Decrypt(input_buffer, output_buffer.get()); 391 cdm::Status status = cdm_->Decrypt(input_buffer, output_buffer.get());
394 392
395 CallOnMain(callback_factory_.NewCallback( 393 CallOnMain(callback_factory_.NewCallback(
396 &CdmWrapper::DeliverBlock, 394 &CdmWrapper::DeliverBlock,
397 status, 395 status,
398 output_buffer, 396 output_buffer,
399 encrypted_block_info.tracking_info)); 397 encrypted_block_info.tracking_info));
400 } 398 }
401 399
402 void CdmWrapper::DecryptAndDecode( 400 void CdmWrapper::DecryptAndDecodeFrame(
403 pp::Buffer_Dev encrypted_buffer, 401 pp::Buffer_Dev encrypted_frame,
404 const PP_EncryptedBlockInfo& encrypted_block_info) { 402 const PP_EncryptedVideoFrameInfo& encrypted_video_frame_info) {
403 // TODO(tomfinegan): Implement video decoding.
405 } 404 }
406 405
407 void CdmWrapper::KeyAdded(int32_t result, const std::string& session_id) { 406 void CdmWrapper::KeyAdded(int32_t result, const std::string& session_id) {
408 pp::ContentDecryptor_Private::KeyAdded(key_system_, session_id); 407 pp::ContentDecryptor_Private::KeyAdded(key_system_, session_id);
409 } 408 }
410 409
411 void CdmWrapper::KeyMessage(int32_t result, 410 void CdmWrapper::KeyMessage(int32_t result,
412 const LinkedKeyMessage& key_message) { 411 const LinkedKeyMessage& key_message) {
413 pp::Buffer_Dev message_buffer = 412 pp::Buffer_Dev message_buffer =
414 static_cast<const PpbBuffer*>(key_message->message())->buffer_dev(); 413 static_cast<const PpbBuffer*>(key_message->message())->buffer_dev();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 } // namespace webkit_media 470 } // namespace webkit_media
472 471
473 namespace pp { 472 namespace pp {
474 473
475 // Factory function for your specialization of the Module object. 474 // Factory function for your specialization of the Module object.
476 Module* CreateModule() { 475 Module* CreateModule() {
477 return new webkit_media::CdmWrapperModule(); 476 return new webkit_media::CdmWrapperModule();
478 } 477 }
479 478
480 } // namespace pp 479 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698