[mad-dev] how to get time when play a mp3 using libmad

Rob Leslie rob@mars.org
Mon, 30 Dec 2002 22:24:52 -0800


On Monday, August 26, 2002, at 11:32  PM, Zhiwen Yang wrote:
> who can tell me how to get the time when i play a mp3 file using 
> libmad ?
> which function can i use ?

For each decoded frame, frame->header.duration contains the playing 
time of the samples produced by the frame. You can use the function 
mad_timer_add() to accumulate these times and obtain an accurate 
measure of absolute time position.

Use the other timer functions such as mad_timer_count() or 
mad_timer_string() to convert the internal timer value to a useful 
representation.

-- 
Rob Leslie
rob@mars.org