19#ifdef USE_AUDIO_FLAC_SUPPORT
20#include <micro_flac/flac_decoder.h>
24#ifdef USE_AUDIO_MP3_SUPPORT
25#include <micro_mp3/mp3_decoder.h>
29#ifdef USE_AUDIO_OPUS_SUPPORT
30#include <micro_opus/ogg_opus_decoder.h>
34#ifdef USE_AUDIO_WAV_SUPPORT
35#include <micro_wav/wav_decoder.h>
66 AudioDecoder(
size_t input_buffer_size,
size_t output_buffer_size);
74 esp_err_t
add_source(std::weak_ptr<ring_buffer::RingBuffer> &input_ring_buffer);
79 esp_err_t
add_sink(std::weak_ptr<ring_buffer::RingBuffer> &output_ring_buffer);
124#ifdef USE_AUDIO_FLAC_SUPPORT
128#ifdef USE_AUDIO_MP3_SUPPORT
132#ifdef USE_AUDIO_OPUS_SUPPORT
136#ifdef USE_AUDIO_WAV_SUPPORT
optional< AudioStreamInfo > audio_stream_info_
esp_err_t add_source(std::weak_ptr< ring_buffer::RingBuffer > &input_ring_buffer)
Adds a source ring buffer for raw file data.
uint32_t accumulated_frames_written_
uint32_t get_playback_ms() const
Returns the duration of audio (in milliseconds) decoded and sent to the sink.
esp_err_t start(AudioFileType audio_file_type)
Sets up decoding the file.
FileDecoderState decode_opus_()
std::unique_ptr< AudioReadableBuffer > input_buffer_
std::unique_ptr< micro_flac::FLACDecoder > flac_decoder_
uint32_t potentially_failed_count_
size_t free_buffer_required_
const optional< audio::AudioStreamInfo > & get_audio_stream_info() const
Gets the audio stream information, if it has been decoded from the files header.
std::unique_ptr< micro_wav::WAVDecoder > wav_decoder_
std::unique_ptr< AudioSinkTransferBuffer > output_transfer_buffer_
esp_err_t add_sink(std::weak_ptr< ring_buffer::RingBuffer > &output_ring_buffer)
Adds a sink ring buffer for decoded audio.
size_t input_buffer_size_
AudioFileType audio_file_type_
FileDecoderState decode_flac_()
std::unique_ptr< micro_opus::OggOpusDecoder > opus_decoder_
void set_pause_output_state(bool pause_state)
Pauses sending resampled audio to the sink.
FileDecoderState decode_wav_()
AudioDecoderState decode(bool stop_gracefully)
Decodes audio from the ring buffer source and writes to the sink.
FileDecoderState decode_mp3_()
std::unique_ptr< micro_mp3::Mp3Decoder > mp3_decoder_
AudioDecoder(size_t input_buffer_size, size_t output_buffer_size)
Allocates the output transfer buffer and stores the input buffer size for later use by add_source()
Abstract interface for writing decoded audio data to a sink.