1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

lavfi/af_aresample: accept unknown channel layouts.

This commit is contained in:
Nicolas George 2012-12-26 16:51:50 +01:00
parent 6d962aec8d
commit b00502457a

View File

@ -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;
}