| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/formats/webm/webm_cluster_parser.h" | 5 #include "media/formats/webm/webm_cluster_parser.h" |
| 6 | 6 |
| 7 #include <memory> |
| 7 #include <utility> | 8 #include <utility> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/logging.h" | 11 #include "base/logging.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/sys_byteorder.h" | 13 #include "base/sys_byteorder.h" |
| 13 #include "media/base/decrypt_config.h" | 14 #include "media/base/decrypt_config.h" |
| 14 #include "media/base/timestamp_constants.h" | 15 #include "media/base/timestamp_constants.h" |
| 15 #include "media/filters/webvtt_util.h" | 16 #include "media/filters/webvtt_util.h" |
| 16 #include "media/formats/webm/webm_constants.h" | 17 #include "media/formats/webm/webm_constants.h" |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 // The first bit of the flags is set when a SimpleBlock contains only | 479 // The first bit of the flags is set when a SimpleBlock contains only |
| 479 // keyframes. If this is a Block, then inspection of the payload is | 480 // keyframes. If this is a Block, then inspection of the payload is |
| 480 // necessary to determine whether it contains a keyframe or not. | 481 // necessary to determine whether it contains a keyframe or not. |
| 481 // http://www.matroska.org/technical/specs/index.html | 482 // http://www.matroska.org/technical/specs/index.html |
| 482 bool is_keyframe = | 483 bool is_keyframe = |
| 483 is_simple_block ? (flags & 0x80) != 0 : track->IsKeyframe(data, size); | 484 is_simple_block ? (flags & 0x80) != 0 : track->IsKeyframe(data, size); |
| 484 | 485 |
| 485 // Every encrypted Block has a signal byte and IV prepended to it. Current | 486 // Every encrypted Block has a signal byte and IV prepended to it. Current |
| 486 // encrypted WebM request for comments specification is here | 487 // encrypted WebM request for comments specification is here |
| 487 // http://wiki.webmproject.org/encryption/webm-encryption-rfc | 488 // http://wiki.webmproject.org/encryption/webm-encryption-rfc |
| 488 scoped_ptr<DecryptConfig> decrypt_config; | 489 std::unique_ptr<DecryptConfig> decrypt_config; |
| 489 int data_offset = 0; | 490 int data_offset = 0; |
| 490 if (!encryption_key_id.empty() && | 491 if (!encryption_key_id.empty() && |
| 491 !WebMCreateDecryptConfig( | 492 !WebMCreateDecryptConfig( |
| 492 data, size, | 493 data, size, |
| 493 reinterpret_cast<const uint8_t*>(encryption_key_id.data()), | 494 reinterpret_cast<const uint8_t*>(encryption_key_id.data()), |
| 494 encryption_key_id.size(), | 495 encryption_key_id.size(), |
| 495 &decrypt_config, &data_offset)) { | 496 &decrypt_config, &data_offset)) { |
| 496 return false; | 497 return false; |
| 497 } | 498 } |
| 498 | 499 |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 WebMClusterParser::FindTextTrack(int track_num) { | 878 WebMClusterParser::FindTextTrack(int track_num) { |
| 878 const TextTrackMap::iterator it = text_track_map_.find(track_num); | 879 const TextTrackMap::iterator it = text_track_map_.find(track_num); |
| 879 | 880 |
| 880 if (it == text_track_map_.end()) | 881 if (it == text_track_map_.end()) |
| 881 return NULL; | 882 return NULL; |
| 882 | 883 |
| 883 return &it->second; | 884 return &it->second; |
| 884 } | 885 } |
| 885 | 886 |
| 886 } // namespace media | 887 } // namespace media |
| OLD | NEW |