summaryrefslogtreecommitdiff
path: root/src/tangara/audio/audio_source.cpp
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/tangara/audio/audio_source.cpp
parent8019c7691889cde4c3d40bbd78d485a92d713bbf (diff)
parente4ce7c4ac23402e09be8d6a52e0f739c0dff4ff0 (diff)
downloadtangara-fw-3f177cdb8880abf199f4445f1398cd69fb813892.tar.gz
Merge branch 'main' into file-browser
Diffstat (limited to 'src/tangara/audio/audio_source.cpp')
-rw-r--r--src/tangara/audio/audio_source.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/tangara/audio/audio_source.cpp b/src/tangara/audio/audio_source.cpp
new file mode 100644
index 00000000..4989c470
--- /dev/null
+++ b/src/tangara/audio/audio_source.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2023 jacqueline <me@jacqueline.id.au>
+ *
+ * SPDX-License-Identifier: GPL-3.0-only
+ */
+
+#include "audio/audio_source.hpp"
+#include "codec.hpp"
+#include "types.hpp"
+
+namespace audio {
+
+TaggedStream::TaggedStream(std::shared_ptr<database::TrackTags> t,
+ std::unique_ptr<codecs::IStream> w,
+ std::string filepath,
+ uint32_t offset)
+ : codecs::IStream(w->type()),
+ tags_(t),
+ wrapped_(std::move(w)),
+ filepath_(filepath),
+ offset_(offset) {}
+
+auto TaggedStream::tags() -> std::shared_ptr<database::TrackTags> {
+ return tags_;
+}
+
+auto TaggedStream::Read(std::span<std::byte> dest) -> ssize_t {
+ return wrapped_->Read(dest);
+}
+
+auto TaggedStream::CanSeek() -> bool {
+ return wrapped_->CanSeek();
+}
+
+auto TaggedStream::SeekTo(int64_t destination, SeekFrom from) -> void {
+ wrapped_->SeekTo(destination, from);
+}
+
+auto TaggedStream::CurrentPosition() -> int64_t {
+ return wrapped_->CurrentPosition();
+}
+
+auto TaggedStream::Size() -> std::optional<int64_t> {
+ return wrapped_->Size();
+}
+
+auto TaggedStream::Offset() -> uint32_t {
+ return offset_;
+}
+
+auto TaggedStream::Filepath() -> std::string {
+ return filepath_;
+}
+
+auto TaggedStream::SetPreambleFinished() -> void {
+ wrapped_->SetPreambleFinished();
+}
+
+} // namespace audio