Adapter class which allows the AudioDecoder API on a StreamingDecoder.
More...
#include <StreamingDecoder.h>
|
int | id |
| custom id to be used by application
|
|
|
void | notifyAudioChange (AudioInfo info) |
|
void | setupLazy () |
| Performs lazy initialization of the ring buffer.
|
|
void | writeBlocking (Print *out, uint8_t *data, size_t len) |
|
Adapter class which allows the AudioDecoder API on a StreamingDecoder.
This adapter provides the reverse functionality of StreamingDecoderAdapter: it allows you to use a StreamingDecoder with the write-based AudioDecoder API. It uses a ring buffer and queue to convert write() calls into a stream that the StreamingDecoder can read from.
- Note
- This is useful when you have a StreamingDecoder but need to integrate it into code that expects the AudioDecoder write-based interface.
- Author
- Phil Schatzmann
- Copyright
- GPLv3
◆ DecoderAdapter()
Constructor.
- Parameters
-
dec | The StreamingDecoder to wrap |
bufferSize | Size of the internal ring buffer for data transfer |
◆ addNotifyAudioChange()
Adds target to be notified about audio changes.
Reimplemented in CodecNOP, EncodedAudioOutput, EncodedAudioStream, AACDecoderFDK, DecoderBasic, CodecChain, MP3DecoderHelix, MP3DecoderMAD, OggContainerDecoder, Pipeline, and Pipeline::ModifyingStreamAdapter.
◆ audioInfo()
|
inlineoverridevirtualinherited |
provides the actual input AudioInfo
Implements AudioInfoSupport.
Reimplemented in CodecNOP, GGWaveDecoder, DecoderBasic, DSFDecoder, MP3DecoderHelix, MP3DecoderMAD, OpusAudioDecoder, VorbisDecoder, WAVDecoder, WavIMADecoder, OggContainerDecoder, and VorbisDecoder.
◆ audioInfoOut()
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
Reimplemented in PureDataStream, PWMAudioOutput, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, Pipeline, ResampleStream, and ResampleStreamT< TInterpolator >.
◆ begin() [1/2]
◆ begin() [2/2]
|
inlineoverridevirtualinherited |
◆ end()
Stops the processing.
Marks this adapter as inactive. The wrapped StreamingDecoder is not explicitly stopped to allow continued use.
Reimplemented from AudioDecoder.
◆ getStreamingDecoder()
◆ isResultPCM()
virtual bool isResultPCM |
( |
| ) |
|
|
inlinevirtualinherited |
◆ operator bool()
Checks if the adapter is active.
- Returns
- true if the adapter is active, false otherwise
Implements AudioWriter.
◆ resize()
Resizes the internal buffer.
Changes the size of the ring buffer used for data transfer. The buffer is only allocated when first needed (lazy setup).
- Parameters
-
size | New buffer size in bytes |
◆ setAudioInfo()
|
inlineoverridevirtualinherited |
◆ setCodecConfig()
virtual bool setCodecConfig |
( |
const uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
|
inlinevirtualinherited |
Some decoders need e.g. a magic cookie to provide the relevant info for decoding.
Reimplemented in DecoderALAC, and MultiDecoder.
◆ setInput()
Sets the input stream for the wrapped decoder.
- Parameters
-
in | The input stream containing encoded audio data |
◆ setOutput() [1/3]
◆ setOutput() [2/3]
◆ setOutput() [3/3]
void setOutput |
( |
Print & |
out | ) |
|
|
inlineoverridevirtual |
Defines the output Stream.
Sets the output stream for the wrapped StreamingDecoder.
- Parameters
-
out | The output stream for decoded audio data |
Reimplemented from AudioDecoder.
◆ setupLazy()
Performs lazy initialization of the ring buffer.
The ring buffer is only allocated when first needed to save memory.
◆ write()
size_t write |
( |
const uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
|
inlineoverridevirtual |
Writes encoded audio data to be decoded.
The data is written to an internal queue, which is then processed by calling copy() on the wrapped StreamingDecoder.
- Parameters
-
data | Buffer containing encoded audio data |
len | Number of bytes to write |
- Returns
- Number of bytes actually written
Implements AudioWriter.
The documentation for this class was generated from the following file: