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

Side by Side Diff: media/webm/webm_cluster_parser.cc

Issue 10651006: Add Common Encryption support to BMFF, including subsample decryption. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Convert key_id to string Created 8 years, 5 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
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 "media/webm/webm_cluster_parser.h" 5 #include "media/webm/webm_cluster_parser.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/sys_byteorder.h" 8 #include "base/sys_byteorder.h"
9 #include "media/base/data_buffer.h" 9 #include "media/base/data_buffer.h"
10 #include "media/base/decrypt_config.h" 10 #include "media/base/decrypt_config.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 scoped_refptr<StreamParserBuffer> buffer = 228 scoped_refptr<StreamParserBuffer> buffer =
229 StreamParserBuffer::CopyFrom(data + offset, size - offset, is_keyframe); 229 StreamParserBuffer::CopyFrom(data + offset, size - offset, is_keyframe);
230 230
231 if (encrypted) { 231 if (encrypted) {
232 uint64 network_iv; 232 uint64 network_iv;
233 memcpy(&network_iv, data + kWebMHmacSize, sizeof(network_iv)); 233 memcpy(&network_iv, data + kWebMHmacSize, sizeof(network_iv));
234 const uint64 iv = base::NetToHost64(network_iv); 234 const uint64 iv = base::NetToHost64(network_iv);
235 235
236 scoped_array<uint8> counter_block(GenerateCounterBlock(iv)); 236 scoped_array<uint8> counter_block(GenerateCounterBlock(iv));
237 buffer->SetDecryptConfig(scoped_ptr<DecryptConfig>(new DecryptConfig( 237 buffer->SetDecryptConfig(scoped_ptr<DecryptConfig>(new DecryptConfig(
238 video_encryption_key_id_.get(), video_encryption_key_id_size_, 238 std::string(video_encryption_key_id_.get(),
239 counter_block.get(), DecryptConfig::kDecryptionKeySize, 239 video_encryption_key_id_.get() +
240 data, kWebMHmacSize, 240 video_encryption_key_id_size_),
241 sizeof(iv)))); 241 std::string(counter_block.get(),
242 counter_block.get() + DecryptConfig::kDecryptionKeySize),
243 std::string(data, data + kWebMHmacSize),
244 sizeof(iv),
245 std::vector<SubsampleEntry>())));
242 } 246 }
243 247
244 buffer->SetTimestamp(timestamp); 248 buffer->SetTimestamp(timestamp);
245 if (cluster_start_time_ == kNoTimestamp()) 249 if (cluster_start_time_ == kNoTimestamp())
246 cluster_start_time_ = timestamp; 250 cluster_start_time_ = timestamp;
247 251
248 if (block_duration >= 0) { 252 if (block_duration >= 0) {
249 buffer->SetDuration(base::TimeDelta::FromMicroseconds( 253 buffer->SetDuration(base::TimeDelta::FromMicroseconds(
250 block_duration * timecode_multiplier_)); 254 block_duration * timecode_multiplier_));
251 } 255 }
(...skipping 24 matching lines...) Expand all
276 280
277 buffers_.push_back(buffer); 281 buffers_.push_back(buffer);
278 return true; 282 return true;
279 } 283 }
280 284
281 void WebMClusterParser::Track::Reset() { 285 void WebMClusterParser::Track::Reset() {
282 buffers_.clear(); 286 buffers_.clear();
283 } 287 }
284 288
285 } // namespace media 289 } // namespace media
OLDNEW
« media/mp4/track_run_iterator.cc ('K') | « media/mp4/track_run_iterator_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698