[MPlayer-dev-eng] [PATCH] -identify DVD titles
kiriuja
mplayer-patches at en-directo.net
Tue Sep 20 00:28:12 CEST 2005
On 9/19/05, Rich Felker wrote:
> On Mon, Sep 19, 2005 at 10:29:00PM +0200, Guillaume POIRIER wrote:
> > I'm also not too sure that
> > + static int framerates[4] = {0, 2500, 0, 2997};
> > + int framerate = framerates[(dt->frame_u & 0xc0) >> 6];
> > + int msec = (((dt->hour & 0xf0) >> 3) * 5 + (dt->hour & 0x0f)) * 3600000;
> >
> > is well supported by ol' compilers such as GCC-2.95. Could you check that?
>
> The code is perfectly fine syntactically, even in traditional C, but
> plain wrong in what it does. The numbers are 25 and 30000/1001, not 25
> and 29.97!!
So, 30000/1001 = 29.97002997, which is more than enough precision for this case,
since it is only dt->frame_u, which is the sub-second part, that gets converted
using this rate, and so even though the code prints 3 digits, the actual
precision is less that 2 digits here.
Should there be parentheses around the numerator here? so that the whole thing
is divided by the framerate? like:
msec += (((dt->frame_u & 0x30) >> 3) * 500 + (dt->frame_u & 0x0f) * 100000) / framerate;
If there is anything else I am missing, please explain.
--
kiriuja
More information about the MPlayer-dev-eng
mailing list