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

Side by Side Diff: ppapi/cpp/private/content_decryptor_private.cc

Issue 11028087: Add decoder de-initialize and reset to the Pepper CDM API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renaming and generalizing done... 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 "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
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 DeinitializeDecoder(PP_Instance instance,
109 PP_StreamType decoder_type,
110 uint32_t request_id) {
111 void* object =
112 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface);
113 if (!object)
114 return;
115 static_cast<ContentDecryptor_Private*>(object)->DeinitializeDecoder(
116 decoder_type,
117 request_id);
118 }
119
120 void ResetDecoder(PP_Instance instance,
121 PP_StreamType decoder_type,
122 uint32_t request_id) {
123 void* object =
124 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface);
125 if (!object)
126 return;
127 static_cast<ContentDecryptor_Private*>(object)->ResetDecoder(decoder_type,
128 request_id);
129 }
130
108 void DecryptAndDecodeFrame( 131 void DecryptAndDecodeFrame(
109 PP_Instance instance, 132 PP_Instance instance,
110 PP_Resource encrypted_resource, 133 PP_Resource encrypted_resource,
111 const PP_EncryptedVideoFrameInfo* encrypted_video_frame_info) { 134 const PP_EncryptedVideoFrameInfo* encrypted_video_frame_info) {
112 void* object = 135 void* object =
113 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); 136 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface);
114 if (!object) 137 if (!object)
115 return; 138 return;
116 139
117 pp::Buffer_Dev encrypted_frame(pp::PassRef(), encrypted_resource); 140 pp::Buffer_Dev encrypted_frame(pp::PassRef(), encrypted_resource);
118 141
119 static_cast<ContentDecryptor_Private*>(object)->DecryptAndDecodeFrame( 142 static_cast<ContentDecryptor_Private*>(object)->DecryptAndDecodeFrame(
120 encrypted_frame, 143 encrypted_frame,
121 *encrypted_video_frame_info); 144 *encrypted_video_frame_info);
122 } 145 }
123 146
124 const PPP_ContentDecryptor_Private ppp_content_decryptor = { 147 const PPP_ContentDecryptor_Private ppp_content_decryptor = {
125 &GenerateKeyRequest, 148 &GenerateKeyRequest,
126 &AddKey, 149 &AddKey,
127 &CancelKeyRequest, 150 &CancelKeyRequest,
128 &Decrypt, 151 &Decrypt,
152 &DeinitializeDecoder,
153 &ResetDecoder,
129 &DecryptAndDecodeFrame 154 &DecryptAndDecodeFrame
130 }; 155 };
131 156
132 template <> const char* interface_name<PPB_ContentDecryptor_Private>() { 157 template <> const char* interface_name<PPB_ContentDecryptor_Private>() {
133 return PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE; 158 return PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE;
134 } 159 }
135 160
136 } // namespace 161 } // namespace
137 162
138 ContentDecryptor_Private::ContentDecryptor_Private(Instance* instance) 163 ContentDecryptor_Private::ContentDecryptor_Private(Instance* instance)
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 pp::Buffer_Dev decrypted_block, 238 pp::Buffer_Dev decrypted_block,
214 const PP_DecryptedBlockInfo& decrypted_block_info) { 239 const PP_DecryptedBlockInfo& decrypted_block_info) {
215 if (has_interface<PPB_ContentDecryptor_Private>()) { 240 if (has_interface<PPB_ContentDecryptor_Private>()) {
216 get_interface<PPB_ContentDecryptor_Private>()->DeliverBlock( 241 get_interface<PPB_ContentDecryptor_Private>()->DeliverBlock(
217 associated_instance_.pp_instance(), 242 associated_instance_.pp_instance(),
218 decrypted_block.pp_resource(), 243 decrypted_block.pp_resource(),
219 &decrypted_block_info); 244 &decrypted_block_info);
220 } 245 }
221 } 246 }
222 247
248 void ContentDecryptor_Private::DecoderDeinitializeDone(
249 PP_StreamType decoder_type,
250 uint32_t request_id) {
251 if (has_interface<PPB_ContentDecryptor_Private>()) {
252 get_interface<PPB_ContentDecryptor_Private>()->DecoderDeinitializeDone(
253 associated_instance_.pp_instance(),
254 decoder_type,
255 request_id);
256 }
257 }
258
259 void ContentDecryptor_Private::DecoderResetDone(PP_StreamType decoder_type,
260 uint32_t request_id) {
261 if (has_interface<PPB_ContentDecryptor_Private>()) {
262 get_interface<PPB_ContentDecryptor_Private>()->DecoderResetDone(
263 associated_instance_.pp_instance(),
264 decoder_type,
265 request_id);
266 }
267 }
268
223 void ContentDecryptor_Private::DeliverFrame( 269 void ContentDecryptor_Private::DeliverFrame(
224 pp::Buffer_Dev decrypted_frame, 270 pp::Buffer_Dev decrypted_frame,
225 const PP_DecryptedFrameInfo& decrypted_frame_info) { 271 const PP_DecryptedFrameInfo& decrypted_frame_info) {
226 if (has_interface<PPB_ContentDecryptor_Private>()) { 272 if (has_interface<PPB_ContentDecryptor_Private>()) {
227 get_interface<PPB_ContentDecryptor_Private>()->DeliverFrame( 273 get_interface<PPB_ContentDecryptor_Private>()->DeliverFrame(
228 associated_instance_.pp_instance(), 274 associated_instance_.pp_instance(),
229 decrypted_frame.pp_resource(), 275 decrypted_frame.pp_resource(),
230 &decrypted_frame_info); 276 &decrypted_frame_info);
231 } 277 }
232 } 278 }
233 279
234 void ContentDecryptor_Private::DeliverSamples( 280 void ContentDecryptor_Private::DeliverSamples(
235 pp::Buffer_Dev decrypted_samples, 281 pp::Buffer_Dev decrypted_samples,
236 const PP_DecryptedBlockInfo& decrypted_block_info) { 282 const PP_DecryptedBlockInfo& decrypted_block_info) {
237 if (has_interface<PPB_ContentDecryptor_Private>()) { 283 if (has_interface<PPB_ContentDecryptor_Private>()) {
238 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples( 284 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples(
239 associated_instance_.pp_instance(), 285 associated_instance_.pp_instance(),
240 decrypted_samples.pp_resource(), 286 decrypted_samples.pp_resource(),
241 &decrypted_block_info); 287 &decrypted_block_info);
242 } 288 }
243 } 289 }
244 290
245 } // namespace pp 291 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698