[FFmpeg-devel] [PATCH 2/2] af_pan: move query_format before config_props.

Clément Bœsch ubitux at gmail.com
Mon Feb 20 22:10:40 CET 2012


On Mon, Feb 20, 2012 at 09:47:26PM +0100, Nicolas George wrote:
> That is the logical order in which the functions are called,
> and there is no longer any need of forward declarations.
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavfilter/af_pan.c |   46 +++++++++++++++++++++++-----------------------
>  1 files changed, 23 insertions(+), 23 deletions(-)
> 
> diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c
> index 82010b7..30d5d1b 100644
> --- a/libavfilter/af_pan.c
> +++ b/libavfilter/af_pan.c
> @@ -206,6 +206,29 @@ static int are_gains_pure(const PanContext *pan)
>      return 1;
>  }
>  
> +static int query_formats(AVFilterContext *ctx)
> +{
> +    PanContext *pan = ctx->priv;
> +    AVFilterLink *inlink  = ctx->inputs[0];
> +    AVFilterLink *outlink = ctx->outputs[0];
> +    AVFilterFormats *formats;
> +
> +    pan->pure_gains = are_gains_pure(pan);
> +    /* libswr supports any sample and packing formats */
> +    avfilter_set_common_sample_formats(ctx, avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO));
> +    avfilter_set_common_packing_formats(ctx, avfilter_make_all_packing_formats());
> +
> +    // inlink supports any channel layout
> +    formats = avfilter_make_all_channel_layouts();
> +    avfilter_formats_ref(formats, &inlink->out_chlayouts);
> +
> +    // outlink supports only requested output channel layout
> +    formats = NULL;
> +    avfilter_add_format(&formats, pan->out_channel_layout);
> +    avfilter_formats_ref(formats, &outlink->in_chlayouts);
> +    return 0;
> +}
> +
>  static int config_props(AVFilterLink *link)
>  {
>      AVFilterContext *ctx = link->dst;
> @@ -329,29 +352,6 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
>      avfilter_unref_buffer(insamples);
>  }
>  
> -static int query_formats(AVFilterContext *ctx)
> -{
> -    PanContext *pan = ctx->priv;
> -    AVFilterLink *inlink  = ctx->inputs[0];
> -    AVFilterLink *outlink = ctx->outputs[0];
> -    AVFilterFormats *formats;
> -
> -    pan->pure_gains = are_gains_pure(pan);
> -    /* libswr supports any sample and packing formats */
> -    avfilter_set_common_sample_formats(ctx, avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO));
> -    avfilter_set_common_packing_formats(ctx, avfilter_make_all_packing_formats());
> -
> -    // inlink supports any channel layout
> -    formats = avfilter_make_all_channel_layouts();
> -    avfilter_formats_ref(formats, &inlink->out_chlayouts);
> -
> -    // outlink supports only requested output channel layout
> -    formats = NULL;
> -    avfilter_add_format(&formats, pan->out_channel_layout);
> -    avfilter_formats_ref(formats, &outlink->in_chlayouts);
> -    return 0;
> -}
> -
>  static av_cold void uninit(AVFilterContext *ctx)
>  {
>      PanContext *pan = ctx->priv;

If you prefer it that way, no objection.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120220/379af7cb/attachment.asc>


More information about the ffmpeg-devel mailing list