| 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 #ifndef MEDIA_FORMATS_MP4_BOX_READER_H_ | 5 #ifndef MEDIA_FORMATS_MP4_BOX_READER_H_ |
| 6 #define MEDIA_FORMATS_MP4_BOX_READER_H_ | 6 #define MEDIA_FORMATS_MP4_BOX_READER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // Returns true if |type| is recognized to be a top-level box, false | 98 // Returns true if |type| is recognized to be a top-level box, false |
| 99 // otherwise. This returns true for some boxes which we do not parse. | 99 // otherwise. This returns true for some boxes which we do not parse. |
| 100 // Helpful in debugging misaligned appends. | 100 // Helpful in debugging misaligned appends. |
| 101 static bool IsValidTopLevelBox(const FourCC& type, | 101 static bool IsValidTopLevelBox(const FourCC& type, |
| 102 const LogCB& log_cb); | 102 const LogCB& log_cb); |
| 103 | 103 |
| 104 // Scan through all boxes within the current box, starting at the current | 104 // Scan through all boxes within the current box, starting at the current |
| 105 // buffer position. Must be called before any of the *Child functions work. | 105 // buffer position. Must be called before any of the *Child functions work. |
| 106 bool ScanChildren() WARN_UNUSED_RESULT; | 106 bool ScanChildren() WARN_UNUSED_RESULT; |
| 107 | 107 |
| 108 // Return true if child with type |child.BoxType()| exists. |
| 109 bool HasChild(Box* child) WARN_UNUSED_RESULT; |
| 110 |
| 108 // Read exactly one child box from the set of children. The type of the child | 111 // Read exactly one child box from the set of children. The type of the child |
| 109 // will be determined by the BoxType() method of |child|. | 112 // will be determined by the BoxType() method of |child|. |
| 110 bool ReadChild(Box* child) WARN_UNUSED_RESULT; | 113 bool ReadChild(Box* child) WARN_UNUSED_RESULT; |
| 111 | 114 |
| 112 // Read one child if available. Returns false on error, true on successful | 115 // Read one child if available. Returns false on error, true on successful |
| 113 // read or on child absent. | 116 // read or on child absent. |
| 114 bool MaybeReadChild(Box* child) WARN_UNUSED_RESULT; | 117 bool MaybeReadChild(Box* child) WARN_UNUSED_RESULT; |
| 115 | 118 |
| 116 // Read at least one child. False means error or no such child present. | 119 // Read at least one child. False means error or no such child present. |
| 117 template<typename T> bool ReadChildren( | 120 template<typename T> bool ReadChildren( |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 pos_ += child_reader.size(); | 208 pos_ += child_reader.size(); |
| 206 } | 209 } |
| 207 | 210 |
| 208 return !err; | 211 return !err; |
| 209 } | 212 } |
| 210 | 213 |
| 211 } // namespace mp4 | 214 } // namespace mp4 |
| 212 } // namespace media | 215 } // namespace media |
| 213 | 216 |
| 214 #endif // MEDIA_FORMATS_MP4_BOX_READER_H_ | 217 #endif // MEDIA_FORMATS_MP4_BOX_READER_H_ |
| OLD | NEW |