[FFmpeg-devel] [PATCH] lavfi/setpts: set SAMPLE_RATE to NAN when input is no audio

Stefano Sabatini stefasab at gmail.com
Mon Sep 10 18:59:10 CEST 2012


On date Monday 2012-09-10 18:23:43 +0200, Michael Niedermayer encoded:
> On Mon, Sep 10, 2012 at 12:06:49PM +0200, Stefano Sabatini wrote:
> > Should be more robust/consistent.
> > ---
> >  libavfilter/f_setpts.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavfilter/f_setpts.c b/libavfilter/f_setpts.c
> > index 61446c1..2afdc65 100644
> > --- a/libavfilter/f_setpts.c
> > +++ b/libavfilter/f_setpts.c
> > @@ -106,8 +106,8 @@ static int config_input(AVFilterLink *inlink)
> >      setpts->type = inlink->type;
> >      setpts->var_values[VAR_TB] = av_q2d(inlink->time_base);
> >  
> > -    if (setpts->type == AVMEDIA_TYPE_AUDIO)
> > -        setpts->var_values[VAR_SAMPLE_RATE] = inlink->sample_rate;
> > +    setpts->var_values[VAR_SAMPLE_RATE] =
> > +        setpts->type == AVMEDIA_TYPE_AUDIO ? inlink->sample_rate : NAN;
> >  
> >      setpts->var_values[VAR_FRAME_RATE] = inlink->frame_rate.num && inlink->frame_rate.den ?
> >          av_q2d(inlink->frame_rate) : NAN;
> 
> 0 or NAN, should both be ok

Applied this variant.
-- 
FFmpeg = Frightening and Freak Marvellous Powerful Extensive Game


More information about the ffmpeg-devel mailing list