diff options
| author | cooljqln <cooljqln@noreply.codeberg.org> | 2025-08-08 03:32:41 +0200 |
|---|---|---|
| committer | cooljqln <cooljqln@noreply.codeberg.org> | 2025-08-08 03:32:41 +0200 |
| commit | cb4fcdc040201c707777a543edba1709b2af6cea (patch) | |
| tree | 6d6c735c821099a1438a79ae8805854b320ee2cf | |
| parent | fd064b996a432074b3e5c18b6a8c5439a372f281 (diff) | |
| parent | e25b71e5bd200501a63398b9d11e484d7baf25b6 (diff) | |
| download | tangara-fw-cb4fcdc040201c707777a543edba1709b2af6cea.tar.gz | |
Merge pull request 'Add support for the `SetPreambleFinished` hint in the WavPack decoder' (#419) from ayumi/tangara-fw:wavpack into main
Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/419
| -rw-r--r-- | src/codecs/wavpack.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/codecs/wavpack.cpp b/src/codecs/wavpack.cpp index 709302e6..d070701f 100644 --- a/src/codecs/wavpack.cpp +++ b/src/codecs/wavpack.cpp @@ -66,6 +66,7 @@ auto WavPackDecoder::OpenStream(std::shared_ptr<IStream> input, uint32_t offset) channels_ = WavpackGetReducedChannels(&wavpack_); bitdepth_ = WavpackGetBitsPerSample(&wavpack_); size_ = kBufSize / channels_; + const auto size = input->Size(); const std::optional total = WavpackGetNumSamples(&wavpack_) == -1 ? std::nullopt : std::optional( @@ -114,6 +115,7 @@ auto WavPackDecoder::OpenStream(std::shared_ptr<IStream> input, uint32_t offset) return cpp::fail(Error::kMalformedData); } + input_->SetPreambleFinished(); uint32_t samples = 0; for (size_t i = 0, n = target / size_; i < n; i++) samples += WavpackUnpackSamples(&wavpack_, buf_, size_); @@ -130,9 +132,9 @@ auto WavPackDecoder::OpenStream(std::shared_ptr<IStream> input, uint32_t offset) } else if (offset && (!total || !input_.get()->CanSeek())) { ESP_LOGE(kTag, "seeking: can’t seek"); return cpp::fail(Error::kInternalError); - } + } else + input_->SetPreambleFinished(); - const auto size = input->Size(); return OutputFormat{ .num_channels = channels_, .sample_rate_hz = rate, |
