| Index: media/mp4/box_reader.cc
|
| diff --git a/media/mp4/box_reader.cc b/media/mp4/box_reader.cc
|
| index 1285ebfdb412297c17d95b67bf626a96ed28f81e..71d93a0bcf7cee308676ec62cb04216ecc654f30 100644
|
| --- a/media/mp4/box_reader.cc
|
| +++ b/media/mp4/box_reader.cc
|
| @@ -79,8 +79,10 @@ bool BufferReader::Read4sInto8s(int64* v) {
|
| }
|
|
|
|
|
| -BoxReader::BoxReader(const uint8* buf, const int size)
|
| +BoxReader::BoxReader(const uint8* buf, const int size,
|
| + const LogCB& log_cb)
|
| : BufferReader(buf, size),
|
| + log_cb_(log_cb),
|
| type_(FOURCC_NULL),
|
| version_(0),
|
| flags_(0),
|
| @@ -99,12 +101,13 @@ BoxReader::~BoxReader() {
|
| // static
|
| BoxReader* BoxReader::ReadTopLevelBox(const uint8* buf,
|
| const int buf_size,
|
| + const LogCB& log_cb,
|
| bool* err) {
|
| - scoped_ptr<BoxReader> reader(new BoxReader(buf, buf_size));
|
| + scoped_ptr<BoxReader> reader(new BoxReader(buf, buf_size, log_cb));
|
| if (!reader->ReadHeader(err))
|
| return NULL;
|
|
|
| - if (!IsValidTopLevelBox(reader->type())) {
|
| + if (!IsValidTopLevelBox(reader->type(), log_cb)) {
|
| *err = true;
|
| return NULL;
|
| }
|
| @@ -118,12 +121,13 @@ BoxReader* BoxReader::ReadTopLevelBox(const uint8* buf,
|
| // static
|
| bool BoxReader::StartTopLevelBox(const uint8* buf,
|
| const int buf_size,
|
| + const LogCB& log_cb,
|
| FourCC* type,
|
| int* box_size,
|
| bool* err) {
|
| - BoxReader reader(buf, buf_size);
|
| + BoxReader reader(buf, buf_size, log_cb);
|
| if (!reader.ReadHeader(err)) return false;
|
| - if (!IsValidTopLevelBox(reader.type())) {
|
| + if (!IsValidTopLevelBox(reader.type(), log_cb)) {
|
| *err = true;
|
| return false;
|
| }
|
| @@ -133,7 +137,8 @@ bool BoxReader::StartTopLevelBox(const uint8* buf,
|
| }
|
|
|
| // static
|
| -bool BoxReader::IsValidTopLevelBox(const FourCC& type) {
|
| +bool BoxReader::IsValidTopLevelBox(const FourCC& type,
|
| + const LogCB& log_cb) {
|
| switch (type) {
|
| case FOURCC_FTYP:
|
| case FOURCC_PDIN:
|
| @@ -152,8 +157,8 @@ bool BoxReader::IsValidTopLevelBox(const FourCC& type) {
|
| return true;
|
| default:
|
| // Hex is used to show nonprintable characters and aid in debugging
|
| - LOG(WARNING) << "Unrecognized top-level box type 0x"
|
| - << std::hex << type;
|
| + MEDIA_LOG(log_cb) << "Unrecognized top-level box type 0x"
|
| + << std::hex << type;
|
| return false;
|
| }
|
| }
|
| @@ -164,7 +169,7 @@ bool BoxReader::ScanChildren() {
|
|
|
| bool err = false;
|
| while (pos() < size()) {
|
| - BoxReader child(&buf_[pos_], size_ - pos_);
|
| + BoxReader child(&buf_[pos_], size_ - pos_, log_cb_);
|
| if (!child.ReadHeader(&err)) break;
|
|
|
| children_.insert(std::pair<FourCC, BoxReader>(child.type(), child));
|
|
|