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

Side by Side Diff: webkit/media/crypto/ppapi/clear_key_cdm.cc

Issue 10899021: Add CDM video decoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compiles, does nothing. Created 8 years, 3 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 "webkit/media/crypto/ppapi/clear_key_cdm.h" 5 #include "webkit/media/crypto/ppapi/clear_key_cdm.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "media/base/decoder_buffer.h" 12 #include "media/base/decoder_buffer.h"
13 #include "webkit/media/crypto/decoders/ffmpeg_video_decoder.h"
13 14
14 static const char kClearKeyCdmVersion[] = "0.1.0.0"; 15 static const char kClearKeyCdmVersion[] = "0.1.0.0";
15 16
16 static scoped_refptr<media::DecoderBuffer> CopyDecoderBufferFrom( 17 static scoped_refptr<media::DecoderBuffer> CopyDecoderBufferFrom(
17 const cdm::InputBuffer& input_buffer) { 18 const cdm::InputBuffer& input_buffer) {
18 scoped_refptr<media::DecoderBuffer> output_buffer = 19 scoped_refptr<media::DecoderBuffer> output_buffer =
19 media::DecoderBuffer::CopyFrom(input_buffer.data, input_buffer.data_size); 20 media::DecoderBuffer::CopyFrom(input_buffer.data, input_buffer.data_size);
20 21
21 std::vector<media::SubsampleEntry> subsamples; 22 std::vector<media::SubsampleEntry> subsamples;
22 for (uint32_t i = 0; i < input_buffer.num_subsamples; ++i) { 23 for (uint32_t i = 0; i < input_buffer.num_subsamples; ++i) {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 182
182 static void CopyDecryptResults( 183 static void CopyDecryptResults(
183 media::Decryptor::Status* status_copy, 184 media::Decryptor::Status* status_copy,
184 scoped_refptr<media::DecoderBuffer>* buffer_copy, 185 scoped_refptr<media::DecoderBuffer>* buffer_copy,
185 media::Decryptor::Status status, 186 media::Decryptor::Status status,
186 const scoped_refptr<media::DecoderBuffer>& buffer) { 187 const scoped_refptr<media::DecoderBuffer>& buffer) {
187 *status_copy = status; 188 *status_copy = status;
188 *buffer_copy = buffer; 189 *buffer_copy = buffer;
189 } 190 }
190 191
192 cdm::Status ClearKeyCdm::InitializeVideoDecoder(
193 const cdm::VideoDecoderConfig& video_decoder_config) {
194 video_decoder_.reset(new webkit_media::FFmpegVideoDecoder);
195 //video_decoder_->Initialize();
196 return cdm::kErrorUnknown;
197 }
198
191 cdm::Status ClearKeyCdm::Decrypt( 199 cdm::Status ClearKeyCdm::Decrypt(
192 const cdm::InputBuffer& encrypted_buffer, 200 const cdm::InputBuffer& encrypted_buffer,
193 cdm::OutputBuffer* decrypted_buffer) { 201 cdm::OutputBuffer* decrypted_buffer) {
194 DVLOG(1) << "Decrypt()"; 202 DVLOG(1) << "Decrypt()";
195 203
196 scoped_refptr<media::DecoderBuffer> decoder_buffer = 204 scoped_refptr<media::DecoderBuffer> decoder_buffer =
197 CopyDecoderBufferFrom(encrypted_buffer); 205 CopyDecoderBufferFrom(encrypted_buffer);
198 206
199 // Callback is called synchronously, so we can use variables on the stack. 207 // Callback is called synchronously, so we can use variables on the stack.
200 media::Decryptor::Status status; 208 media::Decryptor::Status status;
201 scoped_refptr<media::DecoderBuffer> buffer; 209 scoped_refptr<media::DecoderBuffer> buffer;
202 decryptor_.Decrypt(decoder_buffer, 210 decryptor_.Decrypt(decoder_buffer,
203 base::Bind(&CopyDecryptResults, &status, &buffer)); 211 base::Bind(&CopyDecryptResults, &status, &buffer));
204 212
205 if (status == media::Decryptor::kError) 213 if (status == media::Decryptor::kError)
206 return cdm::kErrorUnknown; 214 return cdm::kErrorUnknown;
207 215
208 if (status == media::Decryptor::kNoKey) 216 if (status == media::Decryptor::kNoKey)
209 return cdm::kErrorNoKey; 217 return cdm::kErrorNoKey;
210 218
211 DCHECK(buffer); 219 DCHECK(buffer);
212 int data_size = buffer->GetDataSize(); 220 int data_size = buffer->GetDataSize();
213 decrypted_buffer->data = AllocateAndCopy(buffer->GetData(), data_size); 221 decrypted_buffer->data = AllocateAndCopy(buffer->GetData(), data_size);
214 decrypted_buffer->data_size = data_size; 222 decrypted_buffer->data_size = data_size;
215 decrypted_buffer->timestamp = buffer->GetTimestamp().InMicroseconds(); 223 decrypted_buffer->timestamp = buffer->GetTimestamp().InMicroseconds();
216 return cdm::kSuccess; 224 return cdm::kSuccess;
217 } 225 }
218 226
227 cdm::Status ClearKeyCdm::DecryptAndDecode(
228 const cdm::InputBuffer& encrypted_buffer,
229 cdm::VideoFrame* video_frame) {
230 return cdm::kErrorUnknown;
231 }
232
219 } // namespace webkit_media 233 } // namespace webkit_media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698