| 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/mp4/box_reader.h" | 5 #include "media/formats/mp4/box_reader.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 *err = true; | 150 *err = true; |
| 151 return false; | 151 return false; |
| 152 } | 152 } |
| 153 *type = reader.type(); | 153 *type = reader.type(); |
| 154 *box_size = reader.box_size(); | 154 *box_size = reader.box_size(); |
| 155 return true; | 155 return true; |
| 156 } | 156 } |
| 157 | 157 |
| 158 // static | 158 // static |
| 159 BoxReader* BoxReader::ReadConcatentatedBoxes(const uint8_t* buf, | 159 BoxReader* BoxReader::ReadConcatentatedBoxes(const uint8_t* buf, |
| 160 const size_t buf_size) { | 160 const size_t buf_size, |
| 161 // TODO(wolenetz): Questionable MediaLog usage, http://crbug.com/712310 | 161 MediaLog* media_log) { |
| 162 MediaLog media_log; | 162 BoxReader* reader = new BoxReader(buf, buf_size, media_log, true); |
| 163 BoxReader* reader = new BoxReader(buf, buf_size, &media_log, true); | |
| 164 | 163 |
| 165 // Concatenated boxes are passed in without a wrapping parent box. Set | 164 // Concatenated boxes are passed in without a wrapping parent box. Set |
| 166 // |box_size_| to the concatenated buffer length to mimic having already | 165 // |box_size_| to the concatenated buffer length to mimic having already |
| 167 // parsed the parent box. | 166 // parsed the parent box. |
| 168 reader->box_size_ = buf_size; | 167 reader->box_size_ = buf_size; |
| 169 reader->box_size_known_ = true; | 168 reader->box_size_known_ = true; |
| 170 | 169 |
| 171 return reader; | 170 return reader; |
| 172 } | 171 } |
| 173 | 172 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 297 |
| 299 // Note that the pos_ head has advanced to the byte immediately after the | 298 // Note that the pos_ head has advanced to the byte immediately after the |
| 300 // header, which is where we want it. | 299 // header, which is where we want it. |
| 301 box_size_ = base::checked_cast<size_t>(box_size); | 300 box_size_ = base::checked_cast<size_t>(box_size); |
| 302 box_size_known_ = true; | 301 box_size_known_ = true; |
| 303 return true; | 302 return true; |
| 304 } | 303 } |
| 305 | 304 |
| 306 } // namespace mp4 | 305 } // namespace mp4 |
| 307 } // namespace media | 306 } // namespace media |
| OLD | NEW |