demux_mkv.c: Make some time arithmetic more precise
Some calculations in the demuxer that are in principle integer
arithmetic use float divisions instead of 64-bit integer ones (as in
(int64_t)(x /
1000000.0) ). When compiled with -ffast-math gcc replaces
the division with multiplication by inverse. The calculation of the
inverse can introduce rounding error even for divisions that would
have been exact, and any rounding error down from an exact integer
result in the division makes the result after cast one smaller. This
caused some inaccuracy in seeking due to timecodes in the index not
quite matching those calculated for actual packets. Add 0.5 to such
expressions before casting to round instead of truncating, which
should be enough to avoid the problem. Also replace some
non-performance-critical use of float types by doubles.