ESPHome 2026.3.0
Loading...
Searching...
No Matches
audio_file_media_source.h
Go to the documentation of this file.
1#pragma once
2
4
5#ifdef USE_ESP32
6
12
13#include <freertos/FreeRTOS.h>
14#include <freertos/event_groups.h>
15
16namespace esphome::audio_file {
17
18enum class AudioFileDecodingState : uint8_t {
21 IDLE,
22};
23
25 public:
26 void setup() override;
27 void loop() override;
28 void dump_config() override;
29
30 // MediaSource interface implementation
31 bool play_uri(const std::string &uri) override;
33 bool can_handle(const std::string &uri) const override { return uri.starts_with("audio-file://"); }
34
35 void set_task_stack_in_psram(bool task_stack_in_psram) { this->task_stack_in_psram_ = task_stack_in_psram; }
36
37 protected:
38 static void decode_task(void *params);
39
42 EventGroupHandle_t event_group_{nullptr};
44
46};
47
48} // namespace esphome::audio_file
49
50#endif // USE_ESP32
Helper for FreeRTOS static task management.
Definition static_task.h:15
bool can_handle(const std::string &uri) const override
void handle_command(media_source::MediaSourceCommand command) override
bool play_uri(const std::string &uri) override
void set_task_stack_in_psram(bool task_stack_in_psram)
Abstract base class for media sources MediaSource provides audio data to an orchestrator via the Medi...
MediaSourceCommand
Commands that are sent from the orchestrator to a media source.