Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: media/mp4/box_reader.h

Issue 10823139: Set error on unrecognized top-level BMFF boxes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update comment Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | media/mp4/box_reader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef MEDIA_MP4_BOX_READER_H_ 5 #ifndef MEDIA_MP4_BOX_READER_H_
6 #define MEDIA_MP4_BOX_READER_H_ 6 #define MEDIA_MP4_BOX_READER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // does not check to ensure the entire box is in the buffer before returning 84 // does not check to ensure the entire box is in the buffer before returning
85 // true. The semantics of |*err| are the same as above. 85 // true. The semantics of |*err| are the same as above.
86 // 86 //
87 // |buf| is not retained. 87 // |buf| is not retained.
88 static bool StartTopLevelBox(const uint8* buf, 88 static bool StartTopLevelBox(const uint8* buf,
89 const int buf_size, 89 const int buf_size,
90 FourCC* type, 90 FourCC* type,
91 int* box_size, 91 int* box_size,
92 bool* err) WARN_UNUSED_RESULT; 92 bool* err) WARN_UNUSED_RESULT;
93 93
94 // Returns true if |type| is recognized to be a top-level box, false
95 // otherwise. This returns true for some boxes which we do not parse.
96 // Helpful in debugging misaligned appends.
97 static bool IsValidTopLevelBox(const FourCC& type);
98
94 // Scan through all boxes within the current box, starting at the current 99 // Scan through all boxes within the current box, starting at the current
95 // buffer position. Must be called before any of the *Child functions work. 100 // buffer position. Must be called before any of the *Child functions work.
96 bool ScanChildren() WARN_UNUSED_RESULT; 101 bool ScanChildren() WARN_UNUSED_RESULT;
97 102
98 // Read exactly one child box from the set of children. The type of the child 103 // Read exactly one child box from the set of children. The type of the child
99 // will be determined by the BoxType() method of |child|. 104 // will be determined by the BoxType() method of |child|.
100 bool ReadChild(Box* child) WARN_UNUSED_RESULT; 105 bool ReadChild(Box* child) WARN_UNUSED_RESULT;
101 106
102 // Read one child if available. Returns false on error, true on successful 107 // Read one child if available. Returns false on error, true on successful
103 // read or on child absent. 108 // read or on child absent.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 ++child_itr; 197 ++child_itr;
193 } 198 }
194 children_.clear(); 199 children_.clear();
195 return true; 200 return true;
196 } 201 }
197 202
198 } // namespace mp4 203 } // namespace mp4
199 } // namespace media 204 } // namespace media
200 205
201 #endif // MEDIA_MP4_BOX_READER_H_ 206 #endif // MEDIA_MP4_BOX_READER_H_
OLDNEW
« no previous file with comments | « no previous file | media/mp4/box_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698