History

lavfi/af_headphone: convert to query_func2()

Also, drop a redundant call that also happens implicitly in generic code.

Anton Khirnov committed 2 years ago

Commit fdc6e311 parent c9c6f071 file · +17 −13Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/af_headphone.c+17−13
@@ -594,19 +594,23 @@ static int activate(AVFilterContext *ctx) · 593 unmodified lines
594594 return 0;
595595 }
596596
597−static int query_formats(AVFilterContext *ctx)
597+static int query_formats(const AVFilterContext *ctx,
598+ AVFilterFormatsConfig **cfg_in,
599+ AVFilterFormatsConfig **cfg_out)
598600 {
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+
601608 AVFilterChannelLayouts *layouts = NULL;
602609 AVFilterChannelLayouts *stereo_layout = NULL;
603610 AVFilterChannelLayouts *hrir_layouts = NULL;
604611 int ret, i;
605612
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);
610614 if (ret)
611615 return ret;
612616
@@ -614,14 +618,14 @@ static int query_formats(AVFilterContext *ctx) · 1 unmodified line
614618 if (!layouts)
615619 return AVERROR(ENOMEM);
616620
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);
618622 if (ret)
619623 return ret;
620624
621625 ret = ff_add_channel_layout(&stereo_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO);
622626 if (ret)
623627 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);
625629 if (ret)
626630 return ret;
627631
@@ -629,18 +633,18 @@ static int query_formats(AVFilterContext *ctx) · 1 unmodified line
629633 hrir_layouts = ff_all_channel_counts();
630634 if (!hrir_layouts)
631635 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);
633637 if (ret)
634638 return ret;
635639 } else {
636640 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);
638642 if (ret)
639643 return ret;
640644 }
641645 }
642646
643− return ff_set_common_all_samplerates(ctx);
647+ return 0;
644648 }
645649
646650 static int config_input(AVFilterLink *inlink)
@@ -782,6 +786,6 @@ const AVFilter ff_af_headphone = { · 135 unmodified lines
782786 .activate = activate,
783787 .inputs = NULL,
784788 FILTER_OUTPUTS(outputs),
785− FILTER_QUERY_FUNC(query_formats),
789+ FILTER_QUERY_FUNC2(query_formats),
786790 .flags = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_DYNAMIC_INPUTS,
787791 };

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t