[FFmpeg-devel] [PATCH] Make avfilter_config_links() propagate audio information of the source link if it is not explicitely set by the filter.

Stefano Sabatini stefano.sabatini-lala
Mon Feb 14 18:37:28 CET 2011


On date Monday 2011-02-14 12:36:56 +0000, M?ns Rullg?rd encoded:
> Stefano Sabatini <stefano.sabatini-lala at poste.it> writes:
> 
> > ---
> >  libavfilter/avfilter.c |    6 ++++++
> >  1 files changed, 6 insertions(+), 0 deletions(-)
> >
> > diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> > index 31af890..1c400a6 100644
> > --- a/libavfilter/avfilter.c
> > +++ b/libavfilter/avfilter.c
> > @@ -194,6 +194,12 @@ int avfilter_config_links(AVFilterContext *filter)
> >                  link->time_base = link->src && link->src->input_count ?
> >                      link->src->inputs[0]->time_base : AV_TIME_BASE_Q;
> >
> > +            if (link->sample_rate == 0 && link->src && link->src->input_count)
> > +                link->sample_rate = link->src->inputs[0]->sample_rate;
> > +
> > +            if (link->channel_layout == 0 && link->src && link->src->input_count)
> > +                link->channel_layout = link->src->inputs[0]->channel_layout;
> > +
> 
> What if there is more than one input?  Are more complex cases assumed to
> provide explicit parameters? 

Yes, if a filter doesn't explicitely set the values they're set using
the values in the first input link. This is a quite safe assumption
and works fine for most 1-input/1-output filters.

> Is this input certain to be an audio input?

No, it is set anyway, a check may be added but right now it would be
quite pointless anyway since the value is not used by video filters.
-- 
FFmpeg = Faithless and Formidable Magical Peaceless Exciting Gangster



More information about the ffmpeg-devel mailing list