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() : atom_size(0) {}
22 return ReadWriteInternal(&buffer);
29 DCHECK_EQ(size, this->atom_size);
31 size_t buffer_size_before_write = writer->Size();
33 CHECK(ReadWriteInternal(&buffer));
34 DCHECK_EQ(this->atom_size, writer->Size() - buffer_size_before_write);
41 DCHECK_EQ(size, this->atom_size);
43 size_t buffer_size_before_write = writer->Size();
46 DCHECK_EQ(
HeaderSize(), writer->Size() - buffer_size_before_write);
50 this->atom_size = ComputeSizeInternal();
51 return this->atom_size;
55 const uint32_t kFourCCSize = 4;
57 return kFourCCSize +
sizeof(uint32_t);
64 CHECK(buffer->ReadWriteUInt32(&this->atom_size));
66 CHECK(buffer->ReadWriteFourCC(&fourcc));
71 FullBox::FullBox() : version(0), flags(0) {}
72 FullBox::~FullBox() {}
84 RCHECK(buffer->ReadWriteUInt32(&vflags));
85 this->version = vflags >> 24;
86 this->flags = vflags & 0x00FFFFFF;
88 vflags = (this->version << 24) | this->flags;
89 RCHECK(buffer->ReadWriteUInt32(&vflags));