summaryrefslogtreecommitdiff
path: root/src/codecs/include/wavpack.hpp
diff options
context:
space:
mode:
authorcooljqln <cooljqln@noreply.codeberg.org>2025-03-19 04:18:10 +0000
committercooljqln <cooljqln@noreply.codeberg.org>2025-03-19 04:18:10 +0000
commit5995b3a48e73a19248f3d15b96bdb27144eabca2 (patch)
treec85ea1b5d86ff37276f37bc008993a8f940f1f6b /src/codecs/include/wavpack.hpp
parent34e7ce869b8d451e0586e96cc4dabbff8efb56d3 (diff)
parent885eb1812c15263ad759741ad138cf7188fdf739 (diff)
downloadtangara-fw-5995b3a48e73a19248f3d15b96bdb27144eabca2.tar.gz
Merge pull request 'WavPack and APEv2 tags support' (#218) from ayumi/tangara-fw:wavpack into main
Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/218
Diffstat (limited to 'src/codecs/include/wavpack.hpp')
-rw-r--r--src/codecs/include/wavpack.hpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/codecs/include/wavpack.hpp b/src/codecs/include/wavpack.hpp
new file mode 100644
index 00000000..4780b6b6
--- /dev/null
+++ b/src/codecs/include/wavpack.hpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2025 ayumi <ayumi@noreply.codeberg.org>
+ *
+ * SPDX-License-Identifier: GPL-3.0-only
+ */
+
+#pragma once
+
+#include <cstddef>
+#include <cstdint>
+#include <memory>
+#include <optional>
+#include <string>
+#include <utility>
+
+#include "wavpack.h"
+#include "sample.hpp"
+
+#include "codec.hpp"
+
+namespace codecs {
+
+class WavPackDecoder : public ICodec {
+ public:
+ WavPackDecoder();
+ ~WavPackDecoder();
+
+ auto OpenStream(std::shared_ptr<IStream> input, uint32_t offset)
+ -> cpp::result<OutputFormat, Error> override;
+
+ auto DecodeTo(std::span<sample::Sample> destination)
+ -> cpp::result<OutputInfo, Error> override;
+
+ WavPackDecoder(const WavPackDecoder&) = delete;
+ WavPackDecoder& operator=(const WavPackDecoder&) = delete;
+
+ private:
+ std::shared_ptr<IStream> input_;
+ WavpackContext wavpack_;
+ int32_t *buf_;
+ uint8_t bitdepth_;
+ uint8_t channels_;
+ size_t size_;
+};
+
+} // namespace codecs