Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::packet::IComposer Class Referenceabstract

Packet composer interface. More...

#include <icomposer.h>

Inheritance diagram for roc::packet::IComposer:

Public Member Functions

virtual bool align (core::Slice< uint8_t > &buffer, size_t header_size, size_t payload_alignment)=0
 Adjust buffer to align payload. More...
 
virtual bool prepare (Packet &packet, core::Slice< uint8_t > &buffer, size_t payload_size)=0
 Prepare buffer for composing a packet. More...
 
virtual bool pad (Packet &packet, size_t padding_size)=0
 Pad packet. More...
 
virtual bool compose (Packet &packet)=0
 Compose packet to buffer. More...
 

Detailed Description

Packet composer interface.

Definition at line 22 of file icomposer.h.

Member Function Documentation

virtual bool roc::packet::IComposer::align ( core::Slice< uint8_t > &  buffer,
size_t  header_size,
size_t  payload_alignment 
)
pure virtual

Adjust buffer to align payload.

Remarks
Adjusts the given buffer so that the payload of the most inner composer will have payload_alignment. The header_size parameter defines the total size of all headers before the payload.
Returns
true if the buffer was successfully adjusted or false if the buffer capacity is not enough.

Implemented in roc::fec::Composer< PayloadID, Type, Pos >, and roc::rtp::Composer.

virtual bool roc::packet::IComposer::compose ( Packet packet)
pure virtual

Compose packet to buffer.

Remarks
Formats packet headers and payloads to the buffer attached to it during a previous prepare() call.
Returns
true if the packet was successfully composed or false if an error occured.

Implemented in roc::fec::Composer< PayloadID, Type, Pos >, and roc::rtp::Composer.

virtual bool roc::packet::IComposer::pad ( Packet packet,
size_t  padding_size 
)
pure virtual

Pad packet.

Remarks
Cuts from the right the given number of bytes from the packet payload of the most inner composer and marks them as padding. The padding_size parameter should be less than or equal to the packet payload size.
Returns
true if the packet was successfully padded or false if parameters are invalid or padding is not supported.

Implemented in roc::fec::Composer< PayloadID, Type, Pos >, and roc::rtp::Composer.

virtual bool roc::packet::IComposer::prepare ( Packet packet,
core::Slice< uint8_t > &  buffer,
size_t  payload_size 
)
pure virtual

Prepare buffer for composing a packet.

Remarks
Resizes the given buffer so that it can fit the packet headers and payload. If the packet payload contains an inner packet, calls the inner composer as well The payload_size referes to the payload of the most inner packet. Modifies the packet so that its payload fields point to the appropriate parts of the buffer.
Returns
true if the packet was successfully prepared or false if the buffer capacity is not enough.

Implemented in roc::fec::Composer< PayloadID, Type, Pos >, and roc::rtp::Composer.


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