[FFmpeg-devel] [PATCH 08/10] lavfi/af_aresample: accept unknown channel layouts.

Stefano Sabatini stefasab at gmail.com
Fri Jan 18 19:14:52 CET 2013


On date Wednesday 2013-01-16 17:50:22 +0100, Nicolas George encoded:
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavfilter/af_aresample.c |   14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> 
> Unchanged, approved.
> 
> 
> diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c
> index 17b7630..2e3867e 100644
> --- a/libavfilter/af_aresample.c
> +++ b/libavfilter/af_aresample.c
> @@ -98,7 +98,7 @@ static int query_formats(AVFilterContext *ctx)
>      AVFilterFormats        *out_formats;
>      AVFilterFormats        *in_samplerates  = ff_all_samplerates();
>      AVFilterFormats        *out_samplerates;
> -    AVFilterChannelLayouts *in_layouts      = ff_all_channel_layouts();
> +    AVFilterChannelLayouts *in_layouts      = ff_all_channel_counts();
>      AVFilterChannelLayouts *out_layouts;
>  
>      ff_formats_ref  (in_formats,      &inlink->out_formats);
> @@ -121,7 +121,7 @@ static int query_formats(AVFilterContext *ctx)
>      if(out_layout) {
>          out_layouts = avfilter_make_format64_list((int64_t[]){ out_layout, -1 });
>      } else
> -        out_layouts = ff_all_channel_layouts();
> +        out_layouts = ff_all_channel_counts();
>      ff_channel_layouts_ref(out_layouts, &outlink->in_channel_layouts);
>  
>      return 0;
> @@ -145,6 +145,10 @@ static int config_output(AVFilterLink *outlink)
>                                          0, ctx);
>      if (!aresample->swr)
>          return AVERROR(ENOMEM);
> +    if (!inlink->channel_layout)
> +        av_opt_set_int(aresample->swr, "ich", inlink->channels, 0);
> +    if (!outlink->channel_layout)
> +        av_opt_set_int(aresample->swr, "och", outlink->channels, 0);
>  
>      ret = swr_init(aresample->swr);
>      if (ret < 0)
> @@ -164,9 +168,9 @@ static int config_output(AVFilterLink *outlink)
>      av_get_channel_layout_string(inchl_buf,  sizeof(inchl_buf),  -1, inlink ->channel_layout);
>      av_get_channel_layout_string(outchl_buf, sizeof(outchl_buf), -1, outlink->channel_layout);
>  
> -    av_log(ctx, AV_LOG_VERBOSE, "chl:%s fmt:%s r:%dHz -> chl:%s fmt:%s r:%dHz\n",
> -           inchl_buf,  av_get_sample_fmt_name(inlink->format),  inlink->sample_rate,
> -           outchl_buf, av_get_sample_fmt_name(outlink->format), outlink->sample_rate);
> +    av_log(ctx, AV_LOG_VERBOSE, "ch:%d chl:%s fmt:%s r:%dHz -> ch:%d chl:%s fmt:%s r:%dHz\n",
> +           inlink ->channels, inchl_buf,  av_get_sample_fmt_name(inlink->format),  inlink->sample_rate,
> +           outlink->channels, outchl_buf, av_get_sample_fmt_name(outlink->format), outlink->sample_rate);
>      return 0;
>  }

Still LGTM.
-- 
FFmpeg = Fundamental and Frenzy Moronic Portentous Entertaining Geisha


More information about the ffmpeg-devel mailing list