[FFmpeg-devel] [PATCH 3/7] Set timebase in the ffplay input and output filters.

Stefano Sabatini stefano.sabatini-lala
Tue Oct 12 20:39:06 CEST 2010


On date Tuesday 2010-10-12 18:44:00 +0200, Michael Niedermayer encoded:
> On Tue, Oct 12, 2010 at 12:00:59PM +0200, Stefano Sabatini wrote:
> > On date Monday 2010-10-11 15:47:01 +0200, Michael Niedermayer encoded:
> > > On Mon, Oct 11, 2010 at 02:04:02PM +0200, Stefano Sabatini wrote:
> > > > ---
> > > >  ffplay.c |   28 ++++++++++++++++++++++++++--
> > > >  1 files changed, 26 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/ffplay.c b/ffplay.c
> > > > index 9927006..5d6e2d1 100644
> > > > --- a/ffplay.c
> > > > +++ b/ffplay.c
> > > > @@ -1755,6 +1755,7 @@ static int input_config_props(AVFilterLink *link)
> > > >  
> > > >      link->w = c->width;
> > > >      link->h = c->height;
> > > > +    link->time_base = priv->is->video_st->time_base;
> > > >  
> > > >      return 0;
> > > >  }
> > > > @@ -1778,8 +1779,29 @@ static AVFilter input_filter =
> > > >                                    { .name = NULL }},
> > > >  };
> > > >  
> > > > -static void output_end_frame(AVFilterLink *link)
> > > > +static int output_init(AVFilterContext *ctx, const char *args, void *opaque)
> > > >  {
> > > > +    FilterPriv *priv = ctx->priv;
> > > > +    if (!opaque) return AVERROR(EINVAL);
> > > > +
> > > > +    priv->is = opaque;
> > > > +    return 0;
> > > > +}
> > > > +
> > > > +static void output_end_frame(AVFilterLink *inlink)
> > > > +{
> > > > +    AVFilterContext *ctx = inlink->dst;
> > > > +    FilterPriv *priv = ctx->priv;
> > > > +    AVRational dst_time_base = priv->is->video_st->time_base;
> > > > +
> > > > +    if (av_cmp_q(inlink->time_base, dst_time_base)) {
> > > > +        int64_t pts1 = inlink->cur_buf->pts;
> > > > +        inlink->cur_buf->pts = av_rescale_q(pts1, inlink->time_base, dst_time_base);
> > > > +        av_log(ctx, AV_LOG_DEBUG,
> > > > +               "tb:%d/%d pts:%"PRId64" -> tb:%d/%d pts:%"PRId64"\n",
> > > > +               inlink->time_base.num, inlink->time_base.den, pts1,
> > > > +               dst_time_base.num, dst_time_base.den, inlink->cur_buf->pts);
> > > > +    }
> > > >  }
> > > 
> > > isnt it simpler to let get_filtered_video_frame()
> > > return the tb and do the rescaling outside?
> > 
> > Sligthly simpler, acceptable by me, if we see that the other way turns
> > more convenient (e.g. if we need for other reasons an output init and
> > end_frame() function) we can change again later.
> > 
> > Regards.
> > -- 
> > FFmpeg = Freak & Fundamental Minimalistic Portable Enhancing God
> 
> >  ffplay.c |   17 +++++++++++++++--
> >  1 file changed, 15 insertions(+), 2 deletions(-)
> > 3f2f86fb8f2806d934b10fefe1fc37a249bb756c  0001-Fix-timebase-handling-at-the-begin-and-at-the-end-of.patch
> > From 27d5b56fd2b555784cee7bfe87fa9f598e5aae9c Mon Sep 17 00:00:00 2001
> > From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> > Date: Tue, 8 Jun 2010 23:31:04 +0200
> > Subject: [PATCH 1/6] Fix timebase handling at the begin and at the end of the ffplay video
> >  filterchain.
> > 
> > Set timebase in the ffplay input, and make get_filtered_video_frame()
> > rescale the output frames PTSes according to their timebase.
> 
> ok

Applied.
-- 
FFmpeg = Faithless and Fundamental Monstrous Proud Ephemeral Guru



More information about the ffmpeg-devel mailing list