You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to get length of audio file before reading each sample? #294
Today you can call total_duration() or still inspect size_hint().1 with #786. The first gives an Option<Duration>, the second Option<usize> in amount of samples. Besides @est31 being correct that size_hint() is not guaranteed to be accurate, with decoding you can anyway never guarantee it due to I/O errors, malformed packets, etc.
Activity
HalfVoxel commentedon Oct 3, 2020
source.size_hint().0should work.est31 commentedon Oct 3, 2020
size_hint is not required to be accurate.
roderickvd commentedon Aug 24, 2025
Today you can call
total_duration()or still inspectsize_hint().1with #786. The first gives anOption<Duration>, the secondOption<usize>in amount of samples. Besides @est31 being correct thatsize_hint()is not guaranteed to be accurate, with decoding you can anyway never guarantee it due to I/O errors, malformed packets, etc.