Hi,<br><br>This is most helpful, thanks a lot! I whish I had more time for this project...<br><br>Best regards, Jonas<br><br><div class="gmail_quote">On Sat, Jun 30, 2012 at 3:12 AM, Michael Zucchi <span dir="ltr"><<a href="mailto:notzed@gmail.com" target="_blank">notzed@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
I'm pretty sure you shouldn't use approximate numbers (floats or doubles) for this.<br>
<br>
There's a bunch of AVRational related and exact-precision arithmetic functions in libavutil for this purpose. see libavutil/mathematics.h libavutil/rational.h.<div class="im HOEnZb"><br>
<br>
On 29/06/12 21:51, Hector Alonso wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
I've made myself one LibAvUtils class with this two functions<br>
implemented like this:<br>
<br>
<br>
int64_t LibAvUtils::frameNumberToPts(<u></u>uint uiFrameNum, float fFps)<br>
<br>
{<br>
<br>
if (fFps <= 0) return 0;<br>
<br>
return (int64_t)uiFrameNum * (int64_t)(((float)AV_TIME_<u></u>BASE) / fFps);<br>
<br>
}<br>
<br>
//----------------------------<u></u>------------------------------<u></u>-------------------<br>
<br>
uint LibAvUtils::ptsToFrameNumber(<u></u>int64_t iPts, float fFps)<br>
<br>
{<br>
<br>
if (fFps <= 0) return 0;<br>
<br>
return (uint)(iPts / (((float)AV_TIME_BASE) / fFps));<br>
<br>
}<br>
</blockquote></div><div class="HOEnZb"><div class="h5">
______________________________<u></u>_________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/<u></u>listinfo/libav-user</a><br>
</div></div></blockquote></div><br>