19#ifdef USE_AUDIO_FLAC_SUPPORT
20#include <flac_decoder.h>
22#ifdef USE_AUDIO_MP3_SUPPORT
23#include <mp3_decoder.h>
25#include <wav_decoder.h>
56 AudioDecoder(
size_t input_buffer_size,
size_t output_buffer_size);
64 esp_err_t
add_source(std::weak_ptr<RingBuffer> &input_ring_buffer);
69 esp_err_t
add_sink(std::weak_ptr<RingBuffer> &output_ring_buffer);
104#ifdef USE_AUDIO_FLAC_SUPPORT
108#ifdef USE_AUDIO_MP3_SUPPORT
optional< AudioStreamInfo > audio_stream_info_
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.
esp_audio_libs::helix_decoder::HMP3Decoder mp3_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< esp_audio_libs::flac::FLACDecoder > flac_decoder_
~AudioDecoder()
Deallocates the MP3 decoder (the flac and wav decoders are deallocated automatically)
std::unique_ptr< AudioSinkTransferBuffer > output_transfer_buffer_
AudioFileType audio_file_type_
FileDecoderState decode_flac_()
esp_err_t add_source(std::weak_ptr< RingBuffer > &input_ring_buffer)
Adds a source ring buffer for raw file data.
void set_pause_output_state(bool pause_state)
Pauses sending resampled audio to the sink.
std::unique_ptr< esp_audio_libs::wav_decoder::WAVDecoder > wav_decoder_
esp_err_t add_sink(std::weak_ptr< RingBuffer > &output_ring_buffer)
Adds a sink ring buffer for decoded audio.
std::unique_ptr< AudioSourceTransferBuffer > input_transfer_buffer_
FileDecoderState decode_wav_()
AudioDecoderState decode(bool stop_gracefully)
Decodes audio from the ring buffer source and writes to the sink.
FileDecoderState decode_mp3_()
AudioDecoder(size_t input_buffer_size, size_t output_buffer_size)
Allocates the input and output transfer buffers.
Providing packet encoding functions for exchanging data with a remote host.