AudioEncoder
#include <icy/av/audioencoder.h>
struct AudioEncoderDefined in src/av/include/icy/av/audioencoder.h:37
- Inherits
AudioContext- Subclassed by
AudioPacketEncoder
List of all members
| Name | Kind | Owner |
|---|---|---|
fifo | variable | Declared here |
format | variable | Declared here |
nextOutputPts | variable | Declared here |
AudioEncoder | function | Declared here |
~AudioEncoder | function | Declared here |
create | function | Declared here |
close | function | Declared here |
encode | function | Declared here |
encode | function | Declared here |
encode | function | Declared here |
flush | function | Declared here |
emitter | variable | Inherited from AudioContext |
iparams | variable | Inherited from AudioContext |
oparams | variable | Inherited from AudioContext |
stream | variable | Inherited from AudioContext |
ctx | variable | Inherited from AudioContext |
codec | variable | Inherited from AudioContext |
frame | variable | Inherited from AudioContext |
resampler | variable | Inherited from AudioContext |
outputFrameSize | variable | Inherited from AudioContext |
time | variable | Inherited from AudioContext |
pts | variable | Inherited from AudioContext |
seconds | variable | Inherited from AudioContext |
error | variable | Inherited from AudioContext |
AudioContext | function | Inherited from AudioContext |
~AudioContext | function | Inherited from AudioContext |
AudioContext | function | Inherited from AudioContext |
operator= | function | Inherited from AudioContext |
AudioContext | function | Inherited from AudioContext |
operator= | function | Inherited from AudioContext |
create | function | Inherited from AudioContext |
open | function | Inherited from AudioContext |
close | function | Inherited from AudioContext |
decode | function | Inherited from AudioContext |
encode | function | Inherited from AudioContext |
encode | function | Inherited from AudioContext |
encode | function | Inherited from AudioContext |
flush | function | Inherited from AudioContext |
recreateResampler | function | Inherited from AudioContext |
Inherited from AudioContext
| Kind | Name | Description |
|---|---|---|
variable | emitter | |
variable | iparams | input parameters |
variable | oparams | output parameters |
variable | stream | encoder or decoder stream |
variable | ctx | encoder or decoder context |
variable | codec | encoder or decoder codec |
variable | frame | last encoded or decoded frame |
variable | resampler | audio resampler |
variable | outputFrameSize | encoder or decoder output frame size |
variable | time | stream time in codec time base |
variable | pts | last packet pts value |
variable | seconds | audio time in seconds |
variable | error | error message |
function | AudioContext | |
function | ~AudioContext virtual noexcept | |
function | AudioContext | Deleted constructor. |
function | operator= | Deleted assignment operator. |
function | AudioContext | Deleted constructor. |
function | operator= | Deleted assignment operator. |
function | create virtual | Initialise the AVCodecContext with codec-specific defaults. Implemented by AudioEncoder and AudioDecoder. |
function | open virtual | Open the codec and create the resampler if input/output parameters differ. Throws std::runtime_error if the codec context has not been created. |
function | close virtual | Close the codec context, free the frame, and reset timestamps. |
function | decode virtual | Decode a compressed audio packet and emit the resulting samples. |
function | encode virtual | Encode a buffer of interleaved audio samples. |
function | encode virtual | Encode a buffer of planar audio samples. |
function | encode virtual | Encode a single AVFrame. |
function | flush virtual | Flush any frames buffered inside the codec and emit remaining output. |
function | recreateResampler virtual | Recreate the AudioResampler using the current iparams and oparams. Called automatically by open() when format conversion is required. |
Public Attributes
| Return | Name | Description |
|---|---|---|
av::AudioBuffer | fifo | |
AVFormatContext * | format | |
int64_t | nextOutputPts | Running PTS counter for encoder output, in encoder time_base units. Anchored to the first input packet's PTS, then advanced by frame->nb_samples per encoded frame. AV_NOPTS_VALUE before anchoring. |
fifo
av::AudioBuffer fifoType: av::AudioBuffer
Defined in src/av/include/icy/av/audioencoder.h:74
format
AVFormatContext * formatDefined in src/av/include/icy/av/audioencoder.h:75
nextOutputPts
int64_t nextOutputPts = AV_NOPTS_VALUEDefined in src/av/include/icy/av/audioencoder.h:80
Running PTS counter for encoder output, in encoder time_base units. Anchored to the first input packet's PTS, then advanced by frame->nb_samples per encoded frame. AV_NOPTS_VALUE before anchoring.
Public Methods
| Return | Name | Description |
|---|---|---|
AudioEncoder | Construct an encoder, optionally tied to an existing muxer context. | |
~AudioEncoder noexcept override | ||
void | create virtual override | Initialise the AVCodecContext using oparams. Adds an audio stream to format if one was provided at construction. |
void | close virtual override | Close and free the AVCodecContext, FIFO buffer, and associated resources. |
bool | encode virtual override | Encode interleaved audio samples. |
bool | encode virtual override | Encode planar audio samples. |
bool | encode virtual override | Encode a single AVFrame (typically from a decoder or resampler). |
void | flush virtual override | Flush remaining packets to be encoded. This method should be called once before stream closure. |
AudioEncoder
AudioEncoder(AVFormatContext * format = nullptr)Defined in src/av/include/icy/av/audioencoder.h:41
Construct an encoder, optionally tied to an existing muxer context.
Parameters
| Parameter | Type | Description |
|---|---|---|
format | AVFormatContext * | The AVFormatContext that will receive encoded packets, or nullptr for standalone use. |
~AudioEncoder
noexcept override
~AudioEncoder() noexcept overrideDefined in src/av/include/icy/av/audioencoder.h:42
create
virtual override
virtual void create() overrideDefined in src/av/include/icy/av/audioencoder.h:46
Initialise the AVCodecContext using oparams. Adds an audio stream to format if one was provided at construction.
Reimplements
close
virtual override
virtual void close() overrideDefined in src/av/include/icy/av/audioencoder.h:49
Close and free the AVCodecContext, FIFO buffer, and associated resources.
Reimplements
encode
virtual override
virtual bool encode(uint8_t * samples, const int numSamples, const int64_t pts) overrideDefined in src/av/include/icy/av/audioencoder.h:56
Encode interleaved audio samples.
Reimplements
Parameters
| Parameter | Type | Description |
|---|---|---|
samples | uint8_t * | The input samples to encode. |
numSamples | const int | The number of input samples per channel. |
pts | const int64_t | The input samples presentation timestamp. |
encode
virtual override
virtual bool encode(uint8_t * samples, const int numSamples, const int64_t pts) overrideDefined in src/av/include/icy/av/audioencoder.h:63
Encode planar audio samples.
Reimplements
Parameters
| Parameter | Type | Description |
|---|---|---|
samples | uint8_t * | The input samples to encode. |
numSamples | const int | The number of input samples per channel. |
pts | const int64_t | The input samples presentation timestamp. |
encode
virtual override
virtual bool encode(AVFrame * iframe) overrideDefined in src/av/include/icy/av/audioencoder.h:68
Encode a single AVFrame (typically from a decoder or resampler).
Returns
True if an encoded packet was produced and emitted.
Reimplements
Parameters
| Parameter | Type | Description |
|---|---|---|
iframe | AVFrame * | The source audio frame with all fields set. |
flush
virtual override
virtual void flush() overrideDefined in src/av/include/icy/av/audioencoder.h:72
Flush remaining packets to be encoded. This method should be called once before stream closure.
