summaryrefslogtreecommitdiff
path: root/src/audio/include/readahead_source.hpp
diff options
context:
space:
mode:
authorailurux <ailuruxx@gmail.com>2024-05-10 13:06:20 +1000
committerailurux <ailuruxx@gmail.com>2024-05-10 13:06:20 +1000
commit3f177cdb8880abf199f4445f1398cd69fb813892 (patch)
treee20de4949b1344c826e5af41ab701f3db75b21bc /src/audio/include/readahead_source.hpp
parent8019c7691889cde4c3d40bbd78d485a92d713bbf (diff)
parente4ce7c4ac23402e09be8d6a52e0f739c0dff4ff0 (diff)
downloadtangara-fw-3f177cdb8880abf199f4445f1398cd69fb813892.tar.gz
Merge branch 'main' into file-browser
Diffstat (limited to 'src/audio/include/readahead_source.hpp')
-rw-r--r--src/audio/include/readahead_source.hpp60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/audio/include/readahead_source.hpp b/src/audio/include/readahead_source.hpp
deleted file mode 100644
index 3e18a989..00000000
--- a/src/audio/include/readahead_source.hpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2023 jacqueline <me@jacqueline.id.au>
- *
- * SPDX-License-Identifier: GPL-3.0-only
- */
-
-#pragma once
-
-#include <cstddef>
-#include <cstdint>
-#include <memory>
-
-#include "freertos/FreeRTOS.h"
-
-#include "ff.h"
-#include "freertos/stream_buffer.h"
-
-#include "audio_source.hpp"
-#include "codec.hpp"
-#include "tasks.hpp"
-
-namespace audio {
-
-/*
- * Wraps another stream, proactively buffering large chunks of it into memory
- * at a time.
- */
-class ReadaheadSource : public codecs::IStream {
- public:
- ReadaheadSource(tasks::WorkerPool&, std::unique_ptr<codecs::IStream>);
- ~ReadaheadSource();
-
- auto Read(cpp::span<std::byte> dest) -> ssize_t override;
-
- auto CanSeek() -> bool override;
-
- auto SeekTo(int64_t destination, SeekFrom from) -> void override;
-
- auto CurrentPosition() -> int64_t override;
-
- auto Size() -> std::optional<int64_t> override;
-
- auto SetPreambleFinished() -> void override;
-
- ReadaheadSource(const ReadaheadSource&) = delete;
- ReadaheadSource& operator=(const ReadaheadSource&) = delete;
-
- private:
- auto BeginReadahead() -> void;
-
- tasks::WorkerPool& worker_;
- std::unique_ptr<codecs::IStream> wrapped_;
-
- bool readahead_enabled_;
- std::atomic<bool> is_refilling_;
- StreamBufferHandle_t buffer_;
- int64_t tell_;
-};
-
-} // namespace audio