| 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 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
| 14 #include "media/base/media_log.h" | 14 #include "media/base/media_log.h" |
| 15 #include "media/formats/mp4/fourccs.h" | 15 #include "media/formats/mp4/fourccs.h" |
| 16 #include "media/formats/mp4/rcheck.h" | 16 #include "media/formats/mp4/rcheck.h" |
| 17 | 17 |
| 18 namespace media { | 18 namespace media { |
| 19 namespace mp4 { | 19 namespace mp4 { |
| 20 | 20 |
| 21 class BoxReader; | 21 class BoxReader; |
| 22 | 22 |
| 23 struct MEDIA_EXPORT Box { | 23 struct MEDIA_EXPORT Box { |
| 24 virtual ~Box(); | 24 virtual ~Box(); |
| 25 |
| 26 // Parse errors may be logged using the BoxReader's log callback. |
| 25 virtual bool Parse(BoxReader* reader) = 0; | 27 virtual bool Parse(BoxReader* reader) = 0; |
| 28 |
| 26 virtual FourCC BoxType() const = 0; | 29 virtual FourCC BoxType() const = 0; |
| 27 }; | 30 }; |
| 28 | 31 |
| 29 class MEDIA_EXPORT BufferReader { | 32 class MEDIA_EXPORT BufferReader { |
| 30 public: | 33 public: |
| 31 BufferReader(const uint8* buf, const int size) | 34 BufferReader(const uint8* buf, const int size) |
| 32 : buf_(buf), size_(size), pos_(0) { | 35 : buf_(buf), size_(size), pos_(0) { |
| 33 CHECK(buf); | 36 CHECK(buf); |
| 34 CHECK_GE(size, 0); | 37 CHECK_GE(size, 0); |
| 35 } | 38 } |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 pos_ += child_reader.size(); | 216 pos_ += child_reader.size(); |
| 214 } | 217 } |
| 215 | 218 |
| 216 return !err; | 219 return !err; |
| 217 } | 220 } |
| 218 | 221 |
| 219 } // namespace mp4 | 222 } // namespace mp4 |
| 220 } // namespace media | 223 } // namespace media |
| 221 | 224 |
| 222 #endif // MEDIA_FORMATS_MP4_BOX_READER_H_ | 225 #endif // MEDIA_FORMATS_MP4_BOX_READER_H_ |
| OLD | NEW |