From 39f7545cd5ef7a30bbd482f3579df7744c6b688d Mon Sep 17 00:00:00 2001 From: jacqueline Date: Fri, 7 Jul 2023 15:29:47 +1000 Subject: wire up the playing screen with some real data Includes implementing song duration calculation for CBR MP3 files --- src/codecs/include/codec.hpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/codecs/include') diff --git a/src/codecs/include/codec.hpp b/src/codecs/include/codec.hpp index 4b5ab47f..299b16e4 100644 --- a/src/codecs/include/codec.hpp +++ b/src/codecs/include/codec.hpp @@ -7,6 +7,7 @@ #pragma once #include +#include #include #include @@ -50,6 +51,9 @@ class ICodec { uint8_t num_channels; uint8_t bits_per_sample; uint32_t sample_rate_hz; + + std::optional duration_seconds; + std::optional bits_per_second; }; /* -- cgit v1.2.3 From 8f8bc1f088b389a683735d626cbce9adb1f6dc17 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Fri, 7 Jul 2023 18:26:10 +1000 Subject: vbr-compatible mp3 duration :) --- src/codecs/include/mad.hpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/codecs/include') diff --git a/src/codecs/include/mad.hpp b/src/codecs/include/mad.hpp index d2643230..fbae560c 100644 --- a/src/codecs/include/mad.hpp +++ b/src/codecs/include/mad.hpp @@ -42,6 +42,8 @@ class MadMp3Decoder : public ICodec { -> Result override; private: + auto GetVbrLength(const mad_header& header) -> std::optional; + mad_stream stream_; mad_frame frame_; mad_synth synth_; -- cgit v1.2.3