blob: 2433da46e5553ffb00af883ea50a2663f57907f6 (
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
56
|
/*
* Copyright 2023 jacqueline <me@jacqueline.id.au>
*
* SPDX-License-Identifier: GPL-3.0-only
*/
#pragma once
#include <memory>
#include "codec.hpp"
#include "database/track.hpp"
#include "types.hpp"
namespace audio {
class TaggedStream : public codecs::IStream {
public:
TaggedStream(std::shared_ptr<database::TrackTags>,
std::unique_ptr<codecs::IStream> wrapped,
std::string path,
uint32_t offset = 0);
auto tags() -> std::shared_ptr<database::TrackTags>;
auto Read(std::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 Offset() -> uint32_t;
auto Filepath() -> std::string;
auto SetPreambleFinished() -> void override;
private:
std::shared_ptr<database::TrackTags> tags_;
std::unique_ptr<codecs::IStream> wrapped_;
std::string filepath_;
int32_t offset_;
};
class IAudioSource {
public:
virtual ~IAudioSource() {}
virtual auto HasNewStream() -> bool = 0;
virtual auto NextStream() -> std::shared_ptr<TaggedStream> = 0;
};
} // namespace audio
|