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

Kenneth C. Arnold kcarnold at xiph.org
Fri Jun 22 17:28:18 PDT 2001



kcarnold    01/06/22 17:28:18

  Modified:    ogg123   Tag: kcarnold_work ogg123.c ogg123.h
  Log:
  Random munging with the buffer status stuff

Revision  Changes    Path
No                   revision

No                   revision

1.39.2.3  +6 -8      vorbis-tools/ogg123/ogg123.c

Index: ogg123.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/ogg123.c,v
retrieving revision 1.39.2.2
retrieving revision 1.39.2.3
diff -u -r1.39.2.2 -r1.39.2.3
--- ogg123.c	2001/06/23 00:17:43	1.39.2.2
+++ ogg123.c	2001/06/23 00:28:17	1.39.2.3
@@ -14,7 +14,7 @@
  *                                                                  *
  ********************************************************************
 
- last mod: $Id: ogg123.c,v 1.39.2.2 2001/06/23 00:17:43 kcarnold Exp $
+ last mod: $Id: ogg123.c,v 1.39.2.3 2001/06/23 00:28:17 kcarnold Exp $
 
  ********************************************************************/
 
@@ -503,7 +503,7 @@
                                 "\rTime: %02li:%05.2f [%02li:%05.2f] of %02li:%05.2f, Bitrate: %.1f, Buffer fill: %3.0f%%   \r",
                                 c_min, c_sec, r_min, r_sec, t_min, t_sec,
                                 (double) ov_bitrate_instant(&vf) / 1000.0F,
-				buffer_full(buffer)*100.0F);
+				(double) buffer_full(buffer) / (double) buffer->size * 100.0F);
                       else
                         fprintf(stderr,
                                 "\rTime: %02li:%05.2f [%02li:%05.2f] of %02li:%05.2f, Bitrate: %.1f   \r",
@@ -519,7 +519,7 @@
                                 "\rTime: %02li:%05.2f, Bitrate: %.1f, Buffer fill: %3.0f%%   \r",
                                 c_min, c_sec,
                                 (float) ov_bitrate_instant (&vf) / 1000.0F,
-				buffer_full(buffer)*100.0F);
+				(double) buffer_full(buffer) / (double) buffer->size * 100.0F);
                       else
                         fprintf(stderr,
                                 "\rTime: %02li:%05.2f, Bitrate: %.1f   \r",
@@ -623,15 +623,13 @@
     return 0;
 }
 
-double buffer_full (buf_t* buf) {
+long buffer_full (buf_t* buf) {
   chunk_t *reader = buf->reader; /* thread safety... */
-  int chunks;
 
   if (reader > buf->writer)
-    chunks = (reader - buf->writer);
+    return (reader - buf->writer + 1);
   else
-    chunks = (buf->end - reader) + (buf->writer - buf->buffer);
-  return (double) chunks / buf->size;
+    return (buf->end - reader) + (buf->writer - buf->buffer) + 2;
 }
 
 void buffer_cleanup (void) {

1.7.2.3   +1 -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.2
retrieving revision 1.7.2.3
diff -u -r1.7.2.2 -r1.7.2.3
--- ogg123.h	2001/06/23 00:17:43	1.7.2.2
+++ ogg123.h	2001/06/23 00:28:17	1.7.2.3
@@ -50,7 +50,7 @@
 int get_tcp_socket(void); /* Will be going soon. */
 FILE *http_open(char *server, int port, char *path); /* ditto */
 int open_audio_devices(ogg123_options_t *opt, int rate, int channels, buf_t ** buffer);
-double buffer_full (buf_t* buffer);
+long buffer_full (buf_t* buffer);
 void buffer_cleanup (void);
 void signal_quit (int ignored);
 

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