I would like to know the number of samples in a file before I decode it (#21). An obvious way to do this would be to iterate over all frames and sum the sample count of each frame. But there is a problem. Iterating over a frame necessarily means decoding the samples. If I want to do one pass getting sample count and a second pass interpreting the sample, I will have to do the mp3 decode twice. This is inefficient.
Would it be possible to get a way to call next_frame() but only get sample_rate, channels etc and not data?
I would like to know the number of samples in a file before I decode it (#21). An obvious way to do this would be to iterate over all frames and sum the sample count of each frame. But there is a problem. Iterating over a frame necessarily means decoding the samples. If I want to do one pass getting sample count and a second pass interpreting the sample, I will have to do the mp3 decode twice. This is inefficient.
Would it be possible to get a way to call
next_frame()
but only getsample_rate
,channels
etc and notdata
?