Hi, This is most helpful, thanks a lot! I whish I had more time for this project...
Best regards, Jonas On Sat, Jun 30, 2012 at 3:12 AM, Michael Zucchi <[email protected]> wrote: > > I'm pretty sure you shouldn't use approximate numbers (floats or doubles) > for this. > > There's a bunch of AVRational related and exact-precision arithmetic > functions in libavutil for this purpose. see libavutil/mathematics.h > libavutil/rational.h. > > > On 29/06/12 21:51, Hector Alonso wrote: > >> Hi, >> I've made myself one LibAvUtils class with this two functions >> implemented like this: >> >> >> int64_t LibAvUtils::frameNumberToPts(**uint uiFrameNum, float fFps) >> >> { >> >> if (fFps <= 0) return 0; >> >> return (int64_t)uiFrameNum * (int64_t)(((float)AV_TIME_**BASE) >> / fFps); >> >> } >> >> //----------------------------**------------------------------** >> ------------------- >> >> uint LibAvUtils::ptsToFrameNumber(**int64_t iPts, float fFps) >> >> { >> >> if (fFps <= 0) return 0; >> >> return (uint)(iPts / (((float)AV_TIME_BASE) / fFps)); >> >> } >> > ______________________________**_________________ > Libav-user mailing list > [email protected] > http://ffmpeg.org/mailman/**listinfo/libav-user<http://ffmpeg.org/mailman/listinfo/libav-user> >
_______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
