[mad-dev] Seeking, frames and time
Rob Leslie
rob@mars.org
Thu, 20 Sep 2001 12:38:02 -0700
Joe Drew wrote:
> I'm not clear on how this is possible. The Xing tag tells us the number
> of frames and the length (in bytes) of the file, but we don't have a
> bitrate, so it's (apparently) not possible to calculate time. Or am I
> missing something? (I wasn't able to find any documentation on the Xing
> header anywhere, so I might be.)
Since each frame contains the same number of output samples, it's possible to
calculate playing time from the sampling frequency and number of frames.
This is where the new mad_timer_multiply() routine becomes handy. Just
multiply the duration of one frame (frame.header.duration) by the total number
of frames indicated by the Xing header.
Cheers,
-rob