summaryrefslogtreecommitdiff
path: root/src/audio/audio_source.cpp
blob: d9e8e04a506239be6c263596052411e24e345d89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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(cpp::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