Also, drop redundant calls that also happen implicitly in generic code.
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -90,9 +90,14 @@ static av_cold void uninit(AVFilterContext *ctx) · 89 unmodified lines | ||
| 90 | 90 | bs2b_close(bs2b->bs2bp); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | −static int query_formats(AVFilterContext *ctx) | |
| 93 | +static int query_formats(const AVFilterContext *ctx, | |
| 94 | + AVFilterFormatsConfig **cfg_in, | |
| 95 | + AVFilterFormatsConfig **cfg_out) | |
| 94 | 96 | { |
| 95 | − AVFilterChannelLayouts *layouts = NULL; | |
| 97 | + static const AVChannelLayout layouts[] = { | |
| 98 | + (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO, | |
| 99 | + (AVChannelLayout){ .nb_channels = 0 }, | |
| 100 | + }; | |
| 96 | 101 | |
| 97 | 102 | static const enum AVSampleFormat sample_fmts[] = { |
| 98 | 103 | AV_SAMPLE_FMT_U8, |
| @@ -104,17 +109,15 @@ static int query_formats(AVFilterContext *ctx) · 5 unmodified lines | ||
| 104 | 109 | }; |
| 105 | 110 | int ret; |
| 106 | 111 | |
| 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); | |
| 110 | 113 | if (ret < 0) |
| 111 | 114 | return ret; |
| 112 | 115 | |
| 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); | |
| 114 | 117 | if (ret < 0) |
| 115 | 118 | return ret; |
| 116 | 119 | |
| 117 | − return ff_set_common_all_samplerates(ctx); | |
| 120 | + return 0; | |
| 118 | 121 | } |
| 119 | 122 | |
| 120 | 123 | static int filter_frame(AVFilterLink *inlink, AVFrame *frame) |
| @@ -211,5 +214,5 @@ const AVFilter ff_af_bs2b = { · 90 unmodified lines | ||
| 211 | 214 | .uninit = uninit, |
| 212 | 215 | FILTER_INPUTS(bs2b_inputs), |
| 213 | 216 | FILTER_OUTPUTS(bs2b_outputs), |
| 214 | − FILTER_QUERY_FUNC(query_formats), | |
| 217 | + FILTER_QUERY_FUNC2(query_formats), | |
| 215 | 218 | }; |