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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <limits> | 10 #include <limits> |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 FourCC* type, | 116 FourCC* type, |
117 size_t* box_size, | 117 size_t* box_size, |
118 bool* err) WARN_UNUSED_RESULT; | 118 bool* err) WARN_UNUSED_RESULT; |
119 | 119 |
120 // Create a BoxReader from a buffer. |buf| must be the complete buffer, as | 120 // Create a BoxReader from a buffer. |buf| must be the complete buffer, as |
121 // errors are returned when sufficient data is not available. |buf| can start | 121 // errors are returned when sufficient data is not available. |buf| can start |
122 // with any type of box -- it does not have to be IsValidTopLevelBox(). | 122 // with any type of box -- it does not have to be IsValidTopLevelBox(). |
123 // | 123 // |
124 // |buf| is retained but not owned, and must outlive the BoxReader instance. | 124 // |buf| is retained but not owned, and must outlive the BoxReader instance. |
125 static BoxReader* ReadConcatentatedBoxes(const uint8_t* buf, | 125 static BoxReader* ReadConcatentatedBoxes(const uint8_t* buf, |
126 const size_t buf_size); | 126 const size_t buf_size, |
| 127 MediaLog* media_log); |
127 | 128 |
128 // Returns true if |type| is recognized to be a top-level box, false | 129 // Returns true if |type| is recognized to be a top-level box, false |
129 // otherwise. This returns true for some boxes which we do not parse. | 130 // otherwise. This returns true for some boxes which we do not parse. |
130 // Helpful in debugging misaligned appends. | 131 // Helpful in debugging misaligned appends. |
131 static bool IsValidTopLevelBox(const FourCC& type, MediaLog* media_log); | 132 static bool IsValidTopLevelBox(const FourCC& type, MediaLog* media_log); |
132 | 133 |
133 // Scan through all boxes within the current box, starting at the current | 134 // Scan through all boxes within the current box, starting at the current |
134 // buffer position. Must be called before any of the *Child functions work. | 135 // buffer position. Must be called before any of the *Child functions work. |
135 bool ScanChildren() WARN_UNUSED_RESULT; | 136 bool ScanChildren() WARN_UNUSED_RESULT; |
136 | 137 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 pos_ += child_reader.box_size(); | 289 pos_ += child_reader.box_size(); |
289 } | 290 } |
290 | 291 |
291 return !err; | 292 return !err; |
292 } | 293 } |
293 | 294 |
294 } // namespace mp4 | 295 } // namespace mp4 |
295 } // namespace media | 296 } // namespace media |
296 | 297 |
297 #endif // MEDIA_FORMATS_MP4_BOX_READER_H_ | 298 #endif // MEDIA_FORMATS_MP4_BOX_READER_H_ |
OLD | NEW |