[DVDnav-discuss] [PATCH] fix dvdnav_convert_time to work for full range

Erik Hovland erik at hovland.org
Tue Nov 6 19:28:30 CET 2012


Fixed in my tree as of February 2012. I used a cast to int64_t, but
otherwise, the same fix. This is slated for push into mplayerhq svn
as soon as I get around to it.

Thanks for the patch.
E

On Tue, Nov 6, 2012 at 10:09 AM, Reimar Döffinger
<Reimar.Doeffinger at gmx.de> wrote:
> 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;
>
> _______________________________________________
> DVDnav-discuss mailing list
> DVDnav-discuss at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/dvdnav-discuss



-- 
Erik Hovland
erik at hovland.org
http://hovland.org/


More information about the DVDnav-discuss mailing list