[vorbis-dev] getting playback length from ogg vorbis file
Jack Angel
man at oceanography.ru
Fri Jul 11 17:06:00 PDT 2003
On Sat, 12 Jul 2003 03:33:49 +0400
Jack Angel <man at oceanography.ru> wrote:
A little bug in my diff
I wrote %02ld where %03ld should be
Here's an update:
<p><p>diff -r -c vorbis-tools-1.0/ogginfo/ogginfo2.c vorbis-tools-1.0-new/ogginfo/ogginfo2.c
*** vorbis-tools-1.0/ogginfo/ogginfo2.c Fri Jul 19 10:26:54 2002
--- vorbis-tools-1.0-new/ogginfo/ogginfo2.c Sat Jul 12 03:23:07 2003
***************
*** 373,391 ****
static void vorbis_end(stream_processor *stream)
{
misc_vorbis_info *inf = stream->data;
! long minutes, seconds;
double bitrate, time;
time = (double)inf->lastgranulepos / inf->vi.rate;
minutes = (long)time / 60;
seconds = (long)time - minutes*60;
bitrate = inf->bytes*8 / time / 1000.0;
info(_("Vorbis stream %d:\n"
"\tTotal data length: %ld bytes\n"
! "\tPlayback length: %ldm:%02lds\n"
"\tAverage bitrate: %f kbps\n"),
! stream->num,inf->bytes, minutes, seconds, bitrate);
vorbis_comment_clear(&inf->vc);
vorbis_info_clear(&inf->vi);
--- 373,392 ----
static void vorbis_end(stream_processor *stream)
{
misc_vorbis_info *inf = stream->data;
! long minutes, seconds, milliseconds;
double bitrate, time;
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;
info(_("Vorbis stream %d:\n"
"\tTotal data length: %ld bytes\n"
! "\tPlayback length: %ldm:%02ld.%03lds\n"
"\tAverage bitrate: %f kbps\n"),
! stream->num,inf->bytes, minutes, seconds, milliseconds, bitrate);
vorbis_comment_clear(&inf->vc);
vorbis_info_clear(&inf->vi);
<p><p>
--
The human knowledge belongs to the world
--- >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 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 Vorbis-dev
mailing list