From 1f1059843fa9ea7e8b6d9c288626dac9e2df67f2 Mon Sep 17 00:00:00 2001 From: Tom Kirchner Date: Sat, 11 Jan 2025 21:57:26 -0800 Subject: Rename VbrInfo to Mp3Info It can apply to CBR files too, when the marker is "Info" --- src/codecs/include/mad.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/codecs/include') diff --git a/src/codecs/include/mad.hpp b/src/codecs/include/mad.hpp index e28e32c8..274862f7 100644 --- a/src/codecs/include/mad.hpp +++ b/src/codecs/include/mad.hpp @@ -38,13 +38,13 @@ class MadMp3Decoder : public ICodec { private: auto SkipID3Tags(IStream& stream) -> std::optional; - struct VbrInfo { + struct Mp3Info { uint32_t length; std::optional bytes; std::optional> toc; }; - auto GetVbrInfo(const mad_header& header) -> std::optional; + auto GetMp3Info(const mad_header& header) -> std::optional; auto GetBytesUsed() -> std::size_t; -- cgit v1.2.3 From 3993835a35b1f7137c9d8665fb047a42e9ae6f94 Mon Sep 17 00:00:00 2001 From: Tom Kirchner Date: Sat, 11 Jan 2025 22:08:47 -0800 Subject: Extract gapless info from MP3 LAME header --- src/codecs/include/mad.hpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/codecs/include') diff --git a/src/codecs/include/mad.hpp b/src/codecs/include/mad.hpp index 274862f7..fba3ef11 100644 --- a/src/codecs/include/mad.hpp +++ b/src/codecs/include/mad.hpp @@ -39,6 +39,7 @@ class MadMp3Decoder : public ICodec { auto SkipID3Tags(IStream& stream) -> std::optional; struct Mp3Info { + uint16_t starting_sample; uint32_t length; std::optional bytes; std::optional> toc; -- cgit v1.2.3 From b65713624f57d4b8918a0f27dab5eccb401f5e5a Mon Sep 17 00:00:00 2001 From: Tom Kirchner Date: Sat, 11 Jan 2025 22:18:11 -0800 Subject: Skip gap samples in MP3 decoding --- src/codecs/include/mad.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/codecs/include') diff --git a/src/codecs/include/mad.hpp b/src/codecs/include/mad.hpp index fba3ef11..60a0b81c 100644 --- a/src/codecs/include/mad.hpp +++ b/src/codecs/include/mad.hpp @@ -56,7 +56,14 @@ class MadMp3Decoder : public ICodec { std::unique_ptr frame_; std::unique_ptr 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_; }; -- cgit v1.2.3