[Flac-dev] how to determine total time of a flac sound file?

Josh Coalson xflac at yahoo.com
Mon Jan 20 15:10:03 PST 2003


--- Wesley Leong <wyleong321 at hotmail.com> wrote:
> How do I determine the total time of a flac sound file by examining
> the 
> blocks and headers in the file?  I appreciate any help.

from the STREAMINFO block: if the total_samples field is not
0, then the length in seconds is total_samples / sample_rate.
if it is 0, the length of the stream is unknown.

you can use the metadata interface in libFLAC to get the values:
http://flac.sourceforge.net/api/group__flac__metadata__level0.html

or since the STREAMINFO block is always first you can get them
from absolute offsets; see http://flac.sourceforge.net/format.html

Josh


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com




More information about the Flac-dev mailing list