7 #ifndef MEDIA_FORMATS_MP4_BOX_BUFFER_H_
8 #define MEDIA_FORMATS_MP4_BOX_BUFFER_H_
10 #include "packager/base/compiler_specific.h"
11 #include "packager/media/base/buffer_writer.h"
12 #include "packager/media/formats/mp4/box.h"
13 #include "packager/media/formats/mp4/box_reader.h"
15 namespace edash_packager {
38 bool Reading()
const {
return reader_ != NULL; }
44 return reader_->pos();
45 return writer_->Size();
54 return reader_->size();
55 return writer_->Size();
60 bool ReadWriteUInt8(uint8_t* v) {
62 return reader_->
Read1(v);
66 bool ReadWriteUInt16(uint16_t* v) {
68 return reader_->Read2(v);
72 bool ReadWriteUInt32(uint32_t* v) {
74 return reader_->Read4(v);
78 bool ReadWriteUInt64(uint64_t* v) {
80 return reader_->Read8(v);
84 bool ReadWriteInt16(int16_t* v) {
86 return reader_->Read2s(v);
90 bool ReadWriteInt32(int32_t* v) {
92 return reader_->Read4s(v);
96 bool ReadWriteInt64(int64_t* v) {
98 return reader_->Read8s(v);
113 bool ReadWriteInt64NBytes(int64_t* v,
size_t num_bytes) {
115 return reader_->ReadNBytesInto8s(v, num_bytes);
119 bool ReadWriteVector(std::vector<uint8_t>* vector,
size_t count) {
121 return reader_->ReadToVector(vector, count);
122 DCHECK_EQ(vector->size(), count);
123 writer_->AppendVector(*vector);
126 bool ReadWriteFourCC(FourCC* fourcc) {
128 return reader_->ReadFourCC(fourcc);
129 writer_->
AppendInt(static_cast<uint32_t>(*fourcc));
148 DCHECK_NE(0u, box->atom_size);
149 CHECK(box->ReadWriteInternal(
this));
159 if (box->atom_size != 0)
160 CHECK(box->ReadWriteInternal(
this));
170 std::vector<uint8_t> vector(num_bytes, 0);
171 writer_->AppendVector(vector);
191 #endif // MEDIA_FORMATS_MP4_BOX_BUFFER_H_