[Vorbis] One final minor trivial insignificant pointless patch

Barry Bouwsma bugs
Tue Jun 8 06:17:11 PDT 2004


[this address is IPv6-only, and usually doesn't work, so don't.]


There's another patch I have up my sleeve, that it would be nice
if I didn't need to apply it by hand.  Look:


vorbis-tools/oggenc/encode.c
--- encode.c-DIST	Fri Jul 19 08:35:48 2002
+++ encode.c	Fri Jan  9 07:46:27 2004
@@ -346,7 +342,7 @@
seconds = (int)(remain_time - (double)((int)remain_time/60)*60);

fprintf(stderr, "\r");
-	fprintf(stderr, _("\t[%5.1f%%] [%2dm%.2ds remaining] %c"),
+	fprintf(stderr, _("\t[%5.1f%%] [%2dm%.2ds remaining] %c "),
done*100.0/total, minutes, seconds, spinner[spinpoint++%4]);
}



What it does is to put a space at the end of the printed line,
thereby erasing any character that may be left over.

This happens when the value of minutes is more than 99, and
it overflows %2d.  When this number decrements from, say,
1000 to 999, without this hack, the original fprintf() will
be one character shorter, leaving the twiddler at the end of
the line.  Then from 100 to 99, you've got two twiddlythingies.

One could also change %2d to %8d or something so this would
not be a problem, but how many characters do you want to reserve
so that I take it as a challenge to record 10^(number-of-digits-
plus-one) minutes and convert it?  The above result looks fine.


In the ogg playback with extended files, the carefully-formatted
string can exceed 79 characters in some cases, which for me
results in scrolling of the previous status line.  I need to
tackle this problem and come up with a more flexible format,
but I haven't done so yet.  When^H^H^H^HIf I do, you'll hear
about it.


thanks
barry bouwsma



More information about the Vorbis mailing list