Shaka Packager SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | List of all members
shaka::media::OffsetByteQueue Class Reference

#include <offset_byte_queue.h>

Public Member Functions

void PeekAt (int64_t offset, const uint8_t **buf, int *size)
 
bool Trim (int64_t max_offset)
 
int64_t head ()
 
int64_t tail ()
 
These work like their underlying ByteQueue counterparts.
void Reset ()
 
void Push (const uint8_t *buf, int size)
 
void Peek (const uint8_t **buf, int *size)
 
void Pop (int count)
 

Detailed Description

Wrapper around ByteQueue, which encapsulates the notion of a monotonically-increasing byte offset. All buffer access is done by passing these offsets into this class, reducing the proliferation of many different meanings of "offset", "head", etc.

Definition at line 19 of file offset_byte_queue.h.

Member Function Documentation

int64_t shaka::media::OffsetByteQueue::head ( )
inline
Returns
The head position, in terms of the file's absolute offset.

Definition at line 52 of file offset_byte_queue.h.

void shaka::media::OffsetByteQueue::PeekAt ( int64_t  offset,
const uint8_t **  buf,
int *  size 
)

Set buf to point at the first buffered byte corresponding to offset, and size to the number of bytes available starting from that offset.

It is an error if the offset is before the current head. It's not an error if the current offset is beyond tail(), but you will of course get back a null buf and a size of zero.

Definition at line 41 of file offset_byte_queue.cc.

int64_t shaka::media::OffsetByteQueue::tail ( )
inline
Returns
The tail position (exclusive), in terms of the file's absolute offset.

Definition at line 55 of file offset_byte_queue.h.

bool shaka::media::OffsetByteQueue::Trim ( int64_t  max_offset)

Mark the bytes up to (but not including) max_offset as ready for deletion. This is relatively inexpensive, but will not necessarily reduce the resident buffer size right away (or ever).

Returns
true if the full range of bytes were successfully trimmed, including the case where max_offset is less than the current head.
false if max_offset > tail() (although all bytes currently buffered are still cleared).

Definition at line 51 of file offset_byte_queue.cc.


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