/* * Copyright 2023 jacqueline * * SPDX-License-Identifier: GPL-3.0-only */ #pragma once #include #include #include #include #include #include "arena.hpp" #include "chunk.hpp" #include "freertos/FreeRTOS.h" #include "ff.h" #include "freertos/message_buffer.h" #include "freertos/queue.h" #include "span.hpp" #include "track.hpp" #include "audio_element.hpp" #include "stream_buffer.hpp" #include "stream_info.hpp" #include "types.hpp" namespace audio { class FatfsAudioInput : public IAudioElement { public: FatfsAudioInput(); ~FatfsAudioInput(); auto OpenFile(std::future>&& path) -> void; auto OpenFile(const std::string& path) -> bool; auto NeedsToProcess() const -> bool override; auto Process(const std::vector& inputs, OutputStream* output) -> void override; FatfsAudioInput(const FatfsAudioInput&) = delete; FatfsAudioInput& operator=(const FatfsAudioInput&) = delete; private: auto ContainerToStreamType(database::Encoding) -> std::optional; std::optional>> pending_path_; FIL current_file_; bool is_file_open_; std::optional current_container_; std::optional current_format_; }; } // namespace audio