Unified · Split
| @@ -694,31 +694,29 @@ static av_cold int init(AVFilterContext *ctx) · 693 unmodified lines | ||
| 694 | 694 | return 0; |
| 695 | 695 | } |
| 696 | 696 | |
| 697 | −static int query_formats(AVFilterContext *ctx) | |
| 697 | +static int query_formats(const AVFilterContext *ctx, | |
| 698 | + AVFilterFormatsConfig **cfg_in, | |
| 699 | + AVFilterFormatsConfig **cfg_out) | |
| 698 | 700 | { |
| 699 | − LADSPAContext *s = ctx->priv; | |
| 701 | + const LADSPAContext *s = ctx->priv; | |
| 700 | 702 | AVFilterChannelLayouts *layouts; |
| 701 | 703 | static const enum AVSampleFormat sample_fmts[] = { |
| 702 | 704 | AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE }; |
| 703 | − int ret = ff_set_common_formats_from_list(ctx, sample_fmts); | |
| 705 | + int ret = ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, sample_fmts); | |
| 704 | 706 | if (ret < 0) |
| 705 | 707 | return ret; |
| 706 | 708 | |
| 707 | − if (s->nb_inputs) { | |
| 708 | − ret = ff_set_common_all_samplerates(ctx); | |
| 709 | − if (ret < 0) | |
| 710 | − return ret; | |
| 711 | − } else { | |
| 709 | + if (!s->nb_inputs) { | |
| 712 | 710 | int sample_rates[] = { s->sample_rate, -1 }; |
| 713 | 711 | |
| 714 | − ret = ff_set_common_samplerates_from_list(ctx, sample_rates); | |
| 712 | + ret = ff_set_common_samplerates_from_list2(ctx, cfg_in, cfg_out, sample_rates); | |
| 715 | 713 | if (ret < 0) |
| 716 | 714 | return ret; |
| 717 | 715 | } |
| 718 | 716 | |
| 719 | 717 | if (s->nb_inputs == 1 && s->nb_outputs == 1) { |
| 720 | 718 | // We will instantiate multiple LADSPA_Handle, one over each channel |
| 721 | − ret = ff_set_common_all_channel_counts(ctx); | |
| 719 | + ret = ff_set_common_all_channel_counts2(ctx, cfg_in, cfg_out); | |
| 722 | 720 | if (ret < 0) |
| 723 | 721 | return ret; |
| 724 | 722 | } else if (s->nb_inputs == 2 && s->nb_outputs == 2) { |
| @@ -726,26 +724,23 @@ static int query_formats(AVFilterContext *ctx) · 1 unmodified line | ||
| 726 | 724 | ret = ff_add_channel_layout(&layouts, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO); |
| 727 | 725 | if (ret < 0) |
| 728 | 726 | return ret; |
| 729 | − ret = ff_set_common_channel_layouts(ctx, layouts); | |
| 727 | + ret = ff_set_common_channel_layouts2(ctx, cfg_in, cfg_out, layouts); | |
| 730 | 728 | if (ret < 0) |
| 731 | 729 | return ret; |
| 732 | 730 | } else { |
| 733 | − AVFilterLink *outlink = ctx->outputs[0]; | |
| 734 | − | |
| 735 | 731 | if (s->nb_inputs >= 1) { |
| 736 | − AVFilterLink *inlink = ctx->inputs[0]; | |
| 737 | 732 | AVChannelLayout inlayout = FF_COUNT2LAYOUT(s->nb_inputs); |
| 738 | 733 | |
| 739 | 734 | layouts = NULL; |
| 740 | 735 | ret = ff_add_channel_layout(&layouts, &inlayout); |
| 741 | 736 | if (ret < 0) |
| 742 | 737 | return ret; |
| 743 | − ret = ff_channel_layouts_ref(layouts, &inlink->outcfg.channel_layouts); | |
| 738 | + ret = ff_channel_layouts_ref(layouts, &cfg_in[0]->channel_layouts); | |
| 744 | 739 | if (ret < 0) |
| 745 | 740 | return ret; |
| 746 | 741 | |
| 747 | 742 | if (!s->nb_outputs) { |
| 748 | − ret = ff_channel_layouts_ref(layouts, &outlink->incfg.channel_layouts); | |
| 743 | + ret = ff_channel_layouts_ref(layouts, &cfg_out[0]->channel_layouts); | |
| 749 | 744 | if (ret < 0) |
| 750 | 745 | return ret; |
| 751 | 746 | } |
| @@ -758,7 +753,7 @@ static int query_formats(AVFilterContext *ctx) · 6 unmodified lines | ||
| 758 | 753 | ret = ff_add_channel_layout(&layouts, &outlayout); |
| 759 | 754 | if (ret < 0) |
| 760 | 755 | return ret; |
| 761 | − ret = ff_channel_layouts_ref(layouts, &outlink->incfg.channel_layouts); | |
| 756 | + ret = ff_channel_layouts_ref(layouts, &cfg_out[0]->channel_layouts); | |
| 762 | 757 | if (ret < 0) |
| 763 | 758 | return ret; |
| 764 | 759 | } |
| @@ -825,6 +820,6 @@ const AVFilter ff_af_ladspa = { · 60 unmodified lines | ||
| 825 | 820 | .process_command = process_command, |
| 826 | 821 | .inputs = 0, |
| 827 | 822 | FILTER_OUTPUTS(ladspa_outputs), |
| 828 | − FILTER_QUERY_FUNC(query_formats), | |
| 823 | + FILTER_QUERY_FUNC2(query_formats), | |
| 829 | 824 | .flags = AVFILTER_FLAG_DYNAMIC_INPUTS, |
| 830 | 825 | }; |