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/dev/content_decryptor_dev.h" | 5 #include "ppapi/cpp/dev/content_decryptor_dev.h" |
6 | 6 |
7 #include "ppapi/c/dev/ppb_content_decryptor_dev.h" | 7 #include "ppapi/c/dev/ppb_content_decryptor_dev.h" |
8 #include "ppapi/c/dev/ppp_content_decryptor_dev.h" | 8 #include "ppapi/c/dev/ppp_content_decryptor_dev.h" |
9 #include "ppapi/cpp/instance.h" | 9 #include "ppapi/cpp/instance.h" |
10 #include "ppapi/cpp/instance_handle.h" | 10 #include "ppapi/cpp/instance_handle.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 PP_Bool CancelKeyRequest(PP_Instance instance, | 45 PP_Bool CancelKeyRequest(PP_Instance instance, |
46 PP_Var session_id) { | 46 PP_Var session_id) { |
47 void* object = | 47 void* object = |
48 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); | 48 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); |
49 if (!object) | 49 if (!object) |
50 return PP_FALSE; | 50 return PP_FALSE; |
51 return PP_FromBool( | 51 return PP_FromBool( |
52 static_cast<ContentDecryptor_Dev*>(object)->CancelKeyRequest(session_id)); | 52 static_cast<ContentDecryptor_Dev*>(object)->CancelKeyRequest(session_id)); |
53 } | 53 } |
54 | 54 |
55 | |
56 PP_Bool Decrypt(PP_Instance instance, | 55 PP_Bool Decrypt(PP_Instance instance, |
57 PP_Resource encrypted_block, | 56 const struct PP_DecryptionBuffer_Dev* encrypted_buffer) { |
58 PP_CompletionCallback callback) { | |
59 void* object = | 57 void* object = |
60 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); | 58 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); |
61 if (!object) | 59 if (!object) |
62 return PP_FALSE; | 60 return PP_FALSE; |
| 61 if (!encrypted_buffer) |
| 62 return PP_FALSE; |
63 return PP_FromBool( | 63 return PP_FromBool( |
64 static_cast<ContentDecryptor_Dev*>(object)->Decrypt(encrypted_block, | 64 static_cast<ContentDecryptor_Dev*>(object)->Decrypt(*encrypted_buffer)); |
65 callback)); | |
66 } | 65 } |
67 | 66 |
68 PP_Bool DecryptAndDecode(PP_Instance instance, | 67 PP_Bool DecryptAndDecode(PP_Instance instance, |
69 PP_Resource encrypted_block, | 68 PP_Resource encrypted_block, |
70 PP_CompletionCallback callback) { | 69 PP_CompletionCallback callback) { |
71 void* object = | 70 void* object = |
72 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); | 71 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); |
73 if (!object) | 72 if (!object) |
74 return PP_FALSE; | 73 return PP_FALSE; |
75 return PP_FromBool( | 74 return PP_FromBool( |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 get_interface<PPB_ContentDecryptor_Dev>()->KeyError( | 143 get_interface<PPB_ContentDecryptor_Dev>()->KeyError( |
145 associated_instance_.pp_instance(), | 144 associated_instance_.pp_instance(), |
146 key_system, | 145 key_system, |
147 session_id, | 146 session_id, |
148 media_error, | 147 media_error, |
149 system_error); | 148 system_error); |
150 } | 149 } |
151 } | 150 } |
152 | 151 |
153 void ContentDecryptor_Dev::DeliverBlock(PP_Resource decrypted_block, | 152 void ContentDecryptor_Dev::DeliverBlock(PP_Resource decrypted_block, |
154 PP_CompletionCallback callback) { | 153 uint32_t id) { |
155 if (has_interface<PPB_ContentDecryptor_Dev>()) { | 154 if (has_interface<PPB_ContentDecryptor_Dev>()) { |
156 get_interface<PPB_ContentDecryptor_Dev>()->DeliverBlock( | 155 get_interface<PPB_ContentDecryptor_Dev>()->DeliverBlock( |
157 associated_instance_.pp_instance(), | 156 associated_instance_.pp_instance(), |
158 decrypted_block, | 157 decrypted_block, |
159 callback); | 158 id); |
160 } | 159 } |
161 } | 160 } |
162 | 161 |
163 void ContentDecryptor_Dev::DeliverFrame(PP_Resource decrypted_frame, | 162 void ContentDecryptor_Dev::DeliverFrame(PP_Resource decrypted_frame, |
164 PP_CompletionCallback callback) { | 163 PP_CompletionCallback callback) { |
165 if (has_interface<PPB_ContentDecryptor_Dev>()) { | 164 if (has_interface<PPB_ContentDecryptor_Dev>()) { |
166 get_interface<PPB_ContentDecryptor_Dev>()->DeliverFrame( | 165 get_interface<PPB_ContentDecryptor_Dev>()->DeliverFrame( |
167 associated_instance_.pp_instance(), | 166 associated_instance_.pp_instance(), |
168 decrypted_frame, | 167 decrypted_frame, |
169 callback); | 168 callback); |
170 } | 169 } |
171 } | 170 } |
172 | 171 |
173 void ContentDecryptor_Dev::DeliverSamples(PP_Resource decrypted_samples, | 172 void ContentDecryptor_Dev::DeliverSamples(PP_Resource decrypted_samples, |
174 PP_CompletionCallback callback) { | 173 PP_CompletionCallback callback) { |
175 if (has_interface<PPB_ContentDecryptor_Dev>()) { | 174 if (has_interface<PPB_ContentDecryptor_Dev>()) { |
176 get_interface<PPB_ContentDecryptor_Dev>()->DeliverSamples( | 175 get_interface<PPB_ContentDecryptor_Dev>()->DeliverSamples( |
177 associated_instance_.pp_instance(), | 176 associated_instance_.pp_instance(), |
178 decrypted_samples, | 177 decrypted_samples, |
179 callback); | 178 callback); |
180 } | 179 } |
181 } | 180 } |
182 | 181 |
183 } // namespace pp | 182 } // namespace pp |
OLD | NEW |