Decoder for FLAC. Depends on https://github.com/pschatzmann/arduino-libflac. We support an efficient streaming API and an very memory intensitiv standard interface. So you should prefer the streaming interface where you call setOutput() before the begin and copy() in the loop. Validated with http://www.2l.no/hires/.
More...
#include <CodecFLAC.h>
|
| static void | error_callback (const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) |
| | Error callback.
|
| |
| static FLAC__StreamDecoderReadStatus | read_callback (const FLAC__StreamDecoder *decoder, FLAC__byte result_buffer[], size_t *bytes, void *client_data) |
| | Callback which reads from stream.
|
| |
| static FLAC__StreamDecoderWriteStatus | write_callback (const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *const buffer[], void *client_data) |
| | Output decoded result to final output stream.
|
| |
Decoder for FLAC. Depends on https://github.com/pschatzmann/arduino-libflac. We support an efficient streaming API and an very memory intensitiv standard interface. So you should prefer the streaming interface where you call setOutput() before the begin and copy() in the loop. Validated with http://www.2l.no/hires/.
- Author
- Phil Schatzmann
- Copyright
- GPLv3
◆ FLACDecoder()
◆ ~FLACDecoder()
Destructor - calls end();.
◆ addNotifyAudioChange()
Adds target to be notified about audio changes.
Reimplemented in CodecNOP, EncodedAudioOutput, EncodedAudioStream, AACDecoderFDK, DecoderBasic, CodecChain, MP3DecoderHelix, MP3DecoderMAD, OggContainerDecoder, RTSPClient< TcpClient, UdpSocket >, Pipeline, and Pipeline::ModifyingStreamAdapter.
◆ audioInfo()
Provides the audio information for the current stream.
Returns audio format information such as sample rate, channels, and bits per sample that was determined from the decoded audio stream.
- Returns
- AudioInfo structure containing format information
Implements StreamingDecoder.
◆ audioInfoOut()
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
Reimplemented in MP3EncoderShine, PureDataStream, PWMAudioOutput< PWMDriverT >, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, Pipeline, ResampleStream, and ResampleStreamT< TInterpolator >.
◆ begin()
Starts the processing.
Initializes the decoder and prepares it for processing audio data. Must be called before any copy() operations.
- Returns
- true if initialization was successful, false otherwise
Implements StreamingDecoder.
◆ clearNotifyAudioChange()
| virtual void clearNotifyAudioChange |
( |
| ) |
|
|
inlinevirtualinherited |
◆ copy()
Stream Interface: Process a single frame - only relevant when input stream has been defined.
Implements StreamingDecoder.
◆ copyAll()
Process all available data.
Convenience method that calls copy() repeatedly until all available data has been processed.
- Returns
- true if any data was processed, false if no data was available
◆ end()
Releases the reserved memory.
Cleans up any resources allocated by the decoder and stops processing.
Implements StreamingDecoder.
◆ error_callback()
| static void error_callback |
( |
const FLAC__StreamDecoder * |
decoder, |
|
|
FLAC__StreamDecoderErrorStatus |
status, |
|
|
void * |
client_data |
|
) |
| |
|
inlinestaticprotected |
◆ flush()
Process all data in the buffer.
◆ isEof()
We return eof when we were subsequently getting 0 bytes for the timeout period.
◆ isInputFromStream()
| bool isInputFromStream |
( |
| ) |
|
|
inlineprotected |
Check if input is directly from stream - instead of writes.
◆ isNotifyActive()
Checks if the automatic AudioInfo update is active.
◆ isOgg()
returns true of the stream is ogg
◆ mime()
◆ notifyAudioChange()
◆ operator bool()
Checks if the class is active.
- Returns
- true if the decoder is ready and active, false otherwise
Implements StreamingDecoder.
◆ read_callback()
| static FLAC__StreamDecoderReadStatus read_callback |
( |
const FLAC__StreamDecoder * |
decoder, |
|
|
FLAC__byte |
result_buffer[], |
|
|
size_t * |
bytes, |
|
|
void * |
client_data |
|
) |
| |
|
inlinestaticprotected |
Callback which reads from stream.
◆ readBytes()
| size_t readBytes |
( |
uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
|
inlineoverrideprotectedvirtual |
Reads bytes from the input stream.
Derived classes must implement this to read data from their input source.
- Parameters
-
| data | Buffer to store the read data |
| len | Maximum number of bytes to read |
- Returns
- Number of bytes actually read
Implements StreamingDecoder.
◆ removeNotifyAudioChange()
◆ setAudioInfo()
|
|
inlineoverrideprotectedvirtualinherited |
◆ setInput()
| void setInput |
( |
Stream & |
inStream | ) |
|
|
inlineinherited |
Stream Interface: Decode directly by taking data from the stream.
This is more efficient than feeding the decoder with write: just call copy() in the loop to process data from the input stream.
- Parameters
-
| inStream | The input stream containing encoded audio data |
◆ setMD5()
Activate/deactivate md5 checking: call this before calling begin()
◆ setNotifyActive()
| void setNotifyActive |
( |
bool |
flag | ) |
|
|
inlineinherited |
Deactivate/Reactivate automatic AudioInfo updates: (default is active)
◆ setOgg()
| void setOgg |
( |
bool |
isOgg | ) |
|
|
inline |
◆ setOutput() [1/3]
Defines the output streams and register to be notified.
Sets the output stream and registers for audio info change notifications.
- Parameters
-
| out_stream | The AudioOutput to write decoded audio data to |
Reimplemented in MultiStreamingDecoder.
◆ setOutput() [2/3]
Defines the output streams and register to be notified.
Sets the output stream and registers for audio info change notifications.
- Parameters
-
| out_stream | The AudioStream to write decoded audio data to |
Reimplemented in MultiStreamingDecoder.
◆ setOutput() [3/3]
| virtual void setOutput |
( |
Print & |
out_stream | ) |
|
|
inlinevirtualinherited |
◆ setTimeout()
| void setTimeout |
( |
uint64_t |
readTimeout = 10000 | ) |
|
|
inline |
◆ write_callback()
| static FLAC__StreamDecoderWriteStatus write_callback |
( |
const FLAC__StreamDecoder * |
decoder, |
|
|
const FLAC__Frame * |
frame, |
|
|
const FLAC__int32 *const |
buffer[], |
|
|
void * |
client_data |
|
) |
| |
|
inlinestaticprotected |
Output decoded result to final output stream.
◆ decoder
| FLAC__StreamDecoder* decoder = nullptr |
|
protected |
◆ info
◆ init_status
| FLAC__StreamDecoderInitStatus init_status |
|
protected |
◆ is_active
◆ is_md5_checing
| bool is_md5_checing = false |
|
protected |
◆ is_notify_active
| bool is_notify_active = true |
|
protectedinherited |
◆ is_ogg
◆ notify_vector
◆ p_input
Input stream for encoded audio data.
◆ p_print
Output stream for decoded PCM data.
◆ read_timeout_ms
| uint64_t read_timeout_ms = 10000 |
|
protected |
◆ time_last_read
| uint64_t time_last_read = 0 |
|
protected |
The documentation for this class was generated from the following file: