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

Stan Seibert volsung at xiph.org
Wed Nov 21 15:25:10 PST 2001



volsung     01/11/21 15:25:10

  Modified:    ogg123   Tag: volsung_kc_20011011 ogg123.c ogg123.h
  Log:
  Now the timer is correct when playing multiple songs.

Revision  Changes    Path
No                   revision

No                   revision

1.39.2.30.2.9 +6 -6      vorbis-tools/ogg123/ogg123.c

Index: ogg123.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/ogg123.c,v
retrieving revision 1.39.2.30.2.8
retrieving revision 1.39.2.30.2.9
diff -u -r1.39.2.30.2.8 -r1.39.2.30.2.9
--- ogg123.c	2001/11/21 22:57:23	1.39.2.30.2.8
+++ ogg123.c	2001/11/21 23:25:08	1.39.2.30.2.9
@@ -14,7 +14,7 @@
  *                                                                  *
  ********************************************************************
 
- last mod: $Id: ogg123.c,v 1.39.2.30.2.8 2001/11/21 22:57:23 volsung Exp $
+ last mod: $Id: ogg123.c,v 1.39.2.30.2.9 2001/11/21 23:25:08 volsung Exp $
 
  ********************************************************************/
 
@@ -287,23 +287,20 @@
 size_t OutBufferWrite(void *ptr, size_t size, size_t nmemb, void *arg,
                       char iseos)
 {
-  static ogg_int64_t cursample = 0;
   size_t origSize;
 
   origSize = size;
   size *= nmemb;
   
-  cursample += Options.playOpts.nth * size / Options.outputOpts.channels / 2 
+  Options.outputOpts.cursample += 
+    Options.playOpts.nth * size / Options.outputOpts.channels / 2 
     / Options.playOpts.ntimes; /* locked to 16-bit */
 
   devices_write (ptr, size, 1, Options.outputOpts.devices);
 
-  SetTime (Options.statOpts.stats, cursample);
+  SetTime (Options.statOpts.stats, Options.outputOpts.cursample);
   UpdateStats();
 
-  if (iseos)
-    cursample = 0;
-
   return origSize;
 }
 
@@ -849,6 +846,9 @@
     else
       Options.inputOpts.seekable = 0;
     
+
+    /* Reset the sample counter */
+    Options.outputOpts.cursample = 0;
 
     /* Start the audio playback thread before we begin sending data */    
     if (Options.outputOpts.buffer) {

1.7.2.12.2.3 +2 -1      vorbis-tools/ogg123/ogg123.h

Index: ogg123.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/ogg123.h,v
retrieving revision 1.7.2.12.2.2
retrieving revision 1.7.2.12.2.3
diff -u -r1.7.2.12.2.2 -r1.7.2.12.2.3
--- ogg123.h	2001/11/02 02:22:09	1.7.2.12.2.2
+++ ogg123.h	2001/11/21 23:25:09	1.7.2.12.2.3
@@ -11,7 +11,7 @@
  *                                                                  *
  ********************************************************************
 
- last mod: $Id: ogg123.h,v 1.7.2.12.2.2 2001/11/02 02:22:09 volsung Exp $
+ last mod: $Id: ogg123.h,v 1.7.2.12.2.3 2001/11/21 23:25:09 volsung Exp $
 
  ********************************************************************/
 
@@ -64,6 +64,7 @@
     buf_t *buffer;
     long BufferSize;
     float Prebuffer;
+    ogg_int64_t cursample;
     int rate, channels;         /* playback params for opening audio devices */
     char devicesOpen;
     devices_t *devices;

--- >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