AudioEncoder
AudioEncoder
#include <icy/av/audioencoder.h>Inherits:
AudioContextSubclassed by:AudioPacketEncoder
Encodes raw audio samples into a compressed format.
Public Attributes
fifo
av::AudioBuffer fifoformat
AVFormatContext * formatPublic Methods
| Return | Name | Description |
|---|---|---|
AudioEncoder | Construct an encoder, optionally tied to an existing muxer context. | |
void | create virtual | Initialise the AVCodecContext using oparams. Adds an audio stream to format if one was provided at construction. |
void | close virtual | Close and free the AVCodecContext, FIFO buffer, and associated resources. |
bool | encode virtual | Encode interleaved audio samples. |
bool | encode virtual | Encode planar audio samples. |
bool | encode virtual | Encode a single AVFrame (typically from a decoder or resampler). |
void | flush virtual | Flush remaining packets to be encoded. This method should be called once before stream closure. |
AudioEncoder
AudioEncoder(AVFormatContext * format)Construct an encoder, optionally tied to an existing muxer context.
Parameters
formatThe AVFormatContext that will receive encoded packets, or nullptr for standalone use.
create
virtual
virtual void create()Initialise the AVCodecContext using oparams. Adds an audio stream to format if one was provided at construction.
close
virtual
virtual void close()Close and free the AVCodecContext, FIFO buffer, and associated resources.
encode
virtual
virtual bool encode(uint8_t * samples, const int numSamples, const int64_t pts)Encode interleaved audio samples.
Parameters
samplesThe input samples to encode.numSamplesThe number of input samples per channel.ptsThe input samples presentation timestamp.
encode
virtual
virtual bool encode(uint8_t * samples, const int numSamples, const int64_t pts)Encode planar audio samples.
Parameters
samplesThe input samples to encode.numSamplesThe number of input samples per channel.ptsThe input samples presentation timestamp.
encode
virtual
virtual bool encode(AVFrame * iframe)Encode a single AVFrame (typically from a decoder or resampler).
Parameters
iframeThe source audio frame with all fields set.
Returns
True if an encoded packet was produced and emitted.
flush
virtual
virtual void flush()Flush remaining packets to be encoded. This method should be called once before stream closure.
