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

lavfi/src_avsynctest: switch to query_func2()

This commit is contained in:
Anton Khirnov 2024-10-01 12:02:29 +02:00
parent 534eef2ace
commit 55c99fb9c4

View File

@ -93,39 +93,39 @@ static const AVOption avsynctest_options[] = {
AVFILTER_DEFINE_CLASS(avsynctest);
static av_cold int query_formats(AVFilterContext *ctx)
static av_cold int query_formats(const AVFilterContext *ctx,
AVFilterFormatsConfig **cfg_in,
AVFilterFormatsConfig **cfg_out)
{
AVSyncTestContext *s = ctx->priv;
AVFilterChannelLayouts *chlayout = NULL;
const AVSyncTestContext *s = ctx->priv;
int sample_rates[] = { s->sample_rate, -1 };
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_NONE
};
static const AVChannelLayout layouts[] = {
AV_CHANNEL_LAYOUT_MONO,
{ .nb_channels = 0 },
};
AVFilterFormats *formats;
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
if ((ret = ff_formats_ref(formats, &ctx->outputs[0]->incfg.formats)) < 0)
if ((ret = ff_formats_ref(formats, &cfg_out[0]->formats)) < 0)
return ret;
formats = ff_draw_supported_pixel_formats(0);
if (!formats)
return AVERROR(ENOMEM);
if ((ret = ff_formats_ref(formats, &ctx->outputs[1]->incfg.formats)) < 0)
if ((ret = ff_formats_ref(formats, &cfg_out[1]->formats)) < 0)
return ret;
if ((ret = ff_add_channel_layout(&chlayout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_MONO)) < 0)
return ret;
ret = ff_set_common_channel_layouts(ctx, chlayout);
ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, layouts);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_rates);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, sample_rates);
}
static av_cold int aconfig_props(AVFilterLink *outlink)
@ -404,6 +404,6 @@ const AVFilter ff_avsrc_avsynctest = {
.inputs = NULL,
.activate = activate,
FILTER_OUTPUTS(avsynctest_outputs),
FILTER_QUERY_FUNC(query_formats),
FILTER_QUERY_FUNC2(query_formats),
.process_command = ff_filter_process_command,
};