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