Home
AV module

AudioDecoder

Decodes compressed audio packets into raw sample frames.

AudioDecoder

#include <icy/av/audiodecoder.h>
struct AudioDecoder

Defined in src/av/include/icy/av/audiodecoder.h:28

Inherits: AudioContext

Decodes compressed audio packets into raw sample frames.

List of all members

NameKindOwner
AudioDecoderfunctionDeclared here
~AudioDecoderfunctionDeclared here
createfunctionDeclared here
closefunctionDeclared here
decodefunctionDeclared here
flushfunctionDeclared here
emittervariableInherited from AudioContext
iparamsvariableInherited from AudioContext
oparamsvariableInherited from AudioContext
streamvariableInherited from AudioContext
ctxvariableInherited from AudioContext
codecvariableInherited from AudioContext
framevariableInherited from AudioContext
resamplervariableInherited from AudioContext
outputFrameSizevariableInherited from AudioContext
timevariableInherited from AudioContext
ptsvariableInherited from AudioContext
secondsvariableInherited from AudioContext
errorvariableInherited from AudioContext
AudioContextfunctionInherited from AudioContext
~AudioContextfunctionInherited from AudioContext
AudioContextfunctionInherited from AudioContext
operator=functionInherited from AudioContext
AudioContextfunctionInherited from AudioContext
operator=functionInherited from AudioContext
createfunctionInherited from AudioContext
openfunctionInherited from AudioContext
closefunctionInherited from AudioContext
decodefunctionInherited from AudioContext
encodefunctionInherited from AudioContext
encodefunctionInherited from AudioContext
encodefunctionInherited from AudioContext
flushfunctionInherited from AudioContext
recreateResamplerfunctionInherited from AudioContext

Inherited from AudioContext

KindNameDescription
variableemitter
variableiparamsinput parameters
variableoparamsoutput parameters
variablestreamencoder or decoder stream
variablectxencoder or decoder context
variablecodecencoder or decoder codec
variableframelast encoded or decoded frame
variableresampleraudio resampler
variableoutputFrameSizeencoder or decoder output frame size
variabletimestream time in codec time base
variableptslast packet pts value
variablesecondsaudio time in seconds
variableerrorerror message
functionAudioContext
function~AudioContext virtual noexcept
functionAudioContextDeleted constructor.
functionoperator=Deleted assignment operator.
functionAudioContextDeleted constructor.
functionoperator=Deleted assignment operator.
functioncreate virtualInitialise the AVCodecContext with codec-specific defaults. Implemented by AudioEncoder and AudioDecoder.
functionopen virtualOpen the codec and create the resampler if input/output parameters differ. Throws std::runtime_error if the codec context has not been created.
functionclose virtualClose the codec context, free the frame, and reset timestamps.
functiondecode virtualDecode a compressed audio packet and emit the resulting samples.
functionencode virtualEncode a buffer of interleaved audio samples.
functionencode virtualEncode a buffer of planar audio samples.
functionencode virtualEncode a single AVFrame.
functionflush virtualFlush any frames buffered inside the codec and emit remaining output.
functionrecreateResampler virtualRecreate the AudioResampler using the current iparams and oparams. Called automatically by open() when format conversion is required.

Public Methods

ReturnNameDescription
AudioDecoderConstruct a decoder for the given stream. The codec parameters are read from the stream's codecpar.
voidcreate virtual overrideInitialise the AVCodecContext from the stream's codec parameters.
voidclose virtual overrideClose and free the AVCodecContext and associated resources.
booldecode virtual overrideDecode the given compressed audio packet and emit the decoded samples.
voidflush virtual overrideFlush any frames buffered inside the decoder. Call this after the last packet to retrieve all remaining decoded output.

AudioDecoder

AudioDecoder(AVStream * stream)

Defined in src/av/include/icy/av/audiodecoder.h:33

Construct a decoder for the given stream. The codec parameters are read from the stream's codecpar.

Parameters

  • stream The AVStream to decode; must remain valid for the lifetime of this decoder.

create

virtual override

virtual void create() override

Defined in src/av/include/icy/av/audiodecoder.h:37

Initialise the AVCodecContext from the stream's codec parameters.

Reimplements

close

virtual override

virtual void close() override

Defined in src/av/include/icy/av/audiodecoder.h:40

Close and free the AVCodecContext and associated resources.

Reimplements

decode

virtual override

virtual bool decode(AVPacket & ipacket) override

Defined in src/av/include/icy/av/audiodecoder.h:45

Decode the given compressed audio packet and emit the decoded samples.

Parameters

  • ipacket The compressed audio packet to decode.

Returns

True if one or more output frames were decoded and emitted, false otherwise.

Reimplements

flush

virtual override

virtual void flush() override

Defined in src/av/include/icy/av/audiodecoder.h:49

Flush any frames buffered inside the decoder. Call this after the last packet to retrieve all remaining decoded output.

Reimplements