summaryrefslogtreecommitdiff
path: root/src/audio/include/fatfs_audio_input.hpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-05-02 19:12:26 +1000
committerjacqueline <me@jacqueline.id.au>2024-05-02 19:12:26 +1000
commit1573a8c4cde1cd9528b422b2dcc598e37ffe94a7 (patch)
treed162822b8fd7054f81bace0c7a65ab4d5e6f93ef /src/audio/include/fatfs_audio_input.hpp
parenta231fd1c8afedbeb14b0bc77d76bad61db986059 (diff)
downloadtangara-fw-1573a8c4cde1cd9528b422b2dcc598e37ffe94a7.tar.gz
WIP merge cyclically dependent components into one big component
Diffstat (limited to 'src/audio/include/fatfs_audio_input.hpp')
-rw-r--r--src/audio/include/fatfs_audio_input.hpp66
1 files changed, 0 insertions, 66 deletions
diff --git a/src/audio/include/fatfs_audio_input.hpp b/src/audio/include/fatfs_audio_input.hpp
deleted file mode 100644
index 10b7433e..00000000
--- a/src/audio/include/fatfs_audio_input.hpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2023 jacqueline <me@jacqueline.id.au>
- *
- * SPDX-License-Identifier: GPL-3.0-only
- */
-
-#pragma once
-
-#include <cstddef>
-#include <cstdint>
-#include <future>
-#include <memory>
-#include <string>
-
-#include "ff.h"
-#include "freertos/portmacro.h"
-
-#include "audio_source.hpp"
-#include "codec.hpp"
-#include "future_fetcher.hpp"
-#include "tag_parser.hpp"
-#include "tasks.hpp"
-#include "types.hpp"
-
-namespace audio {
-
-/*
- * Audio source that fetches data from a FatFs (or exfat i guess) filesystem.
- *
- * All public methods are safe to call from any task.
- */
-class FatfsAudioInput : public IAudioSource {
- public:
- explicit FatfsAudioInput(database::ITagParser&, tasks::WorkerPool&);
- ~FatfsAudioInput();
-
- /*
- * Immediately cease reading any current source, and begin reading from the
- * given file path.
- */
- auto SetPath(std::optional<std::string>) -> void;
- auto SetPath(const std::string&,uint32_t offset = 0) -> void;
- auto SetPath() -> void;
-
- auto HasNewStream() -> bool override;
- auto NextStream() -> std::shared_ptr<TaggedStream> override;
-
- FatfsAudioInput(const FatfsAudioInput&) = delete;
- FatfsAudioInput& operator=(const FatfsAudioInput&) = delete;
-
- private:
- auto OpenFile(const std::string& path,uint32_t offset) -> bool;
-
- auto ContainerToStreamType(database::Container)
- -> std::optional<codecs::StreamType>;
-
- database::ITagParser& tag_parser_;
- tasks::WorkerPool& bg_worker_;
-
- std::mutex new_stream_mutex_;
- std::shared_ptr<TaggedStream> new_stream_;
-
- std::atomic<bool> has_new_stream_;
-};
-
-} // namespace audio