| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 bool err = false; | 194 bool err = false; |
| 195 while (pos_ < size_) { | 195 while (pos_ < size_) { |
| 196 BoxReader child(&buf_[pos_], size_ - pos_, media_log_, is_EOS_); | 196 BoxReader child(&buf_[pos_], size_ - pos_, media_log_, is_EOS_); |
| 197 if (!child.ReadHeader(&err)) break; | 197 if (!child.ReadHeader(&err)) break; |
| 198 | 198 |
| 199 children_.insert(std::pair<FourCC, BoxReader>(child.type(), child)); | 199 children_.insert(std::pair<FourCC, BoxReader>(child.type(), child)); |
| 200 pos_ += child.size(); | 200 pos_ += child.size(); |
| 201 } | 201 } |
| 202 | 202 |
| 203 DCHECK(!err); | |
| 204 return !err && pos_ == size_; | 203 return !err && pos_ == size_; |
| 205 } | 204 } |
| 206 | 205 |
| 207 bool BoxReader::HasChild(Box* child) { | 206 bool BoxReader::HasChild(Box* child) { |
| 208 DCHECK(scanned_); | 207 DCHECK(scanned_); |
| 209 DCHECK(child); | 208 DCHECK(child); |
| 210 return children_.count(child->BoxType()) > 0; | 209 return children_.count(child->BoxType()) > 0; |
| 211 } | 210 } |
| 212 | 211 |
| 213 bool BoxReader::ReadChild(Box* child) { | 212 bool BoxReader::ReadChild(Box* child) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 } | 281 } |
| 283 | 282 |
| 284 // Note that the pos_ head has advanced to the byte immediately after the | 283 // Note that the pos_ head has advanced to the byte immediately after the |
| 285 // header, which is where we want it. | 284 // header, which is where we want it. |
| 286 size_ = size; | 285 size_ = size; |
| 287 return true; | 286 return true; |
| 288 } | 287 } |
| 289 | 288 |
| 290 } // namespace mp4 | 289 } // namespace mp4 |
| 291 } // namespace media | 290 } // namespace media |
| OLD | NEW |