DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | List of all members
shaka::media::BufferWriter Class Reference

#include <buffer_writer.h>

Public Member Functions

 BufferWriter (size_t reserved_size_in_bytes)
 
void AppendNBytes (uint64_t v, size_t num_bytes)
 
void AppendVector (const std::vector< uint8_t > &v)
 
void AppendArray (const uint8_t *buf, size_t size)
 
void AppendBuffer (const BufferWriter &buffer)
 
void Swap (BufferWriter *buffer)
 
void SwapBuffer (std::vector< uint8_t > *buffer)
 
void Clear ()
 
size_t Size () const
 
const uint8_t * Buffer () const
 
Status WriteToFile (File *file)
 
void AppendInt (uint8_t v)
 
void AppendInt (uint16_t v)
 
void AppendInt (uint32_t v)
 
void AppendInt (uint64_t v)
 
void AppendInt (int16_t v)
 
void AppendInt (int32_t v)
 
void AppendInt (int64_t v)
 

Detailed Description

A simple buffer writer implementation which appends various data types to buffer.

Definition at line 22 of file buffer_writer.h.

Constructor & Destructor Documentation

shaka::media::BufferWriter::BufferWriter ( size_t  reserved_size_in_bytes)
explicit

Construct the object with a reserved capacity.

Parameters
reserved_size_in_bytesis intended for optimization and is not a hard limit. It does not affect the actual size of the buffer, which still starts from zero.

Definition at line 20 of file buffer_writer.cc.

Member Function Documentation

void shaka::media::BufferWriter::AppendInt ( uint8_t  v)

These convenience functions append the integers (in network byte order, i.e. big endian) of various size and signedness to the end of the buffer.

Definition at line 25 of file buffer_writer.cc.

void shaka::media::BufferWriter::AppendNBytes ( uint64_t  v,
size_t  num_bytes 
)

Append the least significant num_bytes of v to buffer.

Parameters
num_bytesshould not be larger than sizeof(v), i.e. 8 on a 64-bit system.

Definition at line 47 of file buffer_writer.cc.

const uint8_t* shaka::media::BufferWriter::Buffer ( ) const
inline
Returns
Underlying buffer. Behavior is undefined if the buffer size is 0.

Definition at line 59 of file buffer_writer.h.

Status shaka::media::BufferWriter::WriteToFile ( File file)

Write the buffer to file. The internal buffer will be cleared after writing.

Parameters
fileshould not be NULL.
Returns
OK on success.

Definition at line 66 of file buffer_writer.cc.


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