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/mp4/box_reader.h" | 5 #include "media/mp4/box_reader.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 << std::hex << type; | 156 << std::hex << type; |
157 return false; | 157 return false; |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 bool BoxReader::ScanChildren() { | 161 bool BoxReader::ScanChildren() { |
162 DCHECK(!scanned_); | 162 DCHECK(!scanned_); |
163 scanned_ = true; | 163 scanned_ = true; |
164 | 164 |
165 bool err = false; | 165 bool err = false; |
166 // TODO(strobe): Check or correct for multimap not inserting elements in | |
167 // consistent order. | |
168 while (pos() < size()) { | 166 while (pos() < size()) { |
169 BoxReader child(&buf_[pos_], size_ - pos_); | 167 BoxReader child(&buf_[pos_], size_ - pos_); |
170 if (!child.ReadHeader(&err)) break; | 168 if (!child.ReadHeader(&err)) break; |
171 | 169 |
172 children_.insert(std::pair<FourCC, BoxReader>(child.type(), child)); | 170 children_.insert(std::pair<FourCC, BoxReader>(child.type(), child)); |
173 pos_ += child.size(); | 171 pos_ += child.size(); |
174 } | 172 } |
175 | 173 |
176 DCHECK(!err); | 174 DCHECK(!err); |
177 return !err && pos() == size(); | 175 return !err && pos() == size(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 225 } |
228 | 226 |
229 // Note that the pos_ head has advanced to the byte immediately after the | 227 // Note that the pos_ head has advanced to the byte immediately after the |
230 // header, which is where we want it. | 228 // header, which is where we want it. |
231 size_ = size; | 229 size_ = size; |
232 return true; | 230 return true; |
233 } | 231 } |
234 | 232 |
235 } // namespace mp4 | 233 } // namespace mp4 |
236 } // namespace media | 234 } // namespace media |
OLD | NEW |