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

Audio frame encoder interface. More...

#include <iframe_encoder.h>

Inheritance diagram for roc::audio::IFrameEncoder:

Public Member Functions

virtual size_t encoded_byte_count (size_t num_samples) const =0
 Get encoded frame size in bytes for given number of samples per channel. More...
 
virtual void begin (void *frame_data, size_t frame_size)=0
 Start encoding a new frame. More...
 
virtual size_t write (const sample_t *samples, size_t n_samples)=0
 Write samples into current frame. More...
 
virtual void end ()=0
 Finish encoding current frame. More...
 

Detailed Description

Audio frame encoder interface.

Definition at line 24 of file iframe_encoder.h.

Member Function Documentation

◆ begin()

virtual void roc::audio::IFrameEncoder::begin ( void *  frame_data,
size_t  frame_size 
)
pure virtual

Start encoding a new frame.

Remarks
After this call, write() will store samples to the given frame_data until frame_size bytes are written or end() is called.

Implemented in roc::audio::PcmEncoder.

◆ encoded_byte_count()

virtual size_t roc::audio::IFrameEncoder::encoded_byte_count ( size_t  num_samples) const
pure virtual

Get encoded frame size in bytes for given number of samples per channel.

Implemented in roc::audio::PcmEncoder.

◆ end()

virtual void roc::audio::IFrameEncoder::end ( )
pure virtual

Finish encoding current frame.

Remarks
After this call, the frame is fully encoded and no more samples will be written to the frame. A new frame should be started by calling begin().

Implemented in roc::audio::PcmEncoder.

◆ write()

virtual size_t roc::audio::IFrameEncoder::write ( const sample_t samples,
size_t  n_samples 
)
pure virtual

Write samples into current frame.

Parameters

  • samples - samples to be encoded
  • n_samples - number of samples to be encoded, for all channel
Remarks
Encodes samples and writes to the current frame.
Returns
number of samples encoded per channel. The returned value can be fewer than n_samples if the frame is full and no more samples can be written to it.
Precondition
This method may be called only between begin() and end() calls.

Implemented in roc::audio::PcmEncoder.


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