12#include <esp_http_client.h>
39 esp_err_t
add_sink(
const std::weak_ptr<RingBuffer> &output_ring_buffer);
76 esp_http_client_handle_t
client_{
nullptr};
uint32_t last_data_read_ms_
AudioReaderState http_read_()
void cleanup_connection_()
AudioReaderState file_read_()
std::unique_ptr< AudioSinkTransferBuffer > output_transfer_buffer_
const uint8_t * file_current_
static AudioFileType get_audio_type(const char *content_type)
Determines the audio file type from the http header's Content-Type key.
std::shared_ptr< RingBuffer > file_ring_buffer_
AudioReader(size_t buffer_size)
Constructs an AudioReader object.
AudioReaderState read()
Reads new file data from the source and sends to the ring buffer sink.
AudioFileType audio_file_type_
static esp_err_t http_event_handler(esp_http_client_event_t *evt)
Monitors the http client events to attempt determining the file type from the Content-Type header.
esp_http_client_handle_t client_
esp_err_t add_sink(const std::weak_ptr< RingBuffer > &output_ring_buffer)
Adds a sink ring buffer for audio data.
AudioFile * current_audio_file_
esp_err_t start(const std::string &uri, AudioFileType &file_type)
Starts reading an audio file from an http source.
Providing packet encoding functions for exchanging data with a remote host.