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

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: Address comments with the exception of renaming Deinit 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 if (!object) 114 if (!object)
115 return; 115 return;
116 116
117 pp::Buffer_Dev extra_data_buffer(pp::PASS_REF, extra_data_resource); 117 pp::Buffer_Dev extra_data_buffer(pp::PASS_REF, extra_data_resource);
118 118
119 static_cast<ContentDecryptor_Private*>(object)->InitializeVideoDecoder( 119 static_cast<ContentDecryptor_Private*>(object)->InitializeVideoDecoder(
120 *decoder_config, 120 *decoder_config,
121 extra_data_buffer); 121 extra_data_buffer);
122 } 122 }
123 123
124 void DeinitializeDecoder(PP_Instance instance,
125 PP_DecryptorStreamType decoder_type,
126 uint32_t request_id) {
127 void* object =
128 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface);
129 if (!object)
130 return;
131 static_cast<ContentDecryptor_Private*>(object)->DeinitializeDecoder(
132 decoder_type,
133 request_id);
134 }
135
136 void ResetDecoder(PP_Instance instance,
137 PP_DecryptorStreamType decoder_type,
138 uint32_t request_id) {
139 void* object =
140 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface);
141 if (!object)
142 return;
143 static_cast<ContentDecryptor_Private*>(object)->ResetDecoder(decoder_type,
144 request_id);
145 }
124 146
125 void DecryptAndDecodeFrame( 147 void DecryptAndDecodeFrame(
126 PP_Instance instance, 148 PP_Instance instance,
127 PP_Resource encrypted_resource, 149 PP_Resource encrypted_resource,
128 const PP_EncryptedVideoFrameInfo* encrypted_video_frame_info) { 150 const PP_EncryptedVideoFrameInfo* encrypted_video_frame_info) {
129 void* object = 151 void* object =
130 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); 152 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface);
131 if (!object) 153 if (!object)
132 return; 154 return;
133 155
134 pp::Buffer_Dev encrypted_frame(pp::PassRef(), encrypted_resource); 156 pp::Buffer_Dev encrypted_frame(pp::PassRef(), encrypted_resource);
135 157
136 static_cast<ContentDecryptor_Private*>(object)->DecryptAndDecodeFrame( 158 static_cast<ContentDecryptor_Private*>(object)->DecryptAndDecodeFrame(
137 encrypted_frame, 159 encrypted_frame,
138 *encrypted_video_frame_info); 160 *encrypted_video_frame_info);
139 } 161 }
140 162
141 const PPP_ContentDecryptor_Private ppp_content_decryptor = { 163 const PPP_ContentDecryptor_Private ppp_content_decryptor = {
142 &GenerateKeyRequest, 164 &GenerateKeyRequest,
143 &AddKey, 165 &AddKey,
144 &CancelKeyRequest, 166 &CancelKeyRequest,
145 &Decrypt, 167 &Decrypt,
146 &InitializeVideoDecoder, 168 &InitializeVideoDecoder,
169 &DeinitializeDecoder,
170 &ResetDecoder,
147 &DecryptAndDecodeFrame 171 &DecryptAndDecodeFrame
148 }; 172 };
149 173
150 template <> const char* interface_name<PPB_ContentDecryptor_Private>() { 174 template <> const char* interface_name<PPB_ContentDecryptor_Private>() {
151 return PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE; 175 return PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE;
152 } 176 }
153 177
154 } // namespace 178 } // namespace
155 179
156 ContentDecryptor_Private::ContentDecryptor_Private(Instance* instance) 180 ContentDecryptor_Private::ContentDecryptor_Private(Instance* instance)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 bool success, 266 bool success,
243 uint32_t request_id) { 267 uint32_t request_id) {
244 if (has_interface<PPB_ContentDecryptor_Private>()) { 268 if (has_interface<PPB_ContentDecryptor_Private>()) {
245 get_interface<PPB_ContentDecryptor_Private>()->DecoderInitialized( 269 get_interface<PPB_ContentDecryptor_Private>()->DecoderInitialized(
246 associated_instance_.pp_instance(), 270 associated_instance_.pp_instance(),
247 PP_FromBool(success), 271 PP_FromBool(success),
248 request_id); 272 request_id);
249 } 273 }
250 } 274 }
251 275
276 void ContentDecryptor_Private::DecoderDeinitializeDone(
277 PP_DecryptorStreamType decoder_type,
278 uint32_t request_id) {
279 if (has_interface<PPB_ContentDecryptor_Private>()) {
280 get_interface<PPB_ContentDecryptor_Private>()->DecoderDeinitializeDone(
281 associated_instance_.pp_instance(),
282 decoder_type,
283 request_id);
284 }
285 }
286
287 void ContentDecryptor_Private::DecoderResetDone(
288 PP_DecryptorStreamType decoder_type,
289 uint32_t request_id) {
290 if (has_interface<PPB_ContentDecryptor_Private>()) {
291 get_interface<PPB_ContentDecryptor_Private>()->DecoderResetDone(
292 associated_instance_.pp_instance(),
293 decoder_type,
294 request_id);
295 }
296 }
297
252 void ContentDecryptor_Private::DeliverFrame( 298 void ContentDecryptor_Private::DeliverFrame(
253 pp::Buffer_Dev decrypted_frame, 299 pp::Buffer_Dev decrypted_frame,
254 const PP_DecryptedFrameInfo& decrypted_frame_info) { 300 const PP_DecryptedFrameInfo& decrypted_frame_info) {
255 if (has_interface<PPB_ContentDecryptor_Private>()) { 301 if (has_interface<PPB_ContentDecryptor_Private>()) {
256 get_interface<PPB_ContentDecryptor_Private>()->DeliverFrame( 302 get_interface<PPB_ContentDecryptor_Private>()->DeliverFrame(
257 associated_instance_.pp_instance(), 303 associated_instance_.pp_instance(),
258 decrypted_frame.pp_resource(), 304 decrypted_frame.pp_resource(),
259 &decrypted_frame_info); 305 &decrypted_frame_info);
260 } 306 }
261 } 307 }
262 308
263 void ContentDecryptor_Private::DeliverSamples( 309 void ContentDecryptor_Private::DeliverSamples(
264 pp::Buffer_Dev decrypted_samples, 310 pp::Buffer_Dev decrypted_samples,
265 const PP_DecryptedBlockInfo& decrypted_block_info) { 311 const PP_DecryptedBlockInfo& decrypted_block_info) {
266 if (has_interface<PPB_ContentDecryptor_Private>()) { 312 if (has_interface<PPB_ContentDecryptor_Private>()) {
267 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples( 313 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples(
268 associated_instance_.pp_instance(), 314 associated_instance_.pp_instance(),
269 decrypted_samples.pp_resource(), 315 decrypted_samples.pp_resource(),
270 &decrypted_block_info); 316 &decrypted_block_info);
271 } 317 }
272 } 318 }
273 319
274 } // namespace pp 320 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/private/content_decryptor_private.h ('k') | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698