diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-07-07 15:30:19 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-07-07 15:30:19 +1000 |
| commit | b6e0e0dd4a177614797b6c6ac3b0c213d5a56f8a (patch) | |
| tree | 1bf97a9455e27840c4c6d65bc9cc9832e8379dea /src/codecs/mad.cpp | |
| parent | 5af0ff2972023f35d8930ab3189cf04f6d9ff21b (diff) | |
| parent | 39f7545cd5ef7a30bbd482f3579df7744c6b688d (diff) | |
| download | tangara-fw-b6e0e0dd4a177614797b6c6ac3b0c213d5a56f8a.tar.gz | |
Merge branch 'functional-playing'
Diffstat (limited to 'src/codecs/mad.cpp')
| -rw-r--r-- | src/codecs/mad.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/codecs/mad.cpp b/src/codecs/mad.cpp index 23b4ccf6..81daeb9f 100644 --- a/src/codecs/mad.cpp +++ b/src/codecs/mad.cpp @@ -6,6 +6,7 @@ #include "mad.hpp" #include <stdint.h> +#include <sys/_stdint.h> #include <cstdint> #include <optional> @@ -79,12 +80,19 @@ auto MadMp3Decoder::BeginStream(const cpp::span<const std::byte> input) } uint8_t channels = MAD_NCHANNELS(&header); - return {GetBytesUsed(input.size_bytes()), - OutputFormat{ - .num_channels = channels, - .bits_per_sample = 24, // We always scale to 24 bits - .sample_rate_hz = header.samplerate, - }}; + OutputFormat output{ + .num_channels = channels, + .bits_per_sample = 24, // We always scale to 24 bits + .sample_rate_hz = header.samplerate, + .duration_seconds = {}, + .bits_per_second = {}, + }; + + // TODO(jacqueline): Support VBR. Although maybe libtags is the better place + // to handle this? + output.bits_per_second = header.bitrate; + + return {GetBytesUsed(input.size_bytes()), output}; } auto MadMp3Decoder::ContinueStream(cpp::span<const std::byte> input, |
