History

lavfi/af_bs2b: convert to query_func2()

Also, drop redundant calls that also happen implicitly in generic code.

Anton Khirnov committed 2 years ago

Commit 30459491 parent 96a8a611 file · +11 −8Browse files

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

Unified · Split

libavfilter/af_bs2b.c+11−8
@@ -90,9 +90,14 @@ static av_cold void uninit(AVFilterContext *ctx) · 89 unmodified lines
9090 bs2b_close(bs2b->bs2bp);
9191 }
9292
93−static int query_formats(AVFilterContext *ctx)
93+static int query_formats(const AVFilterContext *ctx,
94+ AVFilterFormatsConfig **cfg_in,
95+ AVFilterFormatsConfig **cfg_out)
9496 {
95− AVFilterChannelLayouts *layouts = NULL;
97+ static const AVChannelLayout layouts[] = {
98+ (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO,
99+ (AVChannelLayout){ .nb_channels = 0 },
100+ };
96101
97102 static const enum AVSampleFormat sample_fmts[] = {
98103 AV_SAMPLE_FMT_U8,
@@ -104,17 +109,15 @@ static int query_formats(AVFilterContext *ctx) · 5 unmodified lines
104109 };
105110 int ret;
106111
107− if (ff_add_channel_layout(&layouts, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO) != 0)
108− return AVERROR(ENOMEM);
109− ret = ff_set_common_channel_layouts(ctx, layouts);
112+ ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, layouts);
110113 if (ret < 0)
111114 return ret;
112115
113− ret = ff_set_common_formats_from_list(ctx, sample_fmts);
116+ ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, sample_fmts);
114117 if (ret < 0)
115118 return ret;
116119
117− return ff_set_common_all_samplerates(ctx);
120+ return 0;
118121 }
119122
120123 static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
@@ -211,5 +214,5 @@ const AVFilter ff_af_bs2b = { · 90 unmodified lines
211214 .uninit = uninit,
212215 FILTER_INPUTS(bs2b_inputs),
213216 FILTER_OUTPUTS(bs2b_outputs),
214− FILTER_QUERY_FUNC(query_formats),
217+ FILTER_QUERY_FUNC2(query_formats),
215218 };

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