Commit c64737f1 authored by Michael Smith's avatar Michael Smith

Detect another condition that things won't cope with very well, which occurs

with some files created by very buggy encoders (granulepos is not set on
ANY page except the header pages, and the final page in the stream)

svn path=/trunk/vorbis-tools/; revision=3794
parent 0256d2a9
......@@ -90,6 +90,7 @@ typedef struct {
long bytes;
ogg_int64_t lastgranulepos;
ogg_int64_t firstgranulepos;
int doneheaders;
} misc_vorbis_info;
......@@ -366,6 +367,11 @@ static void vorbis_process(stream_processor *stream, ogg_page *page )
inf->lastgranulepos, gp);
inf->lastgranulepos = gp;
}
else {
warn(_("Negative granulepos on vorbis stream outside of headers. This file was created by a buggy encoder\n"));
}
if(inf->firstgranulepos < 0) { /* Not set yet */
}
inf->bytes += page->header_len + page->body_len;
}
}
......@@ -376,6 +382,7 @@ static void vorbis_end(stream_processor *stream)
long minutes, seconds;
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment