#include <icy/av/audiocontext.h>Subclassed by:
AudioDecoder,AudioEncoder
Base context for audio encoding and decoding via FFmpeg.
| Return | Name | Description |
|---|---|---|
PacketSignal | emitter | |
AudioCodec | iparams | input parameters |
AudioCodec | oparams | output parameters |
AVStream * | stream | encoder or decoder stream |
AVCodecContext * | ctx | encoder or decoder context |
const AVCodec * | codec | encoder or decoder codec |
AVFrame * | frame | last encoded or decoded frame |
std::unique_ptr< AudioResampler > | resampler | audio resampler |
int | outputFrameSize | encoder or decoder output frame size |
int64_t | time | stream time in codec time base |
int64_t | pts | last packet pts value |
double | seconds | audio time in seconds |
std::string | error | error message |
PacketSignal emitterAudioCodec iparamsinput parameters
AudioCodec oparamsoutput parameters
AVStream * streamencoder or decoder stream
AVCodecContext * ctxencoder or decoder context
const AVCodec * codecencoder or decoder codec
AVFrame * framelast encoded or decoded frame
std::unique_ptr< AudioResampler > resampleraudio resampler
int outputFrameSizeencoder or decoder output frame size
int64_t timestream time in codec time base
int64_t ptslast packet pts value
double secondsaudio time in seconds
std::string errorerror message
| Return | Name | Description |
|---|---|---|
AudioContext | ||
AudioContext | Deleted constructor. | |
AudioContext | Deleted constructor. | |
void | create | Initialise the AVCodecContext with codec-specific defaults. Implemented by AudioEncoder and AudioDecoder. |
void | 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. |
void | close virtual | Close the codec context, free the frame, and reset timestamps. |
bool | decode virtual | Decode a compressed audio packet and emit the resulting samples. |
bool | encode virtual | Encode a buffer of interleaved audio samples. |
bool | encode virtual | Encode a buffer of planar audio samples. |
bool | encode virtual | Encode a single AVFrame. |
void | flush virtual | Flush any frames buffered inside the codec and emit remaining output. |
bool | recreateResampler virtual | Recreate the AudioResampler using the current iparams and oparams. Called automatically by open() when format conversion is required. |
AudioContext()AudioContext(const AudioContext &) = deleteDeleted constructor.
AudioContext(AudioContext &&) = deleteDeleted constructor.
void create()Initialise the AVCodecContext with codec-specific defaults. Implemented by AudioEncoder and AudioDecoder.
virtual
virtual void open()Open the codec and create the resampler if input/output parameters differ. Throws std::runtime_error if the codec context has not been created.
virtual
virtual void close()Close the codec context, free the frame, and reset timestamps.
virtual
virtual bool decode(AVPacket & ipacket)Decode a compressed audio packet and emit the resulting samples.
ipacket The compressed audio packet to decode.True if one or more decoded frames were emitted, false otherwise.
virtual
virtual bool encode(uint8_t * samples, int numSamples, int64_t pts)Encode a buffer of interleaved audio samples.
samples Pointer to the interleaved sample buffer.
numSamples Number of samples per channel.
pts Presentation timestamp in stream time base units.
True if an encoded packet was produced and emitted.
virtual
virtual bool encode(uint8_t * samples, int numSamples, int64_t pts)Encode a buffer of planar audio samples.
samples Array of per-channel sample buffers (up to 4 planes).
numSamples Number of samples per channel.
pts Presentation timestamp in stream time base units.
True if an encoded packet was produced and emitted.
virtual
virtual bool encode(AVFrame * iframe)Encode a single AVFrame.
iframe The source audio frame; must have all fields set correctly.True if an encoded packet was produced and emitted.
virtual
virtual void flush()Flush any frames buffered inside the codec and emit remaining output.
virtual
virtual bool recreateResampler()Recreate the AudioResampler using the current iparams and oparams. Called automatically by open() when format conversion is required.
True if the resampler was successfully created.