diff options
| author | ailurux <ailuruxx@gmail.com> | 2024-04-02 11:13:50 +1100 |
|---|---|---|
| committer | ailurux <ailuruxx@gmail.com> | 2024-04-02 11:13:50 +1100 |
| commit | e20ebe7574db5aedc73f07b7bb3a0a01eae93c84 (patch) | |
| tree | 34c93ec8a80e282f3ce3e47dd60c41e46de0f8b3 /src/codecs/opus.cpp | |
| parent | a750af35aa6afda40aadca8f7cf8db75f41a43b2 (diff) | |
| parent | 0d0c4b2307cac8436fea7276956f293262b265ed (diff) | |
| download | tangara-fw-e20ebe7574db5aedc73f07b7bb3a0a01eae93c84.tar.gz | |
Merge branch 'main' into lua-volume
Diffstat (limited to 'src/codecs/opus.cpp')
| -rw-r--r-- | src/codecs/opus.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/codecs/opus.cpp b/src/codecs/opus.cpp index e4917a33..a5220c4b 100644 --- a/src/codecs/opus.cpp +++ b/src/codecs/opus.cpp @@ -78,7 +78,8 @@ XiphOpusDecoder::~XiphOpusDecoder() { } } -auto XiphOpusDecoder::OpenStream(std::shared_ptr<IStream> input) +auto XiphOpusDecoder::OpenStream(std::shared_ptr<IStream> input, + uint32_t offset) -> cpp::result<OutputFormat, Error> { input_ = input; @@ -128,6 +129,10 @@ auto XiphOpusDecoder::OpenStream(std::shared_ptr<IStream> input) length = l * 2; } + if (offset && op_pcm_seek(opus_, offset * 48000) != 0) { + return cpp::fail(Error::kInternalError); + } + return OutputFormat{ .num_channels = 2, .sample_rate_hz = 48000, @@ -151,11 +156,4 @@ auto XiphOpusDecoder::DecodeTo(cpp::span<sample::Sample> output) }; } -auto XiphOpusDecoder::SeekTo(size_t target) -> cpp::result<void, Error> { - if (op_pcm_seek(opus_, target) != 0) { - return cpp::fail(Error::kInternalError); - } - return {}; -} - } // namespace codecs |
