[DVDnav-discuss] [PATCH] fix dvdnav_convert_time to work for full range
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Tue Nov 6 19:09:59 CET 2012
Hello,
currently the calculation will use int and thus overflow for anything
larger or equal to 20 hours.
Not sure if this is the best/nicest way, personally I prefer to do this
kind of thing with the
result = hour >> 4;
result *= 10;
result += hour;
result *= 6;
result += minute >> 4;
result *= 10;
....
scheme, but this is the minimal change required.
Index: dvdnav.c
===================================================================
--- dvdnav.c (revision 1243)
+++ dvdnav.c (working copy)
@@ -203,7 +203,7 @@
int64_t result;
int64_t frames;
- result = (time->hour >> 4 ) * 10 * 60 * 60 * 90000;
+ result = (time->hour >> 4 ) * 10 * 60 * 60 * 90000ull;
result += (time->hour & 0x0f) * 60 * 60 * 90000;
result += (time->minute >> 4 ) * 10 * 60 * 90000;
result += (time->minute & 0x0f) * 60 * 90000;
More information about the DVDnav-discuss
mailing list