Re: [mpg123-users] How to calculate play time?
Brought to you by:
sobukus
From: Miro K. <mir...@gm...> - 2013-03-08 13:01:36
|
Hm, after more precise look it seems that only the integral cut is a problem, when I do something as (int)ceil(seconds_left) it seems to work... anyway, I'd still be interested how I'm supposed to calculate the playtime without this "deprecated" function... On Fri, Mar 8, 2013 at 1:38 PM, Miro Kropáček <mir...@gm...>wrote: > Hi, > > I'm a very happy user of your amazing library, even on low cost hardware > (motorola 68060@66 MHz) works like a charm. My player ( > http://mxplay.sourceforge.net) tries to show remaining play time on a > panel. I used for this, despite the warning in function description, this > piece of code: > > off_t current_frame; > off_t frames_left; > double current_seconds; > double seconds_left; > if( mpg123_position( mh, 0, 0, ¤t_frame, &frames_left, > ¤t_seconds, &seconds_left) != MPG123_OK ) > { > return MXP_ERROR; > } > else > { > return (int)seconds_left; > } > > which seemed to do the right thing. However, users report that it cuts > songs by ~2 seconds, I can confirm that, too. I could understand cut by ~1 > second (due to taking the integer part only) but 2 seconds seems to be > quite a lot. > > Is there any better (and universal, for example for variable bitrates) way > how to calculate this? > > > -- > MiKRO / Mystic Bytes > http://mikro.atari.org -- MiKRO / Mystic Bytes http://mikro.atari.org |