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

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

Issue 11087044: Generalize Pepper CDM API decrypt and decode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 DecryptAndDecodeFrame( 108 void DecryptAndDecode(PP_Instance instance,
109 PP_Instance instance, 109 PP_Resource encrypted_resource,
110 PP_Resource encrypted_resource, 110 const PP_EncryptedMediaInfo* encrypted_media_info) {
111 const PP_EncryptedVideoFrameInfo* encrypted_video_frame_info) {
112 void* object = 111 void* object =
113 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface); 112 Instance::GetPerInstanceObject(instance, kPPPContentDecryptorInterface);
114 if (!object) 113 if (!object)
115 return; 114 return;
116 115
117 pp::Buffer_Dev encrypted_frame(pp::PassRef(), encrypted_resource); 116 pp::Buffer_Dev encrypted_buffer(pp::PassRef(), encrypted_resource);
118 117
119 static_cast<ContentDecryptor_Private*>(object)->DecryptAndDecodeFrame( 118 static_cast<ContentDecryptor_Private*>(object)->DecryptAndDecode(
120 encrypted_frame, 119 encrypted_buffer,
121 *encrypted_video_frame_info); 120 *encrypted_media_info);
122 } 121 }
123 122
124 const PPP_ContentDecryptor_Private ppp_content_decryptor = { 123 const PPP_ContentDecryptor_Private ppp_content_decryptor = {
125 &GenerateKeyRequest, 124 &GenerateKeyRequest,
126 &AddKey, 125 &AddKey,
127 &CancelKeyRequest, 126 &CancelKeyRequest,
128 &Decrypt, 127 &Decrypt,
129 &DecryptAndDecodeFrame 128 &DecryptAndDecode
130 }; 129 };
131 130
132 template <> const char* interface_name<PPB_ContentDecryptor_Private>() { 131 template <> const char* interface_name<PPB_ContentDecryptor_Private>() {
133 return PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE; 132 return PPB_CONTENTDECRYPTOR_PRIVATE_INTERFACE;
134 } 133 }
135 134
136 } // namespace 135 } // namespace
137 136
138 ContentDecryptor_Private::ContentDecryptor_Private(Instance* instance) 137 ContentDecryptor_Private::ContentDecryptor_Private(Instance* instance)
139 : associated_instance_(instance) { 138 : associated_instance_(instance) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 const PP_DecryptedBlockInfo& decrypted_block_info) { 235 const PP_DecryptedBlockInfo& decrypted_block_info) {
237 if (has_interface<PPB_ContentDecryptor_Private>()) { 236 if (has_interface<PPB_ContentDecryptor_Private>()) {
238 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples( 237 get_interface<PPB_ContentDecryptor_Private>()->DeliverSamples(
239 associated_instance_.pp_instance(), 238 associated_instance_.pp_instance(),
240 decrypted_samples.pp_resource(), 239 decrypted_samples.pp_resource(),
241 &decrypted_block_info); 240 &decrypted_block_info);
242 } 241 }
243 } 242 }
244 243
245 } // namespace pp 244 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698