diff options
| author | Ailurux <ailuruxx@gmail.com> | 2023-06-19 11:21:32 +1000 |
|---|---|---|
| committer | Ailurux <ailuruxx@gmail.com> | 2023-06-19 11:21:32 +1000 |
| commit | 039272455acddbe446269ea4b6ef66f44f457f1e (patch) | |
| tree | 1e9a8173aeb4eb027701e89019e9410a9550d3cb /src/codecs/include/mad.hpp | |
| parent | 8ce751ad56c7efe19f835e3b6bbb1a843cef9119 (diff) | |
| parent | 6ff8b5886ef91ed46dba08686900d519f6c9c62d (diff) | |
| download | tangara-fw-039272455acddbe446269ea4b6ef66f44f457f1e.tar.gz | |
Merge branch 'main' of https://git.sr.ht/~jacqueline/tangara-fw
Diffstat (limited to 'src/codecs/include/mad.hpp')
| -rw-r--r-- | src/codecs/include/mad.hpp | 24 |
1 files changed, 18 insertions, 6 deletions
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<OutputFormat> override; - auto SetInput(cpp::span<const std::byte> input) -> void override; - auto GetInputPosition() -> std::size_t override; - auto ProcessNextFrame() -> cpp::result<bool, ProcessingError> override; - auto WriteOutputSamples(cpp::span<std::byte> output) - -> std::pair<std::size_t, bool> 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<const std::byte>) -> Result<OutputFormat> override; + + /* + * Writes samples for the current frame. + */ + auto ContinueStream(cpp::span<const std::byte> input, + cpp::span<std::byte> output) + -> Result<OutputInfo> override; + + auto SeekStream(cpp::span<const std::byte> input, std::size_t target_sample) + -> Result<void> 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 |
