Also, drop redundant calls that also happen implicitly in generic code.
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -47,23 +47,19 @@ static const AVOption asetrate_options[] = { · 46 unmodified lines | |||
| 47 | 47 | ||
| 48 | AVFILTER_DEFINE_CLASS(asetrate); | 48 | AVFILTER_DEFINE_CLASS(asetrate); |
| 49 | 49 | ||
| 50 | static av_cold int query_formats(AVFilterContext *ctx) | 50 | static av_cold int query_formats(const AVFilterContext *ctx, |
| 51 | AVFilterFormatsConfig **cfg_in, | ||
| 52 | AVFilterFormatsConfig **cfg_out) | ||
| 51 | { | 53 | { |
| 52 | ASetRateContext *sr = ctx->priv; | 54 | const ASetRateContext *sr = ctx->priv; |
| 53 | int ret, sample_rates[] = { sr->sample_rate, -1 }; | 55 | int ret, sample_rates[] = { sr->sample_rate, -1 }; |
| 54 | 56 | ||
| 55 | if ((ret = ff_set_common_formats(ctx, ff_all_formats(AVMEDIA_TYPE_AUDIO))) < 0) | ||
| 56 | return ret; | ||
| 57 | |||
| 58 | if ((ret = ff_set_common_all_channel_counts(ctx)) < 0) | ||
| 59 | return ret; | ||
| 60 | |||
| 61 | if ((ret = ff_formats_ref(ff_all_samplerates(), | 57 | if ((ret = ff_formats_ref(ff_all_samplerates(), |
| 62 | &ctx->inputs[0]->outcfg.samplerates)) < 0) | 58 | &cfg_in[0]->samplerates)) < 0) |
| 63 | return ret; | 59 | return ret; |
| 64 | 60 | ||
| 65 | return ff_formats_ref(ff_make_format_list(sample_rates), | 61 | return ff_formats_ref(ff_make_format_list(sample_rates), |
| 66 | &ctx->outputs[0]->incfg.samplerates); | 62 | &cfg_out[0]->samplerates); |
| 67 | } | 63 | } |
| 68 | 64 | ||
| 69 | static av_cold int config_props(AVFilterLink *outlink) | 65 | static av_cold int config_props(AVFilterLink *outlink) |
| @@ -122,7 +118,7 @@ const AVFilter ff_af_asetrate = { · 52 unmodified lines | |||
| 122 | .priv_size = sizeof(ASetRateContext), | 118 | .priv_size = sizeof(ASetRateContext), |
| 123 | FILTER_INPUTS(asetrate_inputs), | 119 | FILTER_INPUTS(asetrate_inputs), |
| 124 | FILTER_OUTPUTS(asetrate_outputs), | 120 | FILTER_OUTPUTS(asetrate_outputs), |
| 125 | FILTER_QUERY_FUNC(query_formats), | 121 | FILTER_QUERY_FUNC2(query_formats), |
| 126 | .priv_class = &asetrate_class, | 122 | .priv_class = &asetrate_class, |
| 127 | .flags = AVFILTER_FLAG_METADATA_ONLY, | 123 | .flags = AVFILTER_FLAG_METADATA_ONLY, |
| 128 | }; | 124 | }; |