diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-05-02 19:12:26 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-05-02 19:12:26 +1000 |
| commit | 1573a8c4cde1cd9528b422b2dcc598e37ffe94a7 (patch) | |
| tree | d162822b8fd7054f81bace0c7a65ab4d5e6f93ef /src/tangara/audio/audio_source.cpp | |
| parent | a231fd1c8afedbeb14b0bc77d76bad61db986059 (diff) | |
| download | tangara-fw-1573a8c4cde1cd9528b422b2dcc598e37ffe94a7.tar.gz | |
WIP merge cyclically dependent components into one big component
Diffstat (limited to 'src/tangara/audio/audio_source.cpp')
| -rw-r--r-- | src/tangara/audio/audio_source.cpp | 55 |
1 files changed, 55 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..ee2f617f --- /dev/null +++ b/src/tangara/audio/audio_source.cpp @@ -0,0 +1,55 @@ +/* + * Copyright 2023 jacqueline <me@jacqueline.id.au> + * + * SPDX-License-Identifier: GPL-3.0-only + */ + +#include "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 |
