[MPlayer-users] Getting current track time

Cameron McCormack cam-mplayer-users at aka.mcc.id.au
Sat Jul 24 04:55:05 CEST 2004


Hi.

I'm writing a program that will use mplayer as a backend for playing
audio tracks.  I want to be able to ask mplayer how far along the track
it has played.  There is a get_percent_pos command, but this only
returns an integral percentage of the track length, and I want something
more accurate (say, milliseconds).

Poking around, I've noticed in demux_audio.c the demux_audio_control
function has this line:

  int audio_length = demuxer->movi_end / sh_audio->i_bps;

I gather that this is just dividing the file size by the bps.  Will this
be accurate?  For something like WAVs I can imagine it'd be ok, since
the bps is constant throughout, but what about something like a VBR MP3?

Thanks,

Cameron

-- 
Cameron McCormack
|  Web: http://mcc.id.au/
|  ICQ: 26955922




More information about the MPlayer-users mailing list