As part of mpg123 emulation, I've got to be able to seek in files and
also report where in the file we're currently playing (in verbose mode,
at least). Now, seeking isn't difficult: I just get the frame to which
the user wants to seek, count the frames mad's passing to the header function,
and return MAD_FLOW_IGNORE for every frame up to the one the user wants.
However, the second one is a bit more difficult. I need to know (a) how
many frames there are in any given file, and (b) how long the file is,
in time. Now there is a solution similar to the above one: do an initial
pass, returning MAD_FLOW_IGNORE for all the frames, and counting (a) the
frames and (b) the total length of the file. Now that I'm looking in
madplay, I notice that's somewhat along the lines of what's done in scan().
and calc() in madtime.c. Is this the only option? I assume it's not
horribly inefficient, anyways, as it seems to be in use in madplay.
Thanks again,
--
Joe Drew <hoserhead(a)woot.net> <drew(a)debian.org>
Please encrypt email sent to me.