summaryrefslogtreecommitdiff
path: root/src/codecs/include
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-02-29 12:08:12 +1100
committerjacqueline <me@jacqueline.id.au>2024-02-29 12:08:12 +1100
commitd41f9f703375171d5766840c9edec32ff47bb25d (patch)
tree25028408ed16d5aad3bdb315b6503536a875c0ac /src/codecs/include
parent77145e56f4062cd060ee7fa0af9ad1a2e46df5b1 (diff)
downloadtangara-fw-d41f9f703375171d5766840c9edec32ff47bb25d.tar.gz
Use drflac instead of miniflac
This one is fast as hell! Does seeking really good too. Thank u Doctor Flac.
Diffstat (limited to 'src/codecs/include')
-rw-r--r--src/codecs/include/dr_flac.hpp (renamed from src/codecs/include/miniflac.hpp)19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/codecs/include/miniflac.hpp b/src/codecs/include/dr_flac.hpp
index d1daca2f..8dcfdaf5 100644
--- a/src/codecs/include/miniflac.hpp
+++ b/src/codecs/include/dr_flac.hpp
@@ -6,7 +6,6 @@
#pragma once
-#include <sys/_stdint.h>
#include <cstddef>
#include <cstdint>
#include <memory>
@@ -14,7 +13,7 @@
#include <string>
#include <utility>
-#include "miniflac.h"
+#include "dr_flac.h"
#include "sample.hpp"
#include "source_buffer.hpp"
#include "span.hpp"
@@ -23,10 +22,10 @@
namespace codecs {
-class MiniFlacDecoder : public ICodec {
+class DrFlacDecoder : public ICodec {
public:
- MiniFlacDecoder();
- ~MiniFlacDecoder();
+ DrFlacDecoder();
+ ~DrFlacDecoder();
auto OpenStream(std::shared_ptr<IStream> input,uint32_t offset)
-> cpp::result<OutputFormat, Error> override;
@@ -36,16 +35,12 @@ class MiniFlacDecoder : public ICodec {
auto SeekTo(std::size_t target_sample) -> cpp::result<void, Error> override;
- MiniFlacDecoder(const MiniFlacDecoder&) = delete;
- MiniFlacDecoder& operator=(const MiniFlacDecoder&) = delete;
+ DrFlacDecoder(const DrFlacDecoder&) = delete;
+ DrFlacDecoder& operator=(const DrFlacDecoder&) = delete;
private:
std::shared_ptr<IStream> input_;
- SourceBuffer buffer_;
-
- std::unique_ptr<miniflac_t> flac_;
- std::array<int32_t*, 2> samples_by_channel_;
- std::optional<size_t> current_sample_;
+ drflac *flac_;
};
} // namespace codecs