OLD | NEW |
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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/sys_byteorder.h" | 10 #include "base/sys_byteorder.h" |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 // Every encrypted Block has a signal byte and IV prepended to it. Current | 329 // Every encrypted Block has a signal byte and IV prepended to it. Current |
330 // encrypted WebM request for comments specification is here | 330 // encrypted WebM request for comments specification is here |
331 // http://wiki.webmproject.org/encryption/webm-encryption-rfc | 331 // http://wiki.webmproject.org/encryption/webm-encryption-rfc |
332 if (!encryption_key_id.empty()) { | 332 if (!encryption_key_id.empty()) { |
333 scoped_ptr<DecryptConfig> config(WebMCreateDecryptConfig( | 333 scoped_ptr<DecryptConfig> config(WebMCreateDecryptConfig( |
334 data, size, | 334 data, size, |
335 reinterpret_cast<const uint8*>(encryption_key_id.data()), | 335 reinterpret_cast<const uint8*>(encryption_key_id.data()), |
336 encryption_key_id.size())); | 336 encryption_key_id.size())); |
337 if (!config) | 337 if (!config) |
338 return false; | 338 return false; |
339 buffer->SetDecryptConfig(config.Pass()); | 339 buffer->set_decrypt_config(config.Pass()); |
340 } | 340 } |
341 | 341 |
342 buffer->SetTimestamp(timestamp); | 342 buffer->set_timestamp(timestamp); |
343 if (cluster_start_time_ == kNoTimestamp()) | 343 if (cluster_start_time_ == kNoTimestamp()) |
344 cluster_start_time_ = timestamp; | 344 cluster_start_time_ = timestamp; |
345 | 345 |
346 if (block_duration >= 0) { | 346 if (block_duration >= 0) { |
347 buffer->SetDuration(base::TimeDelta::FromMicroseconds( | 347 buffer->set_duration(base::TimeDelta::FromMicroseconds( |
348 block_duration * timecode_multiplier_)); | 348 block_duration * timecode_multiplier_)); |
349 } | 349 } |
350 | 350 |
351 return track->AddBuffer(buffer); | 351 return track->AddBuffer(buffer); |
352 } | 352 } |
353 | 353 |
354 WebMClusterParser::Track::Track(int track_num, bool is_video) | 354 WebMClusterParser::Track::Track(int track_num, bool is_video) |
355 : track_num_(track_num), | 355 : track_num_(track_num), |
356 is_video_(is_video) { | 356 is_video_(is_video) { |
357 } | 357 } |
358 | 358 |
359 WebMClusterParser::Track::~Track() {} | 359 WebMClusterParser::Track::~Track() {} |
360 | 360 |
361 bool WebMClusterParser::Track::AddBuffer( | 361 bool WebMClusterParser::Track::AddBuffer( |
362 const scoped_refptr<StreamParserBuffer>& buffer) { | 362 const scoped_refptr<StreamParserBuffer>& buffer) { |
363 DVLOG(2) << "AddBuffer() : " << track_num_ | 363 DVLOG(2) << "AddBuffer() : " << track_num_ |
364 << " ts " << buffer->GetTimestamp().InSecondsF() | 364 << " ts " << buffer->timestamp().InSecondsF() |
365 << " dur " << buffer->GetDuration().InSecondsF() | 365 << " dur " << buffer->duration().InSecondsF() |
366 << " kf " << buffer->IsKeyframe() | 366 << " kf " << buffer->IsKeyframe() |
367 << " size " << buffer->GetDataSize(); | 367 << " size " << buffer->data_size(); |
368 | 368 |
369 buffers_.push_back(buffer); | 369 buffers_.push_back(buffer); |
370 return true; | 370 return true; |
371 } | 371 } |
372 | 372 |
373 void WebMClusterParser::Track::Reset() { | 373 void WebMClusterParser::Track::Reset() { |
374 buffers_.clear(); | 374 buffers_.clear(); |
375 } | 375 } |
376 | 376 |
377 bool WebMClusterParser::Track::IsKeyframe(const uint8* data, int size) const { | 377 bool WebMClusterParser::Track::IsKeyframe(const uint8* data, int size) const { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 WebMClusterParser::FindTextTrack(int track_num) { | 409 WebMClusterParser::FindTextTrack(int track_num) { |
410 const TextTrackMap::iterator it = text_track_map_.find(track_num); | 410 const TextTrackMap::iterator it = text_track_map_.find(track_num); |
411 | 411 |
412 if (it == text_track_map_.end()) | 412 if (it == text_track_map_.end()) |
413 return NULL; | 413 return NULL; |
414 | 414 |
415 return &it->second; | 415 return &it->second; |
416 } | 416 } |
417 | 417 |
418 } // namespace media | 418 } // namespace media |
OLD | NEW |