7 #include "packager/media/formats/mp4/box.h"
9 #include "packager/base/logging.h"
10 #include "packager/media/formats/mp4/box_buffer.h"
12 namespace edash_packager {
16 Box::Box() : box_size_(0) {}
22 return ReadWriteInternal(&buffer);
29 DCHECK_EQ(size, box_size_);
31 size_t buffer_size_before_write = writer->Size();
33 CHECK(ReadWriteInternal(&buffer));
34 DCHECK_EQ(box_size_, writer->Size() - buffer_size_before_write)
42 DCHECK_EQ(size, box_size_);
44 size_t buffer_size_before_write = writer->Size();
47 DCHECK_EQ(
HeaderSize(), writer->Size() - buffer_size_before_write);
51 box_size_ = ComputeSizeInternal();
56 const uint32_t kFourCCSize = 4;
58 return kFourCCSize +
sizeof(uint32_t);
65 CHECK(buffer->ReadWriteUInt32(&box_size_));
67 CHECK(buffer->ReadWriteFourCC(&fourcc));
72 FullBox::FullBox() : version(0), flags(0) {}
73 FullBox::~FullBox() {}
85 RCHECK(buffer->ReadWriteUInt32(&vflags));
86 this->version = vflags >> 24;
87 this->flags = vflags & 0x00FFFFFF;
89 vflags = (this->version << 24) | this->flags;
90 RCHECK(buffer->ReadWriteUInt32(&vflags));