[xiph-cvs] cvs commit: vorbis-tools/ogg123 oggvorbis_format.c

Stan Seibert volsung at xiph.org
Fri Dec 14 08:46:12 PST 2001



volsung     01/12/14 08:46:12

  Modified:    ogg123   Tag: volsung_kc_20011011 oggvorbis_format.c
  Log:
  Fixed time output.  Apparently ov_time_tell() doesn't work quite right on
  non-seekable streams.

Revision  Changes    Path
No                   revision

No                   revision

1.1.2.6   +7 -3      vorbis-tools/ogg123/Attic/oggvorbis_format.c

Index: oggvorbis_format.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/Attic/oggvorbis_format.c,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- oggvorbis_format.c	2001/12/12 15:52:25	1.1.2.5
+++ oggvorbis_format.c	2001/12/14 16:46:11	1.1.2.6
@@ -11,7 +11,7 @@
  *                                                                  *
  ********************************************************************
 
- last mod: $Id: oggvorbis_format.c,v 1.1.2.5 2001/12/12 15:52:25 volsung Exp $
+ last mod: $Id: oggvorbis_format.c,v 1.1.2.6 2001/12/14 16:46:11 volsung Exp $
 
  ********************************************************************/
 
@@ -200,8 +200,12 @@
   long instant_bitrate;
   long avg_bitrate;
 
-  priv->stats.total_time = ov_time_total(&priv->vf, -1);
-  priv->stats.current_time = ov_time_tell(&priv->vf);
+  /* ov_time_tell() doesn't work on non-seekable streams, so we use
+     ov_pcm_tell()  */
+  priv->stats.total_time = (double) ov_pcm_total(&priv->vf, -1) /
+    (double) decoder->actual_fmt.rate;
+  priv->stats.current_time = (double) ov_pcm_tell(&priv->vf) / 
+    (double) decoder->actual_fmt.rate;
 
   /* vorbisfile returns 0 when no bitrate change has occurred */
   instant_bitrate = ov_bitrate_instant(&priv->vf);

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list