From a2c1dfbabddc2b4abaf8bf27c9ed9d1b99594859 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 15 Jun 2023 10:33:46 +1000 Subject: Add vorbis and flac decoders, flesh out codec interface vorbis doesn't quite work yet, not sure why. will pick it up again later. --- src/codecs/include/mad.hpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/codecs/include/mad.hpp') diff --git a/src/codecs/include/mad.hpp b/src/codecs/include/mad.hpp index 5ba4db84..e1c479bf 100644 --- a/src/codecs/include/mad.hpp +++ b/src/codecs/include/mad.hpp @@ -24,12 +24,22 @@ class MadMp3Decoder : public ICodec { MadMp3Decoder(); ~MadMp3Decoder(); - auto GetOutputFormat() -> std::optional override; - auto SetInput(cpp::span input) -> void override; - auto GetInputPosition() -> std::size_t override; - auto ProcessNextFrame() -> cpp::result override; - auto WriteOutputSamples(cpp::span output) - -> std::pair override; + /* + * Returns the output format for the next frame in the stream. MP3 streams + * may represent multiple distinct tracks, with different bitrates, and so we + * handle the stream only on a frame-by-frame basis. + */ + auto BeginStream(cpp::span) -> Result override; + + /* + * Writes samples for the current frame. + */ + auto ContinueStream(cpp::span input, + cpp::span output) + -> Result override; + + auto SeekStream(cpp::span input, std::size_t target_sample) + -> Result override; private: mad_stream stream_; @@ -37,6 +47,8 @@ class MadMp3Decoder : public ICodec { mad_synth synth_; int current_sample_; + + auto GetInputPosition() -> std::size_t; }; } // namespace codecs -- cgit v1.2.3