Shaka Player Embedded
Public Member Functions | List of all members
shaka::util::BufferWriter Class Reference

#include <buffer_writer.h>

Public Member Functions

 BufferWriter (uint8_t *data, size_t data_size)
 
bool empty () const
 
size_t BytesRemaining () const
 
void WriteByte (uint8_t byte)
 
void WriteTag (const char(&tag)[5])
 
template<typename T , typename = typename std::enable_if< std::is_integral<T>::value>::type>
void Write (T value, Endianness endian=kBigEndian)
 
void Write (const std::vector< uint8_t > &data)
 
void Write (const void *src, size_t src_size)
 

Detailed Description

A simple utility class to write bytes to a buffer. This does not own the data and is not thread safe.

This will fail a CHECK if a write would extend past the end of the buffer.

Definition at line 35 of file buffer_writer.h.

Constructor & Destructor Documentation

§ BufferWriter()

shaka::util::BufferWriter::BufferWriter ( uint8_t *  data,
size_t  data_size 
)

Definition at line 24 of file buffer_writer.cc.

Member Function Documentation

§ BytesRemaining()

size_t shaka::util::BufferWriter::BytesRemaining ( ) const
inline
Returns
The number of bytes left to write.

Definition at line 44 of file buffer_writer.h.

§ empty()

bool shaka::util::BufferWriter::empty ( ) const
inline

Definition at line 39 of file buffer_writer.h.

§ Write() [1/3]

template<typename T , typename = typename std::enable_if< std::is_integral<T>::value>::type>
void shaka::util::BufferWriter::Write ( value,
Endianness  endian = kBigEndian 
)
inline

Writes the given number.

Definition at line 62 of file buffer_writer.h.

§ Write() [2/3]

void shaka::util::BufferWriter::Write ( const std::vector< uint8_t > &  data)
inline

Writes the given vector.

Definition at line 76 of file buffer_writer.h.

§ Write() [3/3]

void shaka::util::BufferWriter::Write ( const void *  src,
size_t  src_size 
)

Writes |src_size| bytes and copies them from |src|.

Parameters
srcThe buffer to copy the data from.
src_sizeThe number of bytes in |src|.

Definition at line 27 of file buffer_writer.cc.

§ WriteByte()

void shaka::util::BufferWriter::WriteByte ( uint8_t  byte)
inline

Writes a single byte.

Definition at line 49 of file buffer_writer.h.

§ WriteTag()

void shaka::util::BufferWriter::WriteTag ( const char(&)  tag[5])
inline

Writes the given big-endian MP4 tag.

Definition at line 54 of file buffer_writer.h.


The documentation for this class was generated from the following files: