Also, simplify code, and drop a redundant call that also happens implicitly in generic code.
Unified · Split
| @@ -185,19 +185,30 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 184 unmodified lines | ||
| 185 | 185 | return ff_filter_frame(outlink, out); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | −static int query_formats(AVFilterContext *ctx) | |
| 188 | +static int query_formats(const AVFilterContext *ctx, | |
| 189 | + AVFilterFormatsConfig **cfg_in, | |
| 190 | + AVFilterFormatsConfig **cfg_out) | |
| 189 | 191 | { |
| 190 | − AVFilterChannelLayouts *layout = NULL; | |
| 191 | − AVFilterFormats *formats = NULL; | |
| 192 | + static const enum AVSampleFormat formats[] = { | |
| 193 | + AV_SAMPLE_FMT_DBL, | |
| 194 | + AV_SAMPLE_FMT_NONE, | |
| 195 | + }; | |
| 196 | + static const AVChannelLayout layouts[] = { | |
| 197 | + (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO, | |
| 198 | + (AVChannelLayout){ .nb_channels = 0 }, | |
| 199 | + }; | |
| 200 | + | |
| 192 | 201 | int ret; |
| 193 | 202 | |
| 194 | − if ((ret = ff_add_format (&formats, AV_SAMPLE_FMT_DBL )) < 0 || | |
| 195 | − (ret = ff_set_common_formats (ctx , formats )) < 0 || | |
| 196 | − (ret = ff_add_channel_layout (&layout , &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO)) < 0 || | |
| 197 | − (ret = ff_set_common_channel_layouts (ctx , layout )) < 0) | |
| 203 | + ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, formats); | |
| 204 | + if (ret < 0) | |
| 205 | + return ret; | |
| 206 | + | |
| 207 | + ret = ff_set_common_channel_layouts_from_list2(ctx, cfg_in, cfg_out, layouts); | |
| 208 | + if (ret < 0) | |
| 198 | 209 | return ret; |
| 199 | 210 | |
| 200 | − return ff_set_common_all_samplerates(ctx); | |
| 211 | + return 0; | |
| 201 | 212 | } |
| 202 | 213 | |
| 203 | 214 | static int config_input(AVFilterLink *inlink) |
| @@ -245,5 +256,5 @@ const AVFilter ff_af_apulsator = { · 41 unmodified lines | ||
| 245 | 256 | .priv_class = &apulsator_class, |
| 246 | 257 | FILTER_INPUTS(inputs), |
| 247 | 258 | FILTER_OUTPUTS(ff_audio_default_filterpad), |
| 248 | − FILTER_QUERY_FUNC(query_formats), | |
| 259 | + FILTER_QUERY_FUNC2(query_formats), | |
| 249 | 260 | }; |