History

avfilter/af_aderivative: Use formats list instead of query function

In this case switching to .formats.samples even allows to avoid the runtime check for which filter is currently used.

Andreas Rheinhardt committed 5 years ago

Commit 5f395121 parent b10b1941 file · +3 −25Browse files

Unified · Split

libavfilter/af_aderivative.c+3−25
@@ -27,29 +27,6 @@ typedef struct ADerivativeContext { · 26 unmodified lines
2727 int nb_samples, int channels);
2828 } ADerivativeContext;
2929
30−static int query_formats(AVFilterContext *ctx)
31−{
32− static const enum AVSampleFormat derivative_sample_fmts[] = {
33− AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLTP,
34− AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_DBLP,
35− AV_SAMPLE_FMT_NONE
36− };
37− static const enum AVSampleFormat integral_sample_fmts[] = {
38− AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP,
39− AV_SAMPLE_FMT_NONE
40− };
41− int ret = ff_set_common_formats_from_list(ctx, strcmp(ctx->filter->name, "aintegral") ?
42− derivative_sample_fmts : integral_sample_fmts);
43− if (ret < 0)
44− return ret;
45−
46− ret = ff_set_common_all_channel_counts(ctx);
47− if (ret < 0)
48− return ret;
49−
50− return ff_set_common_all_samplerates(ctx);
51−}
52−
5330 #define DERIVATIVE(name, type) \
5431 static void aderivative_## name ##p(void **d, void **p, const void **s, \
5532 int nb_samples, int channels) \
@@ -179,7 +156,8 @@ const AVFilter ff_af_aderivative = { · 123 unmodified lines
179156 .uninit = uninit,
180157 FILTER_INPUTS(aderivative_inputs),
181158 FILTER_OUTPUTS(aderivative_outputs),
182− FILTER_QUERY_FUNC(query_formats),
159+ FILTER_SAMPLEFMTS(AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLTP,
160+ AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_DBLP),
183161 };
184162
185163 const AVFilter ff_af_aintegral = {
@@ -189,5 +167,5 @@ const AVFilter ff_af_aintegral = { · 3 unmodified lines
189167 .uninit = uninit,
190168 FILTER_INPUTS(aderivative_inputs),
191169 FILTER_OUTPUTS(aderivative_outputs),
192− FILTER_QUERY_FUNC(query_formats),
170+ FILTER_SAMPLEFMTS(AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP),
193171 };

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