diff options
| author | cooljqln <cooljqln@noreply.codeberg.org> | 2025-01-14 05:35:21 +0000 |
|---|---|---|
| committer | cooljqln <cooljqln@noreply.codeberg.org> | 2025-01-14 05:35:21 +0000 |
| commit | dfb4ea54581de68a042746e9f7291ac2f833d47d (patch) | |
| tree | 19cfa3f21ae8c678b0ca4eaa9c19c8c54e906a61 /src/codecs/include/mad.hpp | |
| parent | 1625d5a6b8d13ec26d76e5d32fa7641bf5f46c87 (diff) | |
| parent | b65713624f57d4b8918a0f27dab5eccb401f5e5a (diff) | |
| download | tangara-fw-dfb4ea54581de68a042746e9f7291ac2f833d47d.tar.gz | |
Merge pull request 'MP3 gap... less' (#180) from tjk/tangara-fw:mp3-gapless into main
Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/180
Reviewed-by: cooljqln <cooljqln@noreply.codeberg.org>
Diffstat (limited to 'src/codecs/include/mad.hpp')
| -rw-r--r-- | src/codecs/include/mad.hpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/codecs/include/mad.hpp b/src/codecs/include/mad.hpp index e28e32c8..60a0b81c 100644 --- a/src/codecs/include/mad.hpp +++ b/src/codecs/include/mad.hpp @@ -38,13 +38,14 @@ class MadMp3Decoder : public ICodec { private: auto SkipID3Tags(IStream& stream) -> std::optional<uint32_t>; - struct VbrInfo { + struct Mp3Info { + uint16_t starting_sample; uint32_t length; std::optional<uint32_t> bytes; std::optional<std::span<const unsigned char, 100>> toc; }; - auto GetVbrInfo(const mad_header& header) -> std::optional<VbrInfo>; + auto GetMp3Info(const mad_header& header) -> std::optional<Mp3Info>; auto GetBytesUsed() -> std::size_t; @@ -55,7 +56,14 @@ class MadMp3Decoder : public ICodec { std::unique_ptr<mad_frame> frame_; std::unique_ptr<mad_synth> synth_; - int current_sample_; + // Count of samples processed in the current frame (channels combined) + int current_frame_sample_; + // Count of samples processed in the current stream (channels separate, i.e. usually x2) + int current_stream_sample_; + // How many samples in the current stream (channels separate) with encoder delay/padding removed + int total_samples_; + // Encoder delay, i.e. how many samples to skip at the start of the stream + int skip_samples_; bool is_eof_; bool is_eos_; }; |
