History

lavfi/af_extrastereo: convert to query_func2()

Also, drop a redundant call that also happens implicitly in generic code.

Anton Khirnov committed 2 years ago

Commit 408587c1 parent 7896b951 file · +20 −9Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/af_extrastereo.c+20−9
@@ -42,19 +42,30 @@ static const AVOption extrastereo_options[] = { · 41 unmodified lines
4242
4343 AVFILTER_DEFINE_CLASS(extrastereo);
4444
45−static int query_formats(AVFilterContext *ctx)
45+static int query_formats(const AVFilterContext *ctx,
46+ AVFilterFormatsConfig **cfg_in,
47+ AVFilterFormatsConfig **cfg_out)
4648 {
47− AVFilterFormats *formats = NULL;
48− AVFilterChannelLayouts *layout = NULL;
49+ static const enum AVSampleFormat formats[] = {
50+ AV_SAMPLE_FMT_FLT,
51+ AV_SAMPLE_FMT_NONE,
52+ };
53+ static const AVChannelLayout layouts[] = {
54+ AV_CHANNEL_LAYOUT_STEREO,
55+ { .nb_channels = 0 },
56+ };
57+
4958 int ret;
5059
51− if ((ret = ff_add_format (&formats, AV_SAMPLE_FMT_FLT )) < 0 ||
52− (ret = ff_set_common_formats (ctx , formats )) < 0 ||
53− (ret = ff_add_channel_layout (&layout , &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO)) < 0 ||
54− (ret = ff_set_common_channel_layouts (ctx , layout )) < 0)
60+ ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, formats);
61+ if (ret < 0)
62+ return ret;
63+
64+ ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, layouts);
65+ if (ret < 0)
5566 return ret;
5667
57− return ff_set_common_all_samplerates(ctx);
68+ return 0;
5869 }
5970
6071 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
@@ -118,7 +129,7 @@ const AVFilter ff_af_extrastereo = { · 57 unmodified lines
118129 .priv_class = &extrastereo_class,
119130 FILTER_INPUTS(inputs),
120131 FILTER_OUTPUTS(ff_audio_default_filterpad),
121− FILTER_QUERY_FUNC(query_formats),
132+ FILTER_QUERY_FUNC2(query_formats),
122133 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
123134 .process_command = ff_filter_process_command,
124135 };

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t