[FFmpeg-devel] [PATCH] Add a time_base field to AVFilterPad.
Stefano Sabatini
stefano.sabatini-lala
Wed Oct 6 18:12:17 CEST 2010
On date Wednesday 2010-10-06 12:13:42 +0200, Michael Niedermayer encoded:
> On Wed, Oct 06, 2010 at 10:57:47AM +0200, Stefano Sabatini wrote:
> > > > > > > your code makes no sense
> > > > > > > with a/b and c/d
> > > > > > >
> > > > > > > you need something like:
>
> > > > > > > reduce(gcd(ad,cb)/bd)
> [...]
> > Reducing tb1 and tb2 should solve the issue in this case.
>
> why dont you use what i suggest?
(because I was trying to understand the math behind)
So the code is:
exact = av_reduce(&tb.num, &tb.den,
av_gcd((int64_t)tb1->num * tb2->den,
(int64_t)tb2->num * tb2->den),
(int64_t)tb1->den * tb2->den, INT_MAX);
av_log(ctx, AV_LOG_INFO,
"main_tb:%d/%d overlay_tb:%d/%d -> tb:%d/%d exact:%d\n",
tb1->num, tb1->den, tb2->num, tb2->den, tb.num, tb.den, exact);
*tb1 = *tb2 = tb;
if (!exact)
av_log(ctx, AV_LOG_WARNING,
"Timestamp conversion inexact, timestamp information loss may occurr\n");
--
FFmpeg = Friendly and Fast Maxi Ponderous Ecletic Gem
More information about the ffmpeg-devel
mailing list