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

Kenneth C. Arnold kcarnold at xiph.org
Mon Aug 13 10:31:48 PDT 2001



kcarnold    01/08/13 10:31:47

  Modified:    ogg123   Tag: kcarnold_work curl_interface.h ogg123.c
  Log:
  Bugfix for running without buffer, status text fix, status indicator
  total time now increases so remaining time is never negative.

Revision  Changes    Path
No                   revision

No                   revision

1.1.2.6   +2 -1      vorbis-tools/ogg123/Attic/curl_interface.h

Index: curl_interface.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/Attic/curl_interface.h,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- curl_interface.h	2001/08/13 00:43:20	1.1.2.5
+++ curl_interface.h	2001/08/13 17:31:46	1.1.2.6
@@ -11,7 +11,7 @@
  *                                                                  *
  ********************************************************************
  
- last mod: $Id: curl_interface.h,v 1.1.2.5 2001/08/13 00:43:20 kcarnold Exp $
+ last mod: $Id: curl_interface.h,v 1.1.2.6 2001/08/13 17:31:46 kcarnold Exp $
  
 ********************************************************************/
 
@@ -32,6 +32,7 @@
   long Prebuffer;
   char seekable;
   double totalTime;
+  ogg_int64_t totalSamples;
 
   char *SaveStream;
   

1.39.2.18 +18 -5     vorbis-tools/ogg123/ogg123.c

Index: ogg123.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/ogg123.c,v
retrieving revision 1.39.2.17
retrieving revision 1.39.2.18
diff -u -r1.39.2.17 -r1.39.2.18
--- ogg123.c	2001/08/13 03:08:30	1.39.2.17
+++ ogg123.c	2001/08/13 17:31:46	1.39.2.18
@@ -14,7 +14,7 @@
  *                                                                  *
  ********************************************************************
 
- last mod: $Id: ogg123.c,v 1.39.2.17 2001/08/13 03:08:30 kcarnold Exp $
+ last mod: $Id: ogg123.c,v 1.39.2.18 2001/08/13 17:31:46 kcarnold Exp $
 
  ********************************************************************/
 
@@ -169,13 +169,22 @@
   double r_sec, t_sec;
 
   if (stats[2].enabled && Options.inputOpts.seekable) {
-    r_min = (long) (Options.inputOpts.totalTime - time) / (long) 60;
-    r_sec = ((double) Options.inputOpts.totalTime - time) - 60.0f * (double) r_min;
+    if (sample > Options.inputOpts.totalSamples) {
+      /* file probably grew while playing; update total time */
+      Options.inputOpts.totalSamples = sample;
+      Options.inputOpts.totalTime = time;
+      stats[3].arg.stringarg[0] = '\0';
+      r_min = 0;
+      r_sec = 0.0f;
+    } else {
+      r_min = (long) (Options.inputOpts.totalTime - time) / (long) 60;
+      r_sec = ((double) Options.inputOpts.totalTime - time) - 60.0f * (double) r_min;
+    }
     sprintf (stats[2].arg.stringarg, "[%02li:%05.2f]", r_min, r_sec);
     if (stats[3].arg.stringarg[0] == '\0') {
       t_min = (long) Options.inputOpts.totalTime / (long) 60;
       t_sec = Options.inputOpts.totalTime - 60.0f * t_min;
-      sprintf (stats[3].arg.stringarg, "of %02li:%05.2f", t_min, t_sec);
+      sprintf (stats[3].arg.stringarg, "%02li:%05.2f", t_min, t_sec);
     }    
   }
   sprintf (stats[1].arg.stringarg, "%02li:%05.2f", c_min, c_sec);
@@ -673,6 +682,7 @@
         
         Options.inputOpts.seekable = 1;
         Options.inputOpts.totalTime = ov_time_total(&vf, -1);
+	Options.inputOpts.totalSamples = ov_pcm_total(&vf, -1);
         Options.statOpts.stats[2].enabled = 1;
         Options.statOpts.stats[3].enabled = 1;
         if (Options.statOpts.verbose > 0)
@@ -778,7 +788,10 @@
     
     ov_clear(&vf);
     
-    buffer_MarkEOS (Options.outputOpts.buffer);
+    if (Options.outputOpts.buffer) {
+      buffer_MarkEOS (Options.outputOpts.buffer);
+      buffer_WaitForEmpty (Options.outputOpts.buffer);
+    }
 
     if (Options.statOpts.quiet < 1)
       fprintf(stderr, "\nDone.\n");

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