[xiph-cvs] cvs commit: vorbis-tools/ogginfo ogginfo2.c

Carsten Haese carsten at xiph.org
Tue Nov 25 09:02:49 PST 2003



carsten     03/11/25 12:02:49

  Modified:    ogginfo  ogginfo2.c
  Log:
  Patch by Jack Angel for displaying play time with millisecond precision.

Revision  Changes    Path
1.31      +6 -5      vorbis-tools/ogginfo/ogginfo2.c

Index: ogginfo2.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogginfo/ogginfo2.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- ogginfo2.c	18 Nov 2003 19:16:19 -0000	1.30
+++ ogginfo2.c	25 Nov 2003 17:02:48 -0000	1.31
@@ -384,27 +384,28 @@
 static void vorbis_end(stream_processor *stream) 
 {
     misc_vorbis_info *inf = stream->data;
-    long minutes, seconds;
+    long minutes, seconds, milliseconds;
     double bitrate, time;
 
     /* This should be lastgranulepos - startgranulepos, or something like that*/
     time = (double)inf->lastgranulepos / inf->vi.rate;
     minutes = (long)time / 60;
     seconds = (long)time - minutes*60;
+    milliseconds = (long)((time - minutes*60 - seconds)*1000);
     bitrate = inf->bytes*8 / time / 1000.0;
 
 #ifdef _WIN32
     info(_("Vorbis stream %d:\n"
            "\tTotal data length: %I64d bytes\n"
-           "\tPlayback length: %ldm:%02lds\n"
+           "\tPlayback length: %ldm:%02ld.%03lds\n"
            "\tAverage bitrate: %f kbps\n"), 
-            stream->num,inf->bytes, minutes, seconds, bitrate);
+            stream->num,inf->bytes, minutes, seconds, milliseconds, bitrate);
 #else
     info(_("Vorbis stream %d:\n"
            "\tTotal data length: %lld bytes\n"
-           "\tPlayback length: %ldm:%02lds\n"
+           "\tPlayback length: %ldm:%02ld.%03lds\n"
            "\tAverage bitrate: %f kbps\n"), 
-            stream->num,inf->bytes, minutes, seconds, bitrate);
+            stream->num,inf->bytes, minutes, seconds, milliseconds, bitrate);
 #endif
 
     vorbis_comment_clear(&inf->vc);

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