avfilter/formats: Factor common function combinations out

Several combinations of functions happen quite often in query_format
functions; e.g. ff_set_common_formats(ctx, ff_make_format_list(sample_fmts))
is very common. This commit therefore adds functions that are equivalent
to commonly used function combinations in order to reduce code
duplication.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-08-10 01:25:31 +02:00
parent 55d9d67679
commit 18ec426a86
259 changed files with 469 additions and 1713 deletions

View File

@ -246,28 +246,17 @@ static int query_formats(AVFilterContext *ctx)
static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE };
int64_t chlayouts[] = { eval->chlayout ? eval->chlayout : FF_COUNT2LAYOUT(eval->nb_channels) , -1 };
int sample_rates[] = { eval->sample_rate, -1 };
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats (ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_make_format64_list(chlayouts);
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_rates);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_samplerates_from_list(ctx, sample_rates);
}
static int request_frame(AVFilterLink *outlink)
@ -349,7 +338,6 @@ AVFILTER_DEFINE_CLASS(aeval);
static int aeval_query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts;
AVFilterLink *inlink = ctx->inputs[0];
AVFilterLink *outlink = ctx->outputs[0];
@ -365,8 +353,7 @@ static int aeval_query_formats(AVFilterContext *ctx)
return ret;
if (eval->same_chlayout) {
layouts = ff_all_channel_counts();
if ((ret = ff_set_common_channel_layouts(ctx, layouts)) < 0)
if ((ret = ff_set_common_all_channel_counts(ctx)) < 0)
return ret;
} else {
// outlink supports only requested output channel layout
@ -379,12 +366,10 @@ static int aeval_query_formats(AVFilterContext *ctx)
return ret;
}
formats = ff_make_format_list(sample_fmts);
if ((ret = ff_set_common_formats(ctx, formats)) < 0)
if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int aeval_config_output(AVFilterLink *outlink)

View File

@ -44,8 +44,6 @@ AVFILTER_DEFINE_CLASS(acontrast);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
@ -53,23 +51,15 @@ static int query_formats(AVFilterContext *ctx)
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static void filter_flt(void **d, const void **s,

View File

@ -305,32 +305,21 @@ static void calc_q_factors(int order, double *q)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define BIQUAD_PROCESS(name, type) \

View File

@ -265,32 +265,21 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static av_cold void uninit(AVFilterContext *ctx)

View File

@ -115,31 +115,21 @@ AVFILTER_DEFINE_CLASS(adeclick);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

View File

@ -63,33 +63,20 @@ AVFILTER_DEFINE_CLASS(adelay);
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts;
AVFilterFormats *formats;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_U8P, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S32P,
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define DELAY(name, type, fill) \

View File

@ -45,31 +45,19 @@ typedef struct ADenormContext {
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static void dc_denorm_fltp(AVFilterContext *ctx, void *dstp,

View File

@ -29,8 +29,6 @@ typedef struct ADerivativeContext {
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat derivative_sample_fmts[] = {
AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_DBLP,
@ -40,26 +38,16 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(strcmp(ctx->filter->name, "aintegral") ?
derivative_sample_fmts : integral_sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, strcmp(ctx->filter->name, "aintegral") ?
derivative_sample_fmts : integral_sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define DERIVATIVE(name, type) \

View File

@ -154,33 +154,20 @@ static av_cold int init(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts;
AVFilterFormats *formats;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S32P,
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define MOD(a, b) (((a) >= (b)) ? (a) - (b) : (a))

View File

@ -153,32 +153,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts;
AVFilterFormats *formats;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static inline void set_highshelf_rbj(BiquadCoeffs *bq, double freq, double q, double peak, double sr)

View File

@ -220,32 +220,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static av_cold void uninit(AVFilterContext *ctx)

View File

@ -59,8 +59,6 @@ enum CurveType { NONE = -1, TRI, QSIN, ESIN, HSIN, LOG, IPAR, QUA, CUB, SQU, CBR
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32P,
@ -68,26 +66,15 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static double fade_gain(int curve, int64_t index, int64_t range)

View File

@ -1349,31 +1349,19 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,

View File

@ -412,32 +412,19 @@ static int activate(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static av_cold void uninit(AVFilterContext *ctx)

View File

@ -715,8 +715,6 @@ static int activate(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AudioFIRContext *s = ctx->priv;
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE
@ -729,21 +727,18 @@ static int query_formats(AVFilterContext *ctx)
if (s->response) {
AVFilterLink *videolink = ctx->outputs[1];
formats = ff_make_format_list(pix_fmts);
AVFilterFormats *formats = ff_make_format_list(pix_fmts);
if ((ret = ff_formats_ref(formats, &videolink->incfg.formats)) < 0)
return ret;
}
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
if (s->ir_format) {
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
} else {
AVFilterChannelLayouts *mono = NULL;
AVFilterChannelLayouts *layouts = ff_all_channel_counts();
if ((ret = ff_channel_layouts_ref(layouts, &ctx->inputs[0]->outcfg.channel_layouts)) < 0)
return ret;
@ -759,12 +754,10 @@ static int query_formats(AVFilterContext *ctx)
}
}
formats = ff_make_format_list(sample_fmts);
if ((ret = ff_set_common_formats(ctx, formats)) < 0)
if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_output(AVFilterLink *outlink)

View File

@ -49,32 +49,20 @@ typedef struct AFreqShift {
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define PFILTER(name, type, sin, cos, cc) \

View File

@ -463,31 +463,19 @@ AVFILTER_DEFINE_CLASS(afwtdn);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define pow2(x) (1U << (x))

View File

@ -189,7 +189,6 @@ AVFILTER_DEFINE_CLASS(agate);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts;
int ret;
if ((ret = ff_add_format(&formats, AV_SAMPLE_FMT_DBL)) < 0)
@ -198,18 +197,11 @@ static int query_formats(AVFilterContext *ctx)
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
@ -346,7 +338,6 @@ static int activate(AVFilterContext *ctx)
static int scquery_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL,
@ -371,12 +362,10 @@ static int scquery_formats(AVFilterContext *ctx)
return ret;
}
formats = ff_make_format_list(sample_fmts);
if ((ret = ff_set_common_formats(ctx, formats)) < 0)
if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int scconfig_output(AVFilterLink *outlink)

View File

@ -79,7 +79,6 @@ static int query_formats(AVFilterContext *ctx)
{
AudioIIRContext *s = ctx->priv;
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
@ -98,25 +97,16 @@ static int query_formats(AVFilterContext *ctx)
return ret;
}
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
sample_fmts[0] = s->sample_format;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define IIR_CH(name, type, min, max, need_clipping) \

View File

@ -278,32 +278,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

View File

@ -76,7 +76,6 @@ static int query_formats(AVFilterContext *ctx)
};
AMergeContext *s = ctx->priv;
int64_t inlayout[SWR_CH_MAX], outlayout = 0;
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
int i, ret, overlap = 0, nb_ch = 0;
@ -129,8 +128,7 @@ static int query_formats(AVFilterContext *ctx)
if ((inlayout[i] >> c) & 1)
*(route[i]++) = out_ch_number++;
}
formats = ff_make_format_list(packed_sample_fmts);
if ((ret = ff_set_common_formats(ctx, formats)) < 0)
if ((ret = ff_set_common_formats_from_list(ctx, packed_sample_fmts)) < 0)
return ret;
for (i = 0; i < s->nb_inputs; i++) {
layouts = NULL;
@ -145,7 +143,7 @@ static int query_formats(AVFilterContext *ctx)
if ((ret = ff_channel_layouts_ref(layouts, &ctx->outputs[0]->incfg.channel_layouts)) < 0)
return ret;
return ff_set_common_samplerates(ctx, ff_all_samplerates());
return ff_set_common_all_samplerates(ctx);
}
static int config_output(AVFilterLink *outlink)

View File

@ -603,11 +603,11 @@ static int query_formats(AVFilterContext *ctx)
};
int ret;
if ((ret = ff_set_common_formats(ctx, ff_make_format_list(sample_fmts))) < 0 ||
(ret = ff_set_common_samplerates(ctx, ff_all_samplerates())) < 0)
if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0 ||
(ret = ff_set_common_all_samplerates(ctx)) < 0)
return ret;
return ff_set_common_channel_layouts(ctx, ff_all_channel_counts());
return ff_set_common_all_channel_counts(ctx);
}
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,

View File

@ -42,33 +42,20 @@ typedef struct AudioMultiplyContext {
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int activate(AVFilterContext *ctx)

View File

@ -95,31 +95,19 @@ AVFILTER_DEFINE_CLASS(anlmdn);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static float compute_distance_ssd_c(const float *f1, const float *f2, ptrdiff_t K)

View File

@ -78,32 +78,19 @@ AVFILTER_DEFINE_CLASS(anlms);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static float fir_sample(AudioNLMSContext *s, float sample, float *delay,

View File

@ -85,8 +85,6 @@ static av_cold int init(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
@ -94,26 +92,15 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define MOD(a, b) (((a) >= (b)) ? (a) - (b) : (a))

View File

@ -196,8 +196,7 @@ static int query_formats(AVFilterContext *ctx)
(ret = ff_set_common_channel_layouts (ctx , layout )) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

View File

@ -330,33 +330,21 @@ static int rnnoise_model_from_file(FILE *f, RNNModel **rnn)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE
};
int ret, sample_rates[] = { 48000, -1 };
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_rates);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_samplerates_from_list(ctx, sample_rates);
}
static int config_input(AVFilterLink *inlink)

View File

@ -84,32 +84,20 @@ AVFILTER_DEFINE_CLASS(asoftclip);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static void filter_flt(ASoftClipContext *s,

View File

@ -133,7 +133,7 @@ static int query_formats(AVFilterContext *ctx)
(ret = ff_set_common_formats (ctx , formats )) < 0 ||
(ret = ff_add_channel_layout (&layout , AV_CH_LAYOUT_MONO )) < 0 ||
(ret = ff_set_common_channel_layouts (ctx , layout )) < 0 ||
(ret = ff_set_common_samplerates (ctx , ff_make_format_list(sample_rates) )) < 0)
(ret = ff_set_common_samplerates_from_list(ctx, sample_rates )) < 0)
return ret;
return 0;

View File

@ -147,8 +147,6 @@ AVFILTER_DEFINE_CLASS(astats);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32P,
@ -157,26 +155,15 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static void reset_stats(AudioStatsContext *s)

View File

@ -46,31 +46,19 @@ typedef struct ASubBoostContext {
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int get_coeffs(AVFilterContext *ctx)

View File

@ -51,32 +51,20 @@ typedef struct ASuperCutContext {
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static void calc_q_factors(int n, double *q)

View File

@ -995,9 +995,6 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts = NULL;
AVFilterFormats *formats = NULL;
// WSOLA necessitates an internal sliding window ring buffer
// for incoming audio stream.
//
@ -1012,29 +1009,15 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_DBL,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts) {
return AVERROR(ENOMEM);
}
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats) {
return AVERROR(ENOMEM);
}
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats) {
return AVERROR(ENOMEM);
}
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_props(AVFilterLink *inlink)

View File

@ -48,32 +48,19 @@ typedef struct AudioXCorrelateContext {
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static float mean_sum(const float *in, int size)

View File

@ -146,8 +146,6 @@ typedef struct BiquadsContext {
static int query_formats(AVFilterContext *ctx)
{
BiquadsContext *s = ctx->priv;
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat auto_sample_fmts[] = {
AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_S32P,
@ -159,46 +157,33 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
const enum AVSampleFormat *sample_fmts_list = sample_fmts;
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
switch (s->precision) {
case 0:
sample_fmts[0] = AV_SAMPLE_FMT_S16P;
formats = ff_make_format_list(sample_fmts);
break;
case 1:
sample_fmts[0] = AV_SAMPLE_FMT_S32P;
formats = ff_make_format_list(sample_fmts);
break;
case 2:
sample_fmts[0] = AV_SAMPLE_FMT_FLTP;
formats = ff_make_format_list(sample_fmts);
break;
case 3:
sample_fmts[0] = AV_SAMPLE_FMT_DBLP;
formats = ff_make_format_list(sample_fmts);
break;
default:
formats = ff_make_format_list(auto_sample_fmts);
sample_fmts_list = auto_sample_fmts;
break;
}
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts_list);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define BIQUAD_FILTER(name, type, min, max, need_clipping) \

View File

@ -92,7 +92,6 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
@ -111,17 +110,11 @@ static int query_formats(AVFilterContext *ctx)
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)

View File

@ -284,7 +284,7 @@ static int channelmap_query_formats(AVFilterContext *ctx)
int ret;
if ((ret = ff_set_common_formats (ctx, ff_planar_sample_fmts())) < 0 ||
(ret = ff_set_common_samplerates (ctx , ff_all_samplerates() )) < 0 ||
(ret = ff_set_common_all_samplerates(ctx )) < 0 ||
(ret = ff_add_channel_layout(&channel_layouts, s->output_layout)) < 0 ||
(ret = ff_channel_layouts_ref(channel_layouts,
&ctx->outputs[0]->incfg.channel_layouts)) < 0)

View File

@ -113,7 +113,7 @@ static int query_formats(AVFilterContext *ctx)
int i, ret;
if ((ret = ff_set_common_formats(ctx, ff_planar_sample_fmts())) < 0 ||
(ret = ff_set_common_samplerates(ctx, ff_all_samplerates())) < 0)
(ret = ff_set_common_all_samplerates(ctx)) < 0)
return ret;
if ((ret = ff_add_channel_layout(&in_layouts, s->channel_layout)) < 0 ||

View File

@ -156,31 +156,18 @@ static av_cold int init(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_output(AVFilterLink *outlink)

View File

@ -102,32 +102,19 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts;
AVFilterFormats *formats;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static void count_items(char *item_str, int *nb_items)

View File

@ -65,32 +65,19 @@ AVFILTER_DEFINE_CLASS(compensationdelay);
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts;
AVFilterFormats *formats;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

View File

@ -48,7 +48,7 @@ static int query_formats(AVFilterContext *ctx)
(ret = ff_set_common_formats (ctx , formats )) < 0 ||
(ret = ff_add_channel_layout (&layout , AV_CH_LAYOUT_STEREO)) < 0 ||
(ret = ff_set_common_channel_layouts (ctx , layout )) < 0 ||
(ret = ff_set_common_samplerates (ctx , ff_all_samplerates())) < 0)
(ret = ff_set_common_all_samplerates (ctx )) < 0)
return ret;
return 0;

View File

@ -45,32 +45,20 @@ AVFILTER_DEFINE_CLASS(crystalizer);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
typedef struct ThreadData {

View File

@ -54,31 +54,18 @@ static av_cold int init(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts;
AVFilterFormats *formats;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int filter_frame(AVFilterLink *inlink, AVFrame *in)

View File

@ -70,31 +70,19 @@ AVFILTER_DEFINE_CLASS(deesser);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

View File

@ -55,32 +55,19 @@ AVFILTER_DEFINE_CLASS(drmeter);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_output(AVFilterLink *outlink)

View File

@ -129,32 +129,19 @@ static av_cold int init(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static inline int frame_size(int sample_rate, int frame_len_msec)

View File

@ -90,7 +90,7 @@ static int query_formats(AVFilterContext *ctx)
(ret = ff_set_common_formats (ctx , formats )) < 0 ||
(ret = ff_add_channel_layout (&layout , AV_CH_LAYOUT_STEREO )) < 0 ||
(ret = ff_set_common_channel_layouts (ctx , layout )) < 0 ||
(ret = ff_set_common_samplerates (ctx , ff_make_format_list(sample_rates) )) < 0)
(ret = ff_set_common_samplerates_from_list(ctx, sample_rates)) < 0)
return ret;
return 0;

View File

@ -53,8 +53,7 @@ static int query_formats(AVFilterContext *ctx)
(ret = ff_set_common_channel_layouts (ctx , layout )) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int filter_frame(AVFilterLink *inlink, AVFrame *in)

View File

@ -182,32 +182,19 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts;
AVFilterFormats *formats;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static void fast_convolute(FIREqualizerContext *av_restrict s, const float *av_restrict kernel_buf, float *av_restrict conv_buf,

View File

@ -90,31 +90,18 @@ static av_cold int init(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts;
AVFilterFormats *formats;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

View File

@ -91,8 +91,7 @@ static int query_formats(AVFilterContext *ctx)
(ret = ff_set_common_channel_layouts (ctx , layout )) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

View File

@ -1648,8 +1648,7 @@ static int query_formats(AVFilterContext *ctx)
if (ret < 0)
return ret;
return
ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates) );
return ff_set_common_samplerates_from_list(ctx, sample_rates);
}
static av_cold void uninit(AVFilterContext *ctx)

View File

@ -624,10 +624,7 @@ static int query_formats(AVFilterContext *ctx)
}
}
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

View File

@ -238,7 +238,7 @@ static int join_query_formats(AVFilterContext *ctx)
}
if ((ret = ff_set_common_formats(ctx, ff_planar_sample_fmts())) < 0 ||
(ret = ff_set_common_samplerates(ctx, ff_all_samplerates())) < 0)
(ret = ff_set_common_all_samplerates(ctx)) < 0)
return ret;
return 0;

View File

@ -657,42 +657,28 @@ static av_cold int init(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
LADSPAContext *s = ctx->priv;
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE };
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
if (s->nb_inputs) {
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_samplerates(ctx, formats);
ret = ff_set_common_all_samplerates(ctx);
if (ret < 0)
return ret;
} else {
int sample_rates[] = { s->sample_rate, -1 };
ret = ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates));
ret = ff_set_common_samplerates_from_list(ctx, sample_rates);
if (ret < 0)
return ret;
}
if (s->nb_inputs == 1 && s->nb_outputs == 1) {
// We will instantiate multiple LADSPA_Handle, one over each channel
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
} else if (s->nb_inputs == 2 && s->nb_outputs == 2) {

View File

@ -685,7 +685,6 @@ static int query_formats(AVFilterContext *ctx)
{
LoudNormContext *s = ctx->priv;
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
AVFilterLink *inlink = ctx->inputs[0];
AVFilterLink *outlink = ctx->outputs[0];
static const int input_srate[] = {192000, -1};
@ -693,19 +692,11 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_DBL,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;

View File

@ -476,32 +476,22 @@ static av_cold int init(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
LV2Context *s = ctx->priv;
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
AVFilterLink *outlink = ctx->outputs[0];
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE };
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
if (s->nb_inputs) {
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_samplerates(ctx, formats);
ret = ff_set_common_all_samplerates(ctx);
if (ret < 0)
return ret;
} else {
int sample_rates[] = { s->sample_rate, -1 };
ret = ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates));
ret = ff_set_common_samplerates_from_list(ctx, sample_rates);
if (ret < 0)
return ret;
}

View File

@ -124,32 +124,19 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterChannelLayouts *layouts;
AVFilterFormats *formats;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static void count_items(char *item_str, int *nb_items, char delimiter)

View File

@ -251,7 +251,6 @@ static int query_formats(AVFilterContext *ctx)
PanContext *pan = ctx->priv;
AVFilterLink *inlink = ctx->inputs[0];
AVFilterLink *outlink = ctx->outputs[0];
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts;
int ret;
@ -260,8 +259,7 @@ static int query_formats(AVFilterContext *ctx)
if ((ret = ff_set_common_formats(ctx, ff_all_formats(AVMEDIA_TYPE_AUDIO))) < 0)
return ret;
formats = ff_all_samplerates();
if ((ret = ff_set_common_samplerates(ctx, formats)) < 0)
if ((ret = ff_set_common_all_samplerates(ctx)) < 0)
return ret;
// inlink supports any channel layout

View File

@ -91,32 +91,19 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE,
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int filter_frame(AVFilterLink *inlink, AVFrame *in)

View File

@ -297,7 +297,6 @@ static int activate(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL,
@ -322,12 +321,10 @@ static int query_formats(AVFilterContext *ctx)
return ret;
}
formats = ff_make_format_list(sample_fmts);
if ((ret = ff_set_common_formats(ctx, formats)) < 0)
if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_output(AVFilterLink *outlink)
@ -433,32 +430,19 @@ static int acompressor_filter_frame(AVFilterLink *inlink, AVFrame *in)
static int acompressor_query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
#define acompressor_options options

View File

@ -197,7 +197,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL,
@ -215,17 +214,11 @@ static int query_formats(AVFilterContext *ctx)
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static av_cold void uninit(AVFilterContext *ctx)

View File

@ -889,33 +889,20 @@ static int request_frame(AVFilterLink *outlink)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static av_cold void uninit(AVFilterContext *ctx)

View File

@ -648,7 +648,6 @@ static int activate(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
struct SOFAlizerContext *s = ctx->priv;
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
int ret, sample_rates[] = { 48000, -1 };
static const enum AVSampleFormat sample_fmts[] = {
@ -656,10 +655,7 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_NONE
};
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret)
return ret;
@ -681,10 +677,7 @@ static int query_formats(AVFilterContext *ctx)
return ret;
sample_rates[0] = s->sample_rate;
formats = ff_make_format_list(sample_rates);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_samplerates_from_list(ctx, sample_rates);
}
static int getfilter_float(AVFilterContext *ctx, float x, float y, float z,

View File

@ -116,32 +116,19 @@ AVFILTER_DEFINE_CLASS(speechnorm);
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int get_pi_samples(PeriodItem *pi, int start, int end, int remain)

View File

@ -111,8 +111,7 @@ static int query_formats(AVFilterContext *ctx)
(ret = ff_set_common_channel_layouts (ctx , layout )) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

View File

@ -64,8 +64,7 @@ static int query_formats(AVFilterContext *ctx)
(ret = ff_set_common_channel_layouts (ctx , layout )) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

View File

@ -272,27 +272,18 @@ static av_cold int init(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if ((ret = ff_set_common_formats(ctx, formats)) < 0)
if ((ret = ff_set_common_formats_from_list(ctx, sample_fmts)) < 0)
return ret;
formats = ff_all_samplerates();
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

View File

@ -188,10 +188,7 @@ static int query_formats(AVFilterContext *ctx)
if (ret)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static int config_input(AVFilterLink *inlink)

View File

@ -85,32 +85,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBL,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static av_cold void uninit(AVFilterContext *ctx)

View File

@ -113,32 +113,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[] = {
AV_SAMPLE_FMT_DBLP,
AV_SAMPLE_FMT_NONE
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static av_cold void uninit(AVFilterContext *ctx)

View File

@ -132,8 +132,6 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
VolumeContext *vol = ctx->priv;
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts;
static const enum AVSampleFormat sample_fmts[][7] = {
[PRECISION_FIXED] = {
AV_SAMPLE_FMT_U8,
@ -155,26 +153,15 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_NONE
}
};
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_fmts[vol->precision]);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, formats);
ret = ff_set_common_formats_from_list(ctx, sample_fmts[vol->precision]);
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static inline void scale_samples_u8(uint8_t *dst, const uint8_t *src,

View File

@ -40,21 +40,11 @@ static int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_S16P,
AV_SAMPLE_FMT_NONE
};
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
int ret;
if (!(formats = ff_make_format_list(sample_fmts)))
return AVERROR(ENOMEM);
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
return ff_set_common_formats(ctx, formats);
return ff_set_common_formats_from_list(ctx, sample_fmts);
}
static int filter_frame(AVFilterLink *inlink, AVFrame *samples)

View File

@ -134,29 +134,15 @@ static av_cold int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_FLT,
AV_SAMPLE_FMT_NONE
};
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats (ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_make_format64_list(chlayouts);
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_rates);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_samplerates_from_list(ctx, sample_rates);
}
static int parse_string(char *str, float **items, int *nb_items, int *items_size)

View File

@ -90,29 +90,15 @@ static av_cold int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_DBL,
AV_SAMPLE_FMT_NONE
};
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats (ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_make_format64_list(chlayouts);
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_rates);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_samplerates_from_list(ctx, sample_rates);
}
static double white_filter(double white, double *buf, double ha)

View File

@ -87,10 +87,10 @@ static int query_formats(AVFilterContext *ctx)
int ret;
if ((ret = ff_set_common_formats (ctx, ff_all_formats (AVMEDIA_TYPE_AUDIO))) < 0 ||
(ret = ff_set_common_samplerates (ctx, ff_make_format_list (sample_rates ))) < 0)
(ret = ff_set_common_samplerates_from_list(ctx, sample_rates)) < 0)
return ret;
return ff_set_common_channel_layouts(ctx, ff_make_format64_list(chlayouts));
return ff_set_common_channel_layouts_from_list(ctx, chlayouts);
}
static av_cold int config_props(AVFilterLink *outlink)

View File

@ -102,29 +102,15 @@ static av_cold int query_formats(AVFilterContext *ctx)
AV_SAMPLE_FMT_FLT,
AV_SAMPLE_FMT_NONE
};
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats (ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_make_format64_list(chlayouts);
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_rates);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_samplerates_from_list(ctx, sample_rates);
}
static av_cold int config_props(AVFilterLink *outlink)

View File

@ -74,28 +74,15 @@ static int query_formats(AVFilterContext *ctx)
int sample_rates[] = { s->sample_rate, -1 };
static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLT,
AV_SAMPLE_FMT_NONE };
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats (ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_make_format64_list(chlayouts);
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_rates);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_samplerates_from_list(ctx, sample_rates);
}
static float bessel_I_0(float x)

View File

@ -183,28 +183,15 @@ static av_cold int query_formats(AVFilterContext *ctx)
int sample_rates[] = { sine->sample_rate, -1 };
static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16,
AV_SAMPLE_FMT_NONE };
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
int ret;
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
ret = ff_set_common_formats (ctx, formats);
int ret = ff_set_common_formats_from_list(ctx, sample_fmts);
if (ret < 0)
return ret;
layouts = ff_make_format64_list(chlayouts);
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
ret = ff_set_common_channel_layouts_from_list(ctx, chlayouts);
if (ret < 0)
return ret;
formats = ff_make_format_list(sample_rates);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_samplerates_from_list(ctx, sample_rates);
}
static av_cold int config_props(AVFilterLink *outlink)

View File

@ -362,7 +362,6 @@ static int filter_query_formats(AVFilterContext *ctx)
int ret, i;
AVFilterFormats *formats;
AVFilterChannelLayouts *chlayouts;
AVFilterFormats *samplerates;
enum AVMediaType type = ctx->inputs && ctx->inputs [0] ? ctx->inputs [0]->type :
ctx->outputs && ctx->outputs[0] ? ctx->outputs[0]->type :
AVMEDIA_TYPE_VIDEO;
@ -386,8 +385,7 @@ static int filter_query_formats(AVFilterContext *ctx)
if ((ret = ff_set_common_formats(ctx, formats)) < 0)
return ret;
if (type == AVMEDIA_TYPE_AUDIO) {
samplerates = ff_all_samplerates();
if ((ret = ff_set_common_samplerates(ctx, samplerates)) < 0)
if ((ret = ff_set_common_all_samplerates(ctx)) < 0)
return ret;
chlayouts = ff_all_channel_layouts();
if ((ret = ff_set_common_channel_layouts(ctx, chlayouts)) < 0)

View File

@ -149,14 +149,7 @@ const AVFilter ff_vf_reverse = {
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats;
AVFilterChannelLayouts *layouts;
int ret;
layouts = ff_all_channel_counts();
if (!layouts)
return AVERROR(ENOMEM);
ret = ff_set_common_channel_layouts(ctx, layouts);
int ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
@ -164,10 +157,7 @@ static int query_formats(AVFilterContext *ctx)
if (ret < 0)
return ret;
formats = ff_all_samplerates();
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_samplerates(ctx, formats);
return ff_set_common_all_samplerates(ctx);
}
static void reverse_samples_planar(AVFrame *out)

View File

@ -497,7 +497,6 @@ static int query_formats(AVFilterContext *ctx)
if (!select->do_scene_detect) {
return ff_default_query_formats(ctx);
} else {
int ret;
static const enum AVPixelFormat pix_fmts[] = {
AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_RGBA,
AV_PIX_FMT_ABGR, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8,
@ -506,15 +505,8 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_YUV420P10,
AV_PIX_FMT_NONE
};
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
if (!fmts_list)
return AVERROR(ENOMEM);
ret = ff_set_common_formats(ctx, fmts_list);
if (ret < 0)
return ret;
return ff_set_common_formats_from_list(ctx, pix_fmts);
}
return 0;
}
DEFINE_OPTIONS(select, AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM);

View File

@ -305,8 +305,7 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats, *rates = NULL;
AVFilterChannelLayouts *layouts = NULL;
AVFilterFormats *formats;
int ret, i;
for (i = 0; i < ctx->nb_inputs; i++) {
@ -315,11 +314,8 @@ static int query_formats(AVFilterContext *ctx)
return ret;
if (ctx->inputs[i]->type == AVMEDIA_TYPE_AUDIO) {
rates = ff_all_samplerates();
if ((ret = ff_set_common_samplerates(ctx, rates)) < 0)
return ret;
layouts = ff_all_channel_counts();
if ((ret = ff_set_common_channel_layouts(ctx, layouts)) < 0)
if ((ret = ff_set_common_all_samplerates (ctx)) < 0 ||
(ret = ff_set_common_all_channel_counts(ctx)) < 0)
return ret;
}
}

View File

@ -566,6 +566,17 @@ int ff_set_common_channel_layouts(AVFilterContext *ctx,
ff_channel_layouts_ref, ff_channel_layouts_unref);
}
int ff_set_common_channel_layouts_from_list(AVFilterContext *ctx,
const int64_t *fmts)
{
return ff_set_common_channel_layouts(ctx, ff_make_format64_list(fmts));
}
int ff_set_common_all_channel_counts(AVFilterContext *ctx)
{
return ff_set_common_channel_layouts(ctx, ff_all_channel_counts());
}
int ff_set_common_samplerates(AVFilterContext *ctx,
AVFilterFormats *samplerates)
{
@ -573,6 +584,17 @@ int ff_set_common_samplerates(AVFilterContext *ctx,
ff_formats_ref, ff_formats_unref);
}
int ff_set_common_samplerates_from_list(AVFilterContext *ctx,
const int *samplerates)
{
return ff_set_common_samplerates(ctx, ff_make_format_list(samplerates));
}
int ff_set_common_all_samplerates(AVFilterContext *ctx)
{
return ff_set_common_samplerates(ctx, ff_all_samplerates());
}
/**
* A helper for query_formats() which sets all links to the same list of
* formats. If there are no links hooked to this filter, the list of formats is
@ -584,6 +606,11 @@ int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
ff_formats_ref, ff_formats_unref);
}
int ff_set_common_formats_from_list(AVFilterContext *ctx, const int *fmts)
{
return ff_set_common_formats(ctx, ff_make_format_list(fmts));
}
int ff_default_query_formats(AVFilterContext *ctx)
{
int ret;
@ -595,10 +622,10 @@ int ff_default_query_formats(AVFilterContext *ctx)
if (ret < 0)
return ret;
if (type == AVMEDIA_TYPE_AUDIO) {
ret = ff_set_common_channel_layouts(ctx, ff_all_channel_counts());
ret = ff_set_common_all_channel_counts(ctx);
if (ret < 0)
return ret;
ret = ff_set_common_samplerates(ctx, ff_all_samplerates());
ret = ff_set_common_all_samplerates(ctx);
if (ret < 0)
return ret;
}

View File

@ -164,9 +164,32 @@ AVFilterChannelLayouts *ff_make_format64_list(const int64_t *fmts);
av_warn_unused_result
int ff_set_common_channel_layouts(AVFilterContext *ctx,
AVFilterChannelLayouts *layouts);
/**
* Equivalent to ff_set_common_channel_layouts(ctx, ff_make_format64_list(fmts))
*/
av_warn_unused_result
int ff_set_common_channel_layouts_from_list(AVFilterContext *ctx,
const int64_t *fmts);
/**
* Equivalent to ff_set_common_channel_layouts(ctx, ff_all_channel_counts())
*/
av_warn_unused_result
int ff_set_common_all_channel_counts(AVFilterContext *ctx);
av_warn_unused_result
int ff_set_common_samplerates(AVFilterContext *ctx,
AVFilterFormats *samplerates);
/**
* Equivalent to ff_set_common_samplerates(ctx, ff_make_format_list(samplerates))
*/
av_warn_unused_result
int ff_set_common_samplerates_from_list(AVFilterContext *ctx,
const int *samplerates);
/**
* Equivalent to ff_set_common_samplerates(ctx, ff_all_samplerates())
*/
av_warn_unused_result
int ff_set_common_all_samplerates(AVFilterContext *ctx);
/**
* A helper for query_formats() which sets all links to the same list of
@ -176,6 +199,12 @@ int ff_set_common_samplerates(AVFilterContext *ctx,
av_warn_unused_result
int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats);
/**
* Equivalent to ff_set_common_formats(ctx, ff_make_format_list(fmts))
*/
av_warn_unused_result
int ff_set_common_formats_from_list(AVFilterContext *ctx, const int *fmts);
av_warn_unused_result
int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout);

View File

@ -31,13 +31,8 @@ int ff_opencl_filter_query_formats(AVFilterContext *avctx)
AV_PIX_FMT_OPENCL,
AV_PIX_FMT_NONE,
};
AVFilterFormats *formats;
formats = ff_make_format_list(pix_fmts);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_formats(avctx, formats);
return ff_set_common_formats_from_list(avctx, pix_fmts);
}
static int opencl_filter_set_device(AVFilterContext *avctx,

View File

@ -78,10 +78,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16,
AV_PIX_FMT_NONE
};
AVFilterFormats *formats = ff_make_format_list(pixel_fmts);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_formats(ctx, formats);
return ff_set_common_formats_from_list(ctx, pixel_fmts);
}
static av_cold int init(AVFilterContext *ctx)

View File

@ -120,10 +120,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16,
AV_PIX_FMT_NONE
};
AVFilterFormats *formats = ff_make_format_list(pixel_fmts);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_formats(ctx, formats);
return ff_set_common_formats_from_list(ctx, pixel_fmts);
}
static av_cold int init(AVFilterContext *ctx)

View File

@ -246,7 +246,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE
};
return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static int filter_frame(AVFilterLink *inlink, AVFrame *in)

View File

@ -72,10 +72,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE,
};
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
if (!fmts_list)
return AVERROR(ENOMEM);
return ff_set_common_formats(ctx, fmts_list);
return ff_set_common_formats_from_list(ctx, pix_fmts);
}
#define SET_META(key, value) \

View File

@ -89,7 +89,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE
};
return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static int config_params(AVFilterContext *ctx)

View File

@ -67,10 +67,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE
};
AVFilterFormats *formats = ff_make_format_list(pixfmts);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_formats(ctx, formats);
return ff_set_common_formats_from_list(ctx, pixfmts);
}
static int config_input(AVFilterLink *inlink)

View File

@ -98,10 +98,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE
};
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
if (!fmts_list)
return AVERROR(ENOMEM);
return ff_set_common_formats(ctx, fmts_list);
return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static int config_input(AVFilterLink *inlink)

View File

@ -54,10 +54,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE
};
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
if (!fmts_list)
return AVERROR(ENOMEM);
return ff_set_common_formats(ctx, fmts_list);
return ff_set_common_formats_from_list(ctx, pix_fmts);
}
#define SET_META(key, format, value) \

View File

@ -680,10 +680,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE
};
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
if (!fmts_list)
return AVERROR(ENOMEM);
return ff_set_common_formats(ctx, fmts_list);
return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static av_cold void uninit(AVFilterContext *ctx)

View File

@ -188,10 +188,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE
};
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
if (!fmts_list)
return AVERROR(ENOMEM);
return ff_set_common_formats(ctx, fmts_list);
return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static int do_search_boundary(int pos, int plane_boundary, int search_range, int search_step)

View File

@ -321,11 +321,7 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NONE
};
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
if (!fmts_list)
return AVERROR(ENOMEM);
return ff_set_common_formats(ctx, fmts_list);
return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static int config_props(AVFilterLink *link)

View File

@ -230,13 +230,7 @@ static av_cold int query_formats(AVFilterContext *avctx)
AV_PIX_FMT_NONE
};
AVFilterFormats *formats = NULL;
formats = ff_make_format_list(pixel_fmts);
if (!formats)
return AVERROR(ENOMEM);
return ff_set_common_formats(avctx, formats);
return ff_set_common_formats_from_list(avctx, pixel_fmts);
}
static av_cold int config_input(AVFilterLink *inlink)

Some files were not shown because too many files have changed in this diff Show More