ref: 7b1ce31a95068ca8c2458dc3201e889fec71a4ac
parent: db204761aca6b77059a063dcddce3972063baa1d
author: Gregory Maxwell <[email protected]>
date: Mon Jun 11 13:43:38 EDT 2012
Improvements to opusinfo error messages.
--- a/src/info_opus.c
+++ b/src/info_opus.c
@@ -265,11 +265,13 @@
long minutes, seconds, milliseconds;
double time;
time = (inf->lastgranulepos-inf->firstgranule-inf->oh.preskip) / 48000.;
+ if(time<=0)time=0;
minutes = (long)(time) / 60;
seconds = (long)(time - minutes*60);
milliseconds = (long)((time - minutes*60 - seconds)*1000);
if(inf->lastgranulepos-inf->firstgranule<inf->oh.preskip)
- oi_error(_("\tERROR: stream %d has a negative duration\n"),stream->num);
+ oi_error(_("\tERROR: stream %d has a negative duration: %" I64FORMAT "-%" I64FORMAT "-%d=%" I64FORMAT "\n"),stream->num,
+ inf->lastgranulepos,inf->firstgranule,inf->oh.preskip,inf->lastgranulepos-inf->firstgranule-inf->oh.preskip);
if((inf->total_samples-inf->last_page_duration)>(inf->lastgranulepos-inf->firstgranule))
oi_error(_("\tERROR: stream %d has interior holes or more than one page of end trimming\n"),stream->num);
if(inf->last_eos &&( (inf->last_page_duration-inf->last_packet_duration)>(inf->lastgranulepos-inf->lastlastgranulepos)))
@@ -291,7 +293,8 @@
inf->max_page_duration/48.,inf->total_samples/(double)inf->total_pages/48.,inf->min_page_duration/48.);
oi_info(_("\tTotal data length: %" I64FORMAT " bytes (overhead: %0.3g%%)\n"),inf->bytes,(double)inf->overhead_bytes/inf->bytes*100.);
oi_info(_("\tPlayback length: %ldm:%02ld.%03lds\n"), minutes, seconds, milliseconds);
- oi_info(_("\tAverage bitrate: %0.4g kb/s, w/o overhead: %.04g kb/s%s\n"),inf->bytes*8/time/1000.0,(inf->bytes-inf->overhead_bytes)*8/time/1000.0,
+ oi_info(_("\tAverage bitrate: %0.4g kb/s, w/o overhead: %.04g kb/s%s\n"),time<=0?0:inf->bytes*8/time/1000.0,
+ time<=0?0:(inf->bytes-inf->overhead_bytes)*8/time/1000.0,
(inf->min_packet_duration==inf->max_packet_duration)&&(inf->min_packet_bytes==inf->max_packet_bytes)?" (hard-CBR)":"");
} else {
oi_warn(_("\tWARNING: stream %d is empty\n"),stream->num);