summaryrefslogtreecommitdiff
path: root/src/codecs/include/mad.hpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2022-11-21 14:46:32 +1100
committerjacqueline <me@jacqueline.id.au>2022-11-21 14:46:32 +1100
commit9f8cfaa7a8abd885785830e03d7c417e856b8a22 (patch)
tree4077bb707efdcf0704287a8724d593eb05ba12c3 /src/codecs/include/mad.hpp
parent5f7444d7956a6cc517ada1b8b96c4f9cdd408fd5 (diff)
downloadtangara-fw-9f8cfaa7a8abd885785830e03d7c417e856b8a22.tar.gz
Implement using libmad to decode
Diffstat (limited to 'src/codecs/include/mad.hpp')
-rw-r--r--src/codecs/include/mad.hpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/codecs/include/mad.hpp b/src/codecs/include/mad.hpp
new file mode 100644
index 00000000..cfe4eab7
--- /dev/null
+++ b/src/codecs/include/mad.hpp
@@ -0,0 +1,26 @@
+#pragma once
+
+#include "codec.hpp"
+
+namespace codecs {
+
+ class MadMp3Decoder : public ICodec {
+ public:
+ MadMp3Decoder();
+ ~MadMp3Decoder();
+
+ auto ProcessInput(Result *res, uint8_t *input, std::size_t input_len) -> void;
+ auto WriteOutputSamples(Result *res, uint8_t *output, std::size_t output_length) -> void;
+
+ private:
+ mad_stream stream_;
+ mad_frame frame_;
+ mad_synth synth_;
+
+ mad_header header_;
+ bool has_decoded_header_;
+
+ int current_sample_ = -1;
+ };
+
+} // namespace codecs