Jack Pavlovsky
2003-Nov-25 08:28 UTC
[vorbis-dev] ogginfo: playlength display in milliseconds
Hello
Some time ago I posted a lil' patch to this list which adds milliseconds
display of
playlength to ogginfo. Some folks replied that it's plausible and this patch
will be
merged to the next version. Vorbistools-1.0.1 got out and the patch is not in
it. Why?
Anyway, here's this patch for vorbistools-1.0.1. I hope this time you will
include it,
because milliseconds support is crucial to one of my application (which is
written in
bash and uses ogginfo to get quite-precise play length of tracks).
Best regards,
Jack Angel
--
The human knowledge belongs to the world
diff -Nur vorbis-tools-1.0.1/ogginfo/ogginfo2.c
vorbis-tools-1.0.1-msecs/ogginfo/ogginfo2.c
--- vorbis-tools-1.0.1/ogginfo/ogginfo2.c 2003-09-10 19:05:09.000000000 +0400
+++ vorbis-tools-1.0.1-msecs/ogginfo/ogginfo2.c 2003-11-23 20:14:45.000000000
+0300
@@ -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>--- >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
'vorbis-dev-request@xiph.org'
containing only the word 'unsubscribe' in the body. No subject is
needed.
Unsubscribe messages sent to the list will be ignored/filtered.
Carsten Haese
2003-Nov-25 09:03 UTC
[vorbis-dev] ogginfo: playlength display in milliseconds
On Tue, 2003-11-25 at 11:28, Jack Pavlovsky wrote:> Hello > > Some time ago I posted a lil' patch to this list which adds milliseconds display of > playlength to ogginfo. Some folks replied that it's plausible and this patch will be > merged to the next version. Vorbistools-1.0.1 got out and the patch is not in it. Why? > Anyway, here's this patch for vorbistools-1.0.1. I hope this time you will include it, > because milliseconds support is crucial to one of my application (which is written in > bash and uses ogginfo to get quite-precise play length of tracks). > > Best regards, > Jack AngelThe original patch must have slipped through the cracks. Thanks for updating and resubmitting the patch. It's in CVS now. -Carsten. <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 'vorbis-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.