DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerator
box.h
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #ifndef MEDIA_FORMATS_MP4_BOX_H_
8 #define MEDIA_FORMATS_MP4_BOX_H_
9 
10 #include <stdint.h>
11 
12 #include "packager/base/compiler_specific.h"
13 #include "packager/media/formats/mp4/fourccs.h"
14 
15 namespace edash_packager {
16 namespace media {
17 
18 class BufferWriter;
19 
20 namespace mp4 {
21 
22 class BoxBuffer;
23 class BoxReader;
24 
28 struct Box {
29  public:
30  Box();
31  virtual ~Box();
34  bool Parse(BoxReader* reader);
39  void Write(BufferWriter* writer);
42  virtual uint32_t ComputeSize() = 0;
43  virtual FourCC BoxType() const = 0;
44 
45  protected:
46  friend class BoxBuffer;
48  virtual bool ReadWrite(BoxBuffer* buffer);
49 
52  uint32_t atom_size;
53 };
54 
58 struct FullBox : Box {
59  public:
60  FullBox();
61  ~FullBox() override;
62 
63  uint8_t version;
64  uint32_t flags;
65 
66  protected:
67  bool ReadWrite(BoxBuffer* buffer) override;
68 };
69 
70 } // namespace mp4
71 } // namespace media
72 } // namespace edash_packager
73 
74 #endif // MEDIA_FORMATS_MP4_BOX_H_
virtual bool ReadWrite(BoxBuffer *buffer)
Read/write the mp4 box from/to BoxBuffer.
Definition: box.cc:36
virtual uint32_t ComputeSize()=0
bool ReadWrite(BoxBuffer *buffer) override
Read/write the mp4 box from/to BoxBuffer.
Definition: box.cc:50
bool Parse(BoxReader *reader)
Definition: box.cc:19
void Write(BufferWriter *writer)
Definition: box.cc:25
Class for reading MP4 boxes.
Definition: box_reader.h:24