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

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

Issue 11013052: Add PPAPI CDM video decoder initialization. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. 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 InitializeVideoDecoder(
109 PP_Instance instance,
110 const PP_VideoDecoderConfig* decoder_config,
111 PP_Resource extra_data_resource) {
112 void* object =
113 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface);
114 if (!object)
115 return;
116
117 pp::Buffer_Dev extra_data_buffer(pp::PASS_REF, extra_data_resource);
118
119 static_cast<ContentDecryptor_Private*>(object)->InitializeVideoDecoder(
120 *decoder_config,
121 extra_data_buffer);
122 }
123
124
108 void DecryptAndDecodeFrame( 125 void DecryptAndDecodeFrame(
109 PP_Instance instance, 126 PP_Instance instance,
110 PP_Resource encrypted_resource, 127 PP_Resource encrypted_resource,
111 const PP_EncryptedVideoFrameInfo* encrypted_video_frame_info) { 128 const PP_EncryptedVideoFrameInfo* encrypted_video_frame_info) {
112 void* object = 129 void* object =
113 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); 130 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface);
114 if (!object) 131 if (!object)
115 return; 132 return;
116 133
117 pp::Buffer_Dev encrypted_frame(pp::PassRef(), encrypted_resource); 134 pp::Buffer_Dev encrypted_frame(pp::PassRef(), encrypted_resource);
118 135
119 static_cast<ContentDecryptor_Private*>(object)->DecryptAndDecodeFrame( 136 static_cast<ContentDecryptor_Private*>(object)->DecryptAndDecodeFrame(
120 encrypted_frame, 137 encrypted_frame,
121 *encrypted_video_frame_info); 138 *encrypted_video_frame_info);
122 } 139 }
123 140
124 const PPP_ContentDecryptor_Private ppp_content_decryptor = { 141 const PPP_ContentDecryptor_Private ppp_content_decryptor = {
125 &GenerateKeyRequest, 142 &GenerateKeyRequest,
126 &AddKey, 143 &AddKey,
127 &CancelKeyRequest, 144 &CancelKeyRequest,
128 &Decrypt, 145 &Decrypt,
146 &InitializeVideoDecoder,
129 &DecryptAndDecodeFrame 147 &DecryptAndDecodeFrame
130 }; 148 };
131 149
132 template <> const char* interface_name<PPB_ContentDecryptor_Private>() { 150 template <> const char* interface_name<PPB_ContentDecryptor_Private>() {
133 return PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE; 151 return PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE;
134 } 152 }
135 153
136 } // namespace 154 } // namespace
137 155
138 ContentDecryptor_Private::ContentDecryptor_Private(Instance* instance) 156 ContentDecryptor_Private::ContentDecryptor_Private(Instance* instance)
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 pp::Buffer_Dev decrypted_block, 231 pp::Buffer_Dev decrypted_block,
214 const PP_DecryptedBlockInfo& decrypted_block_info) { 232 const PP_DecryptedBlockInfo& decrypted_block_info) {
215 if (has_interface<PPB_ContentDecryptor_Private>()) { 233 if (has_interface<PPB_ContentDecryptor_Private>()) {
216 get_interface<PPB_ContentDecryptor_Private>()->DeliverBlock( 234 get_interface<PPB_ContentDecryptor_Private>()->DeliverBlock(
217 associated_instance_.pp_instance(), 235 associated_instance_.pp_instance(),
218 decrypted_block.pp_resource(), 236 decrypted_block.pp_resource(),
219 &decrypted_block_info); 237 &decrypted_block_info);
220 } 238 }
221 } 239 }
222 240
241 void ContentDecryptor_Private::DecoderInitialized(
242 bool success,
243 uint32_t request_id) {
244 if (has_interface<PPB_ContentDecryptor_Private>()) {
245 get_interface<PPB_ContentDecryptor_Private>()->DecoderInitialized(
246 associated_instance_.pp_instance(),
247 PP_FromBool(success),
248 request_id);
249 }
250 }
251
223 void ContentDecryptor_Private::DeliverFrame( 252 void ContentDecryptor_Private::DeliverFrame(
224 pp::Buffer_Dev decrypted_frame, 253 pp::Buffer_Dev decrypted_frame,
225 const PP_DecryptedFrameInfo& decrypted_frame_info) { 254 const PP_DecryptedFrameInfo& decrypted_frame_info) {
226 if (has_interface<PPB_ContentDecryptor_Private>()) { 255 if (has_interface<PPB_ContentDecryptor_Private>()) {
227 get_interface<PPB_ContentDecryptor_Private>()->DeliverFrame( 256 get_interface<PPB_ContentDecryptor_Private>()->DeliverFrame(
228 associated_instance_.pp_instance(), 257 associated_instance_.pp_instance(),
229 decrypted_frame.pp_resource(), 258 decrypted_frame.pp_resource(),
230 &decrypted_frame_info); 259 &decrypted_frame_info);
231 } 260 }
232 } 261 }
233 262
234 void ContentDecryptor_Private::DeliverSamples( 263 void ContentDecryptor_Private::DeliverSamples(
235 pp::Buffer_Dev decrypted_samples, 264 pp::Buffer_Dev decrypted_samples,
236 const PP_DecryptedBlockInfo& decrypted_block_info) { 265 const PP_DecryptedBlockInfo& decrypted_block_info) {
237 if (has_interface<PPB_ContentDecryptor_Private>()) { 266 if (has_interface<PPB_ContentDecryptor_Private>()) {
238 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples( 267 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples(
239 associated_instance_.pp_instance(), 268 associated_instance_.pp_instance(),
240 decrypted_samples.pp_resource(), 269 decrypted_samples.pp_resource(),
241 &decrypted_block_info); 270 &decrypted_block_info);
242 } 271 }
243 } 272 }
244 273
245 } // namespace pp 274 } // 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