Shaka Packager SDK
|
Class for reading MP4 boxes. More...
#include <box_reader.h>
Public Member Functions | |
bool | ScanChildren () |
bool | ChildExist (Box *child) |
bool | ReadChild (Box *child) |
bool | TryReadChild (Box *child) |
template<typename T > | |
bool | ReadChildren (std::vector< T > *children) |
template<typename T > | |
bool | TryReadChildren (std::vector< T > *children) |
template<typename T > | |
bool | ReadAllChildren (std::vector< T > *children) |
bool | ReadFourCC (FourCC *fourcc) |
FourCC | type () const |
Public Member Functions inherited from shaka::media::BufferReader | |
BufferReader (const uint8_t *buf, size_t size) | |
Create a BufferReader from a raw buffer. | |
bool | HasBytes (size_t count) |
bool | ReadToVector (std::vector< uint8_t > *t, size_t count) |
bool | ReadToString (std::string *str, size_t size) |
bool | ReadCString (std::string *str) |
Reads a null-terminated string. | |
bool | SkipBytes (size_t num_bytes) |
const uint8_t * | data () const |
size_t | size () const |
void | set_size (size_t size) |
size_t | pos () const |
bool | Read1 (uint8_t *v) |
bool | Read2 (uint16_t *v) |
bool | Read2s (int16_t *v) |
bool | Read4 (uint32_t *v) |
bool | Read4s (int32_t *v) |
bool | Read8 (uint64_t *v) |
bool | Read8s (int64_t *v) |
bool | ReadNBytesInto8 (uint64_t *v, size_t num_bytes) |
bool | ReadNBytesInto8s (int64_t *v, size_t num_bytes) |
Static Public Member Functions | |
static BoxReader * | ReadBox (const uint8_t *buf, const size_t buf_size, bool *err) |
static bool | StartBox (const uint8_t *buf, const size_t buf_size, FourCC *type, uint64_t *box_size, bool *err) |
Class for reading MP4 boxes.
Definition at line 28 of file box_reader.h.
bool shaka::media::mp4::BoxReader::ChildExist | ( | Box * | child | ) |
Definition at line 104 of file box_reader.cc.
bool shaka::media::mp4::BoxReader::ReadAllChildren | ( | std::vector< T > * | children | ) |
Read all children. It expects all children to be of type T. Note that this method is mutually exclusive with ScanChildren().
Definition at line 160 of file box_reader.h.
|
static |
Create a BoxReader from a buffer.
buf | is retained but not owned, and must outlive the BoxReader instance. | |
buf_size | indicates the size of the input buffer. | |
[out] | err | is set to true if there was a stream-level error when reading the box. |
Definition at line 38 of file box_reader.cc.
bool shaka::media::mp4::BoxReader::ReadChild | ( | Box * | child | ) |
Read exactly one child box from the set of children. The type of the child will be determined by the BoxType() of child.
Definition at line 92 of file box_reader.cc.
bool shaka::media::mp4::BoxReader::ReadChildren | ( | std::vector< T > * | children | ) |
Read at least one child.
Definition at line 131 of file box_reader.h.
bool shaka::media::mp4::BoxReader::ScanChildren | ( | ) |
Scan through all boxes within the current box, starting at the current buffer position. Must be called before any of the *Child functions work.
Definition at line 69 of file box_reader.cc.
|
static |
Read the box header from the current buffer.
buf | is not retained. | |
buf_size | indicates the size of the input buffer. | |
[out] | type | is filled with the fourcc of the box on success. |
[out] | box_size | is filled with the size of the box on success. |
[out] | err | is set to true if there was a stream-level error when reading the box. |
Definition at line 56 of file box_reader.cc.
bool shaka::media::mp4::BoxReader::TryReadChild | ( | Box * | child | ) |
Read one child if available.
Definition at line 108 of file box_reader.cc.
bool shaka::media::mp4::BoxReader::TryReadChildren | ( | std::vector< T > * | children | ) |