| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 PP_DecryptorStreamType decoder_type, | 137 PP_DecryptorStreamType decoder_type, |
| 138 uint32_t request_id) { | 138 uint32_t request_id) { |
| 139 void* object = | 139 void* object = |
| 140 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); | 140 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); |
| 141 if (!object) | 141 if (!object) |
| 142 return; | 142 return; |
| 143 static_cast<ContentDecryptor_Private*>(object)->ResetDecoder(decoder_type, | 143 static_cast<ContentDecryptor_Private*>(object)->ResetDecoder(decoder_type, |
| 144 request_id); | 144 request_id); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void DecryptAndDecodeFrame( | 147 void DecryptAndDecode(PP_Instance instance, |
| 148 PP_Instance instance, | 148 PP_DecryptorStreamType decoder_type, |
| 149 PP_Resource encrypted_resource, | 149 PP_Resource encrypted_resource, |
| 150 const PP_EncryptedVideoFrameInfo* encrypted_video_frame_info) { | 150 const PP_EncryptedBlockInfo* encrypted_block_info) { |
| 151 void* object = | 151 void* object = |
| 152 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); | 152 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); |
| 153 if (!object) | 153 if (!object) |
| 154 return; | 154 return; |
| 155 | 155 |
| 156 pp::Buffer_Dev encrypted_frame(pp::PassRef(), encrypted_resource); | 156 pp::Buffer_Dev encrypted_buffer(pp::PassRef(), encrypted_resource); |
| 157 | 157 |
| 158 static_cast<ContentDecryptor_Private*>(object)->DecryptAndDecodeFrame( | 158 static_cast<ContentDecryptor_Private*>(object)->DecryptAndDecode( |
| 159 encrypted_frame, | 159 decoder_type, |
| 160 *encrypted_video_frame_info); | 160 encrypted_buffer, |
| 161 *encrypted_block_info); |
| 161 } | 162 } |
| 162 | 163 |
| 163 const PPP_ContentDecryptor_Private ppp_content_decryptor = { | 164 const PPP_ContentDecryptor_Private ppp_content_decryptor = { |
| 164 &GenerateKeyRequest, | 165 &GenerateKeyRequest, |
| 165 &AddKey, | 166 &AddKey, |
| 166 &CancelKeyRequest, | 167 &CancelKeyRequest, |
| 167 &Decrypt, | 168 &Decrypt, |
| 168 &InitializeVideoDecoder, | 169 &InitializeVideoDecoder, |
| 169 &DeinitializeDecoder, | 170 &DeinitializeDecoder, |
| 170 &ResetDecoder, | 171 &ResetDecoder, |
| 171 &DecryptAndDecodeFrame | 172 &DecryptAndDecode |
| 172 }; | 173 }; |
| 173 | 174 |
| 174 template <> const char* interface_name<PPB_ContentDecryptor_Private>() { | 175 template <> const char* interface_name<PPB_ContentDecryptor_Private>() { |
| 175 return PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE; | 176 return PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE; |
| 176 } | 177 } |
| 177 | 178 |
| 178 } // namespace | 179 } // namespace |
| 179 | 180 |
| 180 ContentDecryptor_Private::ContentDecryptor_Private(Instance* instance) | 181 ContentDecryptor_Private::ContentDecryptor_Private(Instance* instance) |
| 181 : associated_instance_(instance) { | 182 : associated_instance_(instance) { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 const PP_DecryptedBlockInfo& decrypted_block_info) { | 312 const PP_DecryptedBlockInfo& decrypted_block_info) { |
| 312 if (has_interface<PPB_ContentDecryptor_Private>()) { | 313 if (has_interface<PPB_ContentDecryptor_Private>()) { |
| 313 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples( | 314 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples( |
| 314 associated_instance_.pp_instance(), | 315 associated_instance_.pp_instance(), |
| 315 decrypted_samples.pp_resource(), | 316 decrypted_samples.pp_resource(), |
| 316 &decrypted_block_info); | 317 &decrypted_block_info); |
| 317 } | 318 } |
| 318 } | 319 } |
| 319 | 320 |
| 320 } // namespace pp | 321 } // namespace pp |
| OLD | NEW |