Also, drop a redundant call that also happens implicitly in generic code.
Unified · Split
| @@ -594,19 +594,23 @@ static int activate(AVFilterContext *ctx) · 593 unmodified lines | ||
| 594 | 594 | return 0; |
| 595 | 595 | } |
| 596 | 596 | |
| 597 | −static int query_formats(AVFilterContext *ctx) | |
| 597 | +static int query_formats(const AVFilterContext *ctx, | |
| 598 | + AVFilterFormatsConfig **cfg_in, | |
| 599 | + AVFilterFormatsConfig **cfg_out) | |
| 598 | 600 | { |
| 599 | − struct HeadphoneContext *s = ctx->priv; | |
| 600 | − AVFilterFormats *formats = NULL; | |
| 601 | + static const enum AVSampleFormat formats[] = { | |
| 602 | + AV_SAMPLE_FMT_FLT, | |
| 603 | + AV_SAMPLE_FMT_NONE, | |
| 604 | + }; | |
| 605 | + | |
| 606 | + const HeadphoneContext *s = ctx->priv; | |
| 607 | + | |
| 601 | 608 | AVFilterChannelLayouts *layouts = NULL; |
| 602 | 609 | AVFilterChannelLayouts *stereo_layout = NULL; |
| 603 | 610 | AVFilterChannelLayouts *hrir_layouts = NULL; |
| 604 | 611 | int ret, i; |
| 605 | 612 | |
| 606 | − ret = ff_add_format(&formats, AV_SAMPLE_FMT_FLT); | |
| 607 | − if (ret) | |
| 608 | − return ret; | |
| 609 | − ret = ff_set_common_formats(ctx, formats); | |
| 613 | + ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, formats); | |
| 610 | 614 | if (ret) |
| 611 | 615 | return ret; |
| 612 | 616 | |
| @@ -614,14 +618,14 @@ static int query_formats(AVFilterContext *ctx) · 1 unmodified line | ||
| 614 | 618 | if (!layouts) |
| 615 | 619 | return AVERROR(ENOMEM); |
| 616 | 620 | |
| 617 | − ret = ff_channel_layouts_ref(layouts, &ctx->inputs[0]->outcfg.channel_layouts); | |
| 621 | + ret = ff_channel_layouts_ref(layouts, &cfg_in[0]->channel_layouts); | |
| 618 | 622 | if (ret) |
| 619 | 623 | return ret; |
| 620 | 624 | |
| 621 | 625 | ret = ff_add_channel_layout(&stereo_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO); |
| 622 | 626 | if (ret) |
| 623 | 627 | return ret; |
| 624 | − ret = ff_channel_layouts_ref(stereo_layout, &ctx->outputs[0]->incfg.channel_layouts); | |
| 628 | + ret = ff_channel_layouts_ref(stereo_layout, &cfg_out[0]->channel_layouts); | |
| 625 | 629 | if (ret) |
| 626 | 630 | return ret; |
| 627 | 631 | |
| @@ -629,18 +633,18 @@ static int query_formats(AVFilterContext *ctx) · 1 unmodified line | ||
| 629 | 633 | hrir_layouts = ff_all_channel_counts(); |
| 630 | 634 | if (!hrir_layouts) |
| 631 | 635 | return AVERROR(ENOMEM); |
| 632 | − ret = ff_channel_layouts_ref(hrir_layouts, &ctx->inputs[1]->outcfg.channel_layouts); | |
| 636 | + ret = ff_channel_layouts_ref(hrir_layouts, &cfg_in[1]->channel_layouts); | |
| 633 | 637 | if (ret) |
| 634 | 638 | return ret; |
| 635 | 639 | } else { |
| 636 | 640 | for (i = 1; i <= s->nb_hrir_inputs; i++) { |
| 637 | − ret = ff_channel_layouts_ref(stereo_layout, &ctx->inputs[i]->outcfg.channel_layouts); | |
| 641 | + ret = ff_channel_layouts_ref(stereo_layout, &cfg_in[1]->channel_layouts); | |
| 638 | 642 | if (ret) |
| 639 | 643 | return ret; |
| 640 | 644 | } |
| 641 | 645 | } |
| 642 | 646 | |
| 643 | − return ff_set_common_all_samplerates(ctx); | |
| 647 | + return 0; | |
| 644 | 648 | } |
| 645 | 649 | |
| 646 | 650 | static int config_input(AVFilterLink *inlink) |
| @@ -782,6 +786,6 @@ const AVFilter ff_af_headphone = { · 135 unmodified lines | ||
| 782 | 786 | .activate = activate, |
| 783 | 787 | .inputs = NULL, |
| 784 | 788 | FILTER_OUTPUTS(outputs), |
| 785 | − FILTER_QUERY_FUNC(query_formats), | |
| 789 | + FILTER_QUERY_FUNC2(query_formats), | |
| 786 | 790 | .flags = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_DYNAMIC_INPUTS, |
| 787 | 791 | }; |