| OLD | NEW |
| 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 "ppapi/cpp/private/content_decryptor_private.h" | 5 #include "ppapi/cpp/private/content_decryptor_private.h" |
| 6 | 6 |
| 7 #include <cstring> // memcpy | 7 #include <cstring> // memcpy |
| 8 | 8 |
| 9 #include "ppapi/c/ppb_var.h" | 9 #include "ppapi/c/ppb_var.h" |
| 10 #include "ppapi/c/private/ppb_content_decryptor_private.h" | 10 #include "ppapi/c/private/ppb_content_decryptor_private.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 if (!object) | 98 if (!object) |
| 99 return; | 99 return; |
| 100 | 100 |
| 101 pp::Buffer_Dev encrypted_block(pp::PassRef(), encrypted_resource); | 101 pp::Buffer_Dev encrypted_block(pp::PassRef(), encrypted_resource); |
| 102 | 102 |
| 103 static_cast<ContentDecryptor_Private*>(object)->Decrypt( | 103 static_cast<ContentDecryptor_Private*>(object)->Decrypt( |
| 104 encrypted_block, | 104 encrypted_block, |
| 105 *encrypted_block_info); | 105 *encrypted_block_info); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void DecryptAndDecode(PP_Instance instance, | 108 void DecryptAndDecodeFrame( |
| 109 PP_Resource encrypted_resource, | 109 PP_Instance instance, |
| 110 const PP_EncryptedBlockInfo* encrypted_block_info) { | 110 PP_Resource encrypted_resource, |
| 111 const PP_EncryptedVideoFrameInfo* encrypted_video_frame_info) { |
| 111 void* object = | 112 void* object = |
| 112 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); | 113 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); |
| 113 if (!object) | 114 if (!object) |
| 114 return; | 115 return; |
| 115 | 116 |
| 116 pp::Buffer_Dev encrypted_block(pp::PassRef(), encrypted_resource); | 117 pp::Buffer_Dev encrypted_frame(pp::PassRef(), encrypted_resource); |
| 117 | 118 |
| 118 static_cast<ContentDecryptor_Private*>(object)->DecryptAndDecode( | 119 static_cast<ContentDecryptor_Private*>(object)->DecryptAndDecodeFrame( |
| 119 encrypted_block, | 120 encrypted_frame, |
| 120 *encrypted_block_info); | 121 *encrypted_video_frame_info); |
| 121 } | 122 } |
| 122 | 123 |
| 123 const PPP_ContentDecryptor_Private ppp_content_decryptor = { | 124 const PPP_ContentDecryptor_Private ppp_content_decryptor = { |
| 124 &GenerateKeyRequest, | 125 &GenerateKeyRequest, |
| 125 &AddKey, | 126 &AddKey, |
| 126 &CancelKeyRequest, | 127 &CancelKeyRequest, |
| 127 &Decrypt, | 128 &Decrypt, |
| 128 &DecryptAndDecode | 129 &DecryptAndDecodeFrame |
| 129 }; | 130 }; |
| 130 | 131 |
| 131 template <> const char* interface_name<PPB_ContentDecryptor_Private>() { | 132 template <> const char* interface_name<PPB_ContentDecryptor_Private>() { |
| 132 return PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE; | 133 return PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE; |
| 133 } | 134 } |
| 134 | 135 |
| 135 } // namespace | 136 } // namespace |
| 136 | 137 |
| 137 ContentDecryptor_Private::ContentDecryptor_Private(Instance* instance) | 138 ContentDecryptor_Private::ContentDecryptor_Private(Instance* instance) |
| 138 : associated_instance_(instance) { | 139 : associated_instance_(instance) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 const PP_DecryptedBlockInfo& decrypted_block_info) { | 236 const PP_DecryptedBlockInfo& decrypted_block_info) { |
| 236 if (has_interface<PPB_ContentDecryptor_Private>()) { | 237 if (has_interface<PPB_ContentDecryptor_Private>()) { |
| 237 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples( | 238 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples( |
| 238 associated_instance_.pp_instance(), | 239 associated_instance_.pp_instance(), |
| 239 decrypted_samples.pp_resource(), | 240 decrypted_samples.pp_resource(), |
| 240 &decrypted_block_info); | 241 &decrypted_block_info); |
| 241 } | 242 } |
| 242 } | 243 } |
| 243 | 244 |
| 244 } // namespace pp | 245 } // namespace pp |
| OLD | NEW |