Chromium Code Reviews| 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 11 matching lines...) Expand all Loading... | |
| 22 | 22 |
| 23 struct MEDIA_EXPORT Box { | 23 struct MEDIA_EXPORT Box { |
| 24 virtual ~Box(); | 24 virtual ~Box(); |
| 25 virtual bool Parse(BoxReader* reader) = 0; | 25 virtual bool Parse(BoxReader* reader) = 0; |
| 26 virtual FourCC BoxType() const = 0; | 26 virtual FourCC BoxType() const = 0; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 class MEDIA_EXPORT BufferReader { | 29 class MEDIA_EXPORT BufferReader { |
| 30 public: | 30 public: |
| 31 BufferReader(const uint8* buf, const int size) | 31 BufferReader(const uint8* buf, const int size) |
| 32 : buf_(buf), size_(size), pos_(0) {} | 32 : buf_(buf), size_(size), pos_(0) { |
| 33 CHECK(buf); | |
|
scherkus (not reviewing)
2014/05/05 18:22:17
did you mean to add these?, or are these leftover
acolwell GONE FROM CHROMIUM
2014/05/05 18:49:02
Yes. This is intended to protect release code from
| |
| 34 CHECK_GE(size, 0); | |
| 35 } | |
| 33 | 36 |
| 34 bool HasBytes(int count) { return (pos() + count <= size()); } | 37 bool HasBytes(int count) { return (pos() + count <= size()); } |
| 35 | 38 |
| 36 // Read a value from the stream, perfoming endian correction, and advance the | 39 // Read a value from the stream, perfoming endian correction, and advance the |
| 37 // stream pointer. | 40 // stream pointer. |
| 38 bool Read1(uint8* v) WARN_UNUSED_RESULT; | 41 bool Read1(uint8* v) WARN_UNUSED_RESULT; |
| 39 bool Read2(uint16* v) WARN_UNUSED_RESULT; | 42 bool Read2(uint16* v) WARN_UNUSED_RESULT; |
| 40 bool Read2s(int16* v) WARN_UNUSED_RESULT; | 43 bool Read2s(int16* v) WARN_UNUSED_RESULT; |
| 41 bool Read4(uint32* v) WARN_UNUSED_RESULT; | 44 bool Read4(uint32* v) WARN_UNUSED_RESULT; |
| 42 bool Read4s(int32* v) WARN_UNUSED_RESULT; | 45 bool Read4s(int32* v) WARN_UNUSED_RESULT; |
| (...skipping 162 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 |