[FFmpeg-devel] [PATCH] Add a time_base field to AVFilterPad.
Michael Niedermayer
michaelni
Wed Oct 6 21:43:46 CEST 2010
On Wed, Oct 06, 2010 at 08:20:18PM +0200, Stefano Sabatini wrote:
> On date Wednesday 2010-10-06 18:19:35 +0200, Michael Niedermayer encoded:
> > On Wed, Oct 06, 2010 at 06:12:17PM +0200, Stefano Sabatini wrote:
> > > 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)
> >
> > gcd(a/b, c/d)
> > gcd(a/b, c/d)*bd / bd
> > gcd(abd/b, cbd/d) / bd
> > gcd(ad, cb) / bd
> >
> >
> > >
> > > So the code is:
> >
> > should be ok, a test cant hurt of course
>
> I suppose it is an OK for the patch mentioned in the subject, which
> I'm attaching again, the sample code was belonging to my local working
> copy of the overlay filter (still not ready for review).
>
> Regards.
> --
> FFmpeg = Fascinating Fast MultiPurpose Elaborated Gnome
> avfilter.c | 21 +++++++++++++++++++++
> avfilter.h | 15 ++++++++++++++-
> defaults.c | 1 +
> 3 files changed, 36 insertions(+), 1 deletion(-)
> dffa3d20b8e8d74cbbf2d67ab170242471e1dbfa 0001-Add-a-time_base-field-to-AVFilterPad.patch
> From 01f1ac855d628bfb1ddea394dea3bad5fd74350b Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> Date: Mon, 27 Sep 2010 20:24:44 +0200
> Subject: [PATCH 1/9] Add a time_base field to AVFilterPad.
>
> This is required for allowing a filter to use a time base different
> from AV_TIME_BASE_Q, as it was previously assumed.
> ---
> libavfilter/avfilter.c | 21 +++++++++++++++++++++
> libavfilter/avfilter.h | 15 ++++++++++++++-
> libavfilter/defaults.c | 1 +
> 3 files changed, 36 insertions(+), 1 deletions(-)
>
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index ea6f9fe..bbe8d78 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -23,6 +23,7 @@
>
> #include "libavcodec/audioconvert.c"
> #include "libavutil/pixdesc.h"
> +#include "libavutil/rational.h"
> #include "libavcore/imgutils.h"
> #include "avfilter.h"
> #include "internal.h"
> @@ -179,10 +180,20 @@ int avfilter_config_links(AVFilterContext *filter)
> if (config_link(link))
> return -1;
>
> + if (link->srcpad->time_base.num == 0 && link->srcpad->time_base.den == 0) {
> + if (link->src->input_count)
> + link->srcpad->time_base = link->src->input_pads[0].time_base;
> + else
{}
[...]
> @@ -336,6 +348,15 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
> else
> link->cur_buf = picref;
>
> + if (av_cmp_q(dst->time_base, src->time_base)) {
> + int64_t av_unused pts1 = picref->pts;
> + link->cur_buf->pts = av_rescale_q(picref->pts, src->time_base, dst->time_base);
missing AV_NOPTS check
[...]
> @@ -424,6 +431,12 @@ struct AVFilterPad {
> * and another value on error.
> */
> int (*config_props)(AVFilterLink *link);
> +
> + /**
> + * Define the time base used by the PTS of the frames/samples
> + * which will pass through this link.
> + */
> + AVRational time_base;
> };
Belongs to AVFilterLink not Pad IMHO
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101006/b069e0df/attachment.pgp>
More information about the ffmpeg-devel
mailing list