[vorbis-dev] ogg123 timekeeping

Kenneth Arnold kcarnold at yahoo.com
Wed Aug 2 12:41:12 PDT 2000



Argh! Didn't see ov_time_tell...

Now what I've got is much cleaner, and has no mistakes like the one pointed
out.

Time: 01:08.81 [04:07.93] of 05:16.73, Bitrate: 200.2

  if (param.verbose > 0)
    {
      info.u_time = ov_time_total (&vf, -1); /* Seconds with double
                                              * precision */
      t_min = (long) info.u_time / (long) 60;
      t_sec = info.u_time - 60 * t_min;
    }

  while (! eos)
    {
<...>
        if (param.verbose > 0)
          {
            info.u_pos = ov_time_tell (&vf);
            c_min = (long) info.u_pos / (long) 60;
            c_sec = info.u_pos - 60 * c_min;
            r_min = (long) (info.u_time - info.u_pos) / (long) 60;
            r_sec = (info.u_time - info.u_pos) - 60 * r_min;
            fprintf (stderr,
                     "\rTime: %02li:%05.2f [%02li:%05.2f] of %02li:%05.2f,"
                     " Bitrate: %.1f   \r",
                     c_min, c_sec,
                     r_min, r_sec,
                     t_min, t_sec,
                     (float) ov_bitrate_instant (&vf) / 1000.0F);
          }

Kenneth

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/



More information about the Vorbis-dev mailing list