diff options
| author | cooljqln <cooljqln@noreply.codeberg.org> | 2025-03-19 04:18:10 +0000 |
|---|---|---|
| committer | cooljqln <cooljqln@noreply.codeberg.org> | 2025-03-19 04:18:10 +0000 |
| commit | 5995b3a48e73a19248f3d15b96bdb27144eabca2 (patch) | |
| tree | c85ea1b5d86ff37276f37bc008993a8f940f1f6b /src/codecs/include | |
| parent | 34e7ce869b8d451e0586e96cc4dabbff8efb56d3 (diff) | |
| parent | 885eb1812c15263ad759741ad138cf7188fdf739 (diff) | |
| download | tangara-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')
| -rw-r--r-- | src/codecs/include/types.hpp | 1 | ||||
| -rw-r--r-- | src/codecs/include/wavpack.hpp | 46 |
2 files changed, 47 insertions, 0 deletions
diff --git a/src/codecs/include/types.hpp b/src/codecs/include/types.hpp index 2bc63b10..493a177a 100644 --- a/src/codecs/include/types.hpp +++ b/src/codecs/include/types.hpp @@ -17,6 +17,7 @@ enum class StreamType { kOpus, kWav, kNative, + kWavPack, }; auto StreamTypeToString(StreamType t) -> std::string; 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 |
