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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 pp::Var init_data_var(pp::PASS_REF, init_data_arg); | 54 pp::Var init_data_var(pp::PASS_REF, init_data_arg); |
55 if (!init_data_var.is_array_buffer()) | 55 if (!init_data_var.is_array_buffer()) |
56 return; | 56 return; |
57 pp::VarArrayBuffer init_data_array_buffer(init_data_var); | 57 pp::VarArrayBuffer init_data_array_buffer(init_data_var); |
58 | 58 |
59 static_cast<ContentDecryptor_Private*>(object) | 59 static_cast<ContentDecryptor_Private*>(object) |
60 ->CreateSession(session_id, type_var.AsString(), init_data_array_buffer); | 60 ->CreateSession(session_id, type_var.AsString(), init_data_array_buffer); |
61 } | 61 } |
62 | 62 |
| 63 void LoadSession(PP_Instance instance, |
| 64 uint32_t session_id, |
| 65 PP_Var web_session_id_arg) { |
| 66 void* object = |
| 67 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); |
| 68 if (!object) |
| 69 return; |
| 70 |
| 71 pp::Var web_session_id_var(pp::PASS_REF, web_session_id_arg); |
| 72 if (!web_session_id_var.is_string()) |
| 73 return; |
| 74 |
| 75 static_cast<ContentDecryptor_Private*>(object) |
| 76 ->LoadSession(session_id, web_session_id_var.AsString()); |
| 77 } |
| 78 |
63 void UpdateSession(PP_Instance instance, | 79 void UpdateSession(PP_Instance instance, |
64 uint32_t session_id, | 80 uint32_t session_id, |
65 PP_Var response_arg) { | 81 PP_Var response_arg) { |
66 void* object = | 82 void* object = |
67 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); | 83 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); |
68 if (!object) | 84 if (!object) |
69 return; | 85 return; |
70 | 86 |
71 pp::Var response_var(pp::PASS_REF, response_arg); | 87 pp::Var response_var(pp::PASS_REF, response_arg); |
72 if (!response_var.is_array_buffer()) | 88 if (!response_var.is_array_buffer()) |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 186 |
171 static_cast<ContentDecryptor_Private*>(object)->DecryptAndDecode( | 187 static_cast<ContentDecryptor_Private*>(object)->DecryptAndDecode( |
172 decoder_type, | 188 decoder_type, |
173 encrypted_buffer, | 189 encrypted_buffer, |
174 *encrypted_block_info); | 190 *encrypted_block_info); |
175 } | 191 } |
176 | 192 |
177 const PPP_ContentDecryptor_Private ppp_content_decryptor = { | 193 const PPP_ContentDecryptor_Private ppp_content_decryptor = { |
178 &Initialize, | 194 &Initialize, |
179 &CreateSession, | 195 &CreateSession, |
| 196 &LoadSession, |
180 &UpdateSession, | 197 &UpdateSession, |
181 &ReleaseSession, | 198 &ReleaseSession, |
182 &Decrypt, | 199 &Decrypt, |
183 &InitializeAudioDecoder, | 200 &InitializeAudioDecoder, |
184 &InitializeVideoDecoder, | 201 &InitializeVideoDecoder, |
185 &DeinitializeDecoder, | 202 &DeinitializeDecoder, |
186 &ResetDecoder, | 203 &ResetDecoder, |
187 &DecryptAndDecode | 204 &DecryptAndDecode |
188 }; | 205 }; |
189 | 206 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 const PP_DecryptedSampleInfo& decrypted_sample_info) { | 336 const PP_DecryptedSampleInfo& decrypted_sample_info) { |
320 if (has_interface<PPB_ContentDecryptor_Private>()) { | 337 if (has_interface<PPB_ContentDecryptor_Private>()) { |
321 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples( | 338 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples( |
322 associated_instance_.pp_instance(), | 339 associated_instance_.pp_instance(), |
323 audio_frames.pp_resource(), | 340 audio_frames.pp_resource(), |
324 &decrypted_sample_info); | 341 &decrypted_sample_info); |
325 } | 342 } |
326 } | 343 } |
327 | 344 |
328 } // namespace pp | 345 } // namespace pp |
OLD | NEW |