diff --git a/libavfilter/aeval.c b/libavfilter/aeval.c index 007758bf57..7c891c5ad0 100644 --- a/libavfilter/aeval.c +++ b/libavfilter/aeval.c @@ -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) diff --git a/libavfilter/af_acontrast.c b/libavfilter/af_acontrast.c index 69fe6b7e22..d4128e7495 100644 --- a/libavfilter/af_acontrast.c +++ b/libavfilter/af_acontrast.c @@ -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, diff --git a/libavfilter/af_acrossover.c b/libavfilter/af_acrossover.c index 3ba67b30e1..4d3eae2d62 100644 --- a/libavfilter/af_acrossover.c +++ b/libavfilter/af_acrossover.c @@ -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) \ diff --git a/libavfilter/af_acrusher.c b/libavfilter/af_acrusher.c index ce337013ab..447d049062 100644 --- a/libavfilter/af_acrusher.c +++ b/libavfilter/af_acrusher.c @@ -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) diff --git a/libavfilter/af_adeclick.c b/libavfilter/af_adeclick.c index 798838f522..e1ecbc4c9b 100644 --- a/libavfilter/af_adeclick.c +++ b/libavfilter/af_adeclick.c @@ -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) diff --git a/libavfilter/af_adelay.c b/libavfilter/af_adelay.c index c6450cb2b9..7640cca357 100644 --- a/libavfilter/af_adelay.c +++ b/libavfilter/af_adelay.c @@ -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) \ diff --git a/libavfilter/af_adenorm.c b/libavfilter/af_adenorm.c index ee8d26ee73..b5679b0f20 100644 --- a/libavfilter/af_adenorm.c +++ b/libavfilter/af_adenorm.c @@ -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, diff --git a/libavfilter/af_aderivative.c b/libavfilter/af_aderivative.c index 6b3e4dd0e4..0933bb22a9 100644 --- a/libavfilter/af_aderivative.c +++ b/libavfilter/af_aderivative.c @@ -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) \ diff --git a/libavfilter/af_aecho.c b/libavfilter/af_aecho.c index 4e45ab9a8b..bc040536b0 100644 --- a/libavfilter/af_aecho.c +++ b/libavfilter/af_aecho.c @@ -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)) diff --git a/libavfilter/af_aemphasis.c b/libavfilter/af_aemphasis.c index 66fe7036fa..621e0fe7cf 100644 --- a/libavfilter/af_aemphasis.c +++ b/libavfilter/af_aemphasis.c @@ -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) diff --git a/libavfilter/af_aexciter.c b/libavfilter/af_aexciter.c index e7f72cca38..6ebf2828df 100644 --- a/libavfilter/af_aexciter.c +++ b/libavfilter/af_aexciter.c @@ -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) diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c index b22432f2e7..f39c0e45b6 100644 --- a/libavfilter/af_afade.c +++ b/libavfilter/af_afade.c @@ -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) diff --git a/libavfilter/af_afftdn.c b/libavfilter/af_afftdn.c index 693585439b..6ac2a30e70 100644 --- a/libavfilter/af_afftdn.c +++ b/libavfilter/af_afftdn.c @@ -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, diff --git a/libavfilter/af_afftfilt.c b/libavfilter/af_afftfilt.c index 877ccc5be0..314585c419 100644 --- a/libavfilter/af_afftfilt.c +++ b/libavfilter/af_afftfilt.c @@ -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) diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c index 309eb3dd2e..bb07d31726 100644 --- a/libavfilter/af_afir.c +++ b/libavfilter/af_afir.c @@ -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) diff --git a/libavfilter/af_afreqshift.c b/libavfilter/af_afreqshift.c index 85a1e65a96..caacdbccae 100644 --- a/libavfilter/af_afreqshift.c +++ b/libavfilter/af_afreqshift.c @@ -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) \ diff --git a/libavfilter/af_afwtdn.c b/libavfilter/af_afwtdn.c index a23bb902ea..8d67d6458e 100644 --- a/libavfilter/af_afwtdn.c +++ b/libavfilter/af_afwtdn.c @@ -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)) diff --git a/libavfilter/af_agate.c b/libavfilter/af_agate.c index 3c858021d1..eb77dfbcc5 100644 --- a/libavfilter/af_agate.c +++ b/libavfilter/af_agate.c @@ -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) diff --git a/libavfilter/af_aiir.c b/libavfilter/af_aiir.c index 6ac39872ef..a396ec7885 100644 --- a/libavfilter/af_aiir.c +++ b/libavfilter/af_aiir.c @@ -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) \ diff --git a/libavfilter/af_alimiter.c b/libavfilter/af_alimiter.c index 30f1a4cba5..8ff64c8a7b 100644 --- a/libavfilter/af_alimiter.c +++ b/libavfilter/af_alimiter.c @@ -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) diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c index 2e45b7c277..7749495970 100644 --- a/libavfilter/af_amerge.c +++ b/libavfilter/af_amerge.c @@ -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) diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c index 2296b49243..003c1717cd 100644 --- a/libavfilter/af_amix.c +++ b/libavfilter/af_amix.c @@ -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, diff --git a/libavfilter/af_amultiply.c b/libavfilter/af_amultiply.c index b50bbfb6ce..f6814a802d 100644 --- a/libavfilter/af_amultiply.c +++ b/libavfilter/af_amultiply.c @@ -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) diff --git a/libavfilter/af_anlmdn.c b/libavfilter/af_anlmdn.c index 05e84282f0..58cbf8fab1 100644 --- a/libavfilter/af_anlmdn.c +++ b/libavfilter/af_anlmdn.c @@ -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) diff --git a/libavfilter/af_anlms.c b/libavfilter/af_anlms.c index 26df40107f..cc25ff6586 100644 --- a/libavfilter/af_anlms.c +++ b/libavfilter/af_anlms.c @@ -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, diff --git a/libavfilter/af_aphaser.c b/libavfilter/af_aphaser.c index e033a6d904..5f3244246f 100644 --- a/libavfilter/af_aphaser.c +++ b/libavfilter/af_aphaser.c @@ -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)) diff --git a/libavfilter/af_apulsator.c b/libavfilter/af_apulsator.c index 56ff4579d6..cef49d891f 100644 --- a/libavfilter/af_apulsator.c +++ b/libavfilter/af_apulsator.c @@ -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) diff --git a/libavfilter/af_arnndn.c b/libavfilter/af_arnndn.c index 0c70a32271..9bb1df437d 100644 --- a/libavfilter/af_arnndn.c +++ b/libavfilter/af_arnndn.c @@ -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) diff --git a/libavfilter/af_asoftclip.c b/libavfilter/af_asoftclip.c index 17361ba3a2..a82c523bd4 100644 --- a/libavfilter/af_asoftclip.c +++ b/libavfilter/af_asoftclip.c @@ -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, diff --git a/libavfilter/af_asr.c b/libavfilter/af_asr.c index b34cdd38ee..8dbe67fa5b 100644 --- a/libavfilter/af_asr.c +++ b/libavfilter/af_asr.c @@ -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; diff --git a/libavfilter/af_astats.c b/libavfilter/af_astats.c index 23a5785d5a..0e6650cacb 100644 --- a/libavfilter/af_astats.c +++ b/libavfilter/af_astats.c @@ -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) diff --git a/libavfilter/af_asubboost.c b/libavfilter/af_asubboost.c index f36ce81552..02d88c4c85 100644 --- a/libavfilter/af_asubboost.c +++ b/libavfilter/af_asubboost.c @@ -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) diff --git a/libavfilter/af_asupercut.c b/libavfilter/af_asupercut.c index 54921cf4c3..439cab6d6d 100644 --- a/libavfilter/af_asupercut.c +++ b/libavfilter/af_asupercut.c @@ -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) diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c index 80a33c43ed..56f216d832 100644 --- a/libavfilter/af_atempo.c +++ b/libavfilter/af_atempo.c @@ -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) diff --git a/libavfilter/af_axcorrelate.c b/libavfilter/af_axcorrelate.c index cec39dee76..ffb90fce7f 100644 --- a/libavfilter/af_axcorrelate.c +++ b/libavfilter/af_axcorrelate.c @@ -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) diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c index 0baf5541fd..253383fc6f 100644 --- a/libavfilter/af_biquads.c +++ b/libavfilter/af_biquads.c @@ -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) \ diff --git a/libavfilter/af_bs2b.c b/libavfilter/af_bs2b.c index 7b9958325f..beb1d0f341 100644 --- a/libavfilter/af_bs2b.c +++ b/libavfilter/af_bs2b.c @@ -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) diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c index 3cdf8b2bd8..f77bba363c 100644 --- a/libavfilter/af_channelmap.c +++ b/libavfilter/af_channelmap.c @@ -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) diff --git a/libavfilter/af_channelsplit.c b/libavfilter/af_channelsplit.c index 3bd3355d88..d6f1438b86 100644 --- a/libavfilter/af_channelsplit.c +++ b/libavfilter/af_channelsplit.c @@ -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 || diff --git a/libavfilter/af_chorus.c b/libavfilter/af_chorus.c index 72e684bd3a..000f1d2d07 100644 --- a/libavfilter/af_chorus.c +++ b/libavfilter/af_chorus.c @@ -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) diff --git a/libavfilter/af_compand.c b/libavfilter/af_compand.c index 62d9c2e941..37c1884537 100644 --- a/libavfilter/af_compand.c +++ b/libavfilter/af_compand.c @@ -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) diff --git a/libavfilter/af_compensationdelay.c b/libavfilter/af_compensationdelay.c index f2e0dcd467..3b91145cd0 100644 --- a/libavfilter/af_compensationdelay.c +++ b/libavfilter/af_compensationdelay.c @@ -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) diff --git a/libavfilter/af_crossfeed.c b/libavfilter/af_crossfeed.c index 7ad9c4f483..1d0f8a8149 100644 --- a/libavfilter/af_crossfeed.c +++ b/libavfilter/af_crossfeed.c @@ -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; diff --git a/libavfilter/af_crystalizer.c b/libavfilter/af_crystalizer.c index f4ad326ede..27d3579b7c 100644 --- a/libavfilter/af_crystalizer.c +++ b/libavfilter/af_crystalizer.c @@ -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 { diff --git a/libavfilter/af_dcshift.c b/libavfilter/af_dcshift.c index 1384ad87bf..a722928b18 100644 --- a/libavfilter/af_dcshift.c +++ b/libavfilter/af_dcshift.c @@ -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) diff --git a/libavfilter/af_deesser.c b/libavfilter/af_deesser.c index e05ee9f10b..c1471123c5 100644 --- a/libavfilter/af_deesser.c +++ b/libavfilter/af_deesser.c @@ -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) diff --git a/libavfilter/af_drmeter.c b/libavfilter/af_drmeter.c index 58932fe6c5..722881dbc9 100644 --- a/libavfilter/af_drmeter.c +++ b/libavfilter/af_drmeter.c @@ -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) diff --git a/libavfilter/af_dynaudnorm.c b/libavfilter/af_dynaudnorm.c index 01c99788af..a6dbadbdd8 100644 --- a/libavfilter/af_dynaudnorm.c +++ b/libavfilter/af_dynaudnorm.c @@ -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) diff --git a/libavfilter/af_earwax.c b/libavfilter/af_earwax.c index a5a7e6a5d2..ddb85705ee 100644 --- a/libavfilter/af_earwax.c +++ b/libavfilter/af_earwax.c @@ -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; diff --git a/libavfilter/af_extrastereo.c b/libavfilter/af_extrastereo.c index 0555aa6610..6d4f307384 100644 --- a/libavfilter/af_extrastereo.c +++ b/libavfilter/af_extrastereo.c @@ -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) diff --git a/libavfilter/af_firequalizer.c b/libavfilter/af_firequalizer.c index 77de69e3ef..7e18db5517 100644 --- a/libavfilter/af_firequalizer.c +++ b/libavfilter/af_firequalizer.c @@ -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, diff --git a/libavfilter/af_flanger.c b/libavfilter/af_flanger.c index 6984ab12d3..38b1bb562f 100644 --- a/libavfilter/af_flanger.c +++ b/libavfilter/af_flanger.c @@ -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) diff --git a/libavfilter/af_haas.c b/libavfilter/af_haas.c index b1a207f808..b180d4c5b0 100644 --- a/libavfilter/af_haas.c +++ b/libavfilter/af_haas.c @@ -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) diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c index 144c0d31ed..3d180bbbda 100644 --- a/libavfilter/af_hdcd.c +++ b/libavfilter/af_hdcd.c @@ -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) diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c index 5e8fadb6cd..182f51c347 100644 --- a/libavfilter/af_headphone.c +++ b/libavfilter/af_headphone.c @@ -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) diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c index 6a4b449021..10bd3c1c01 100644 --- a/libavfilter/af_join.c +++ b/libavfilter/af_join.c @@ -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; diff --git a/libavfilter/af_ladspa.c b/libavfilter/af_ladspa.c index 4060251670..0c2bd5a54e 100644 --- a/libavfilter/af_ladspa.c +++ b/libavfilter/af_ladspa.c @@ -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) { diff --git a/libavfilter/af_loudnorm.c b/libavfilter/af_loudnorm.c index a07e8a3c93..f10429867f 100644 --- a/libavfilter/af_loudnorm.c +++ b/libavfilter/af_loudnorm.c @@ -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; diff --git a/libavfilter/af_lv2.c b/libavfilter/af_lv2.c index 28b729691d..83ff5e7861 100644 --- a/libavfilter/af_lv2.c +++ b/libavfilter/af_lv2.c @@ -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; } diff --git a/libavfilter/af_mcompand.c b/libavfilter/af_mcompand.c index 08d93f8c6a..9bce9ae7a1 100644 --- a/libavfilter/af_mcompand.c +++ b/libavfilter/af_mcompand.c @@ -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) diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c index 7ae18e9bfe..b699faf75b 100644 --- a/libavfilter/af_pan.c +++ b/libavfilter/af_pan.c @@ -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 diff --git a/libavfilter/af_rubberband.c b/libavfilter/af_rubberband.c index bfacbcd245..351104c768 100644 --- a/libavfilter/af_rubberband.c +++ b/libavfilter/af_rubberband.c @@ -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) diff --git a/libavfilter/af_sidechaincompress.c b/libavfilter/af_sidechaincompress.c index 71e27d4530..8e8547c3a4 100644 --- a/libavfilter/af_sidechaincompress.c +++ b/libavfilter/af_sidechaincompress.c @@ -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 diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index 53f54d1834..4342793216 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -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) diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c index 9d6d683688..953dbc526f 100644 --- a/libavfilter/af_silenceremove.c +++ b/libavfilter/af_silenceremove.c @@ -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) diff --git a/libavfilter/af_sofalizer.c b/libavfilter/af_sofalizer.c index 1bffd57de9..0412bc5dda 100644 --- a/libavfilter/af_sofalizer.c +++ b/libavfilter/af_sofalizer.c @@ -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, diff --git a/libavfilter/af_speechnorm.c b/libavfilter/af_speechnorm.c index d044177352..a5f704422c 100644 --- a/libavfilter/af_speechnorm.c +++ b/libavfilter/af_speechnorm.c @@ -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) diff --git a/libavfilter/af_stereotools.c b/libavfilter/af_stereotools.c index d60fa55ccd..043265f22c 100644 --- a/libavfilter/af_stereotools.c +++ b/libavfilter/af_stereotools.c @@ -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) diff --git a/libavfilter/af_stereowiden.c b/libavfilter/af_stereowiden.c index 1fbb635841..b004b24399 100644 --- a/libavfilter/af_stereowiden.c +++ b/libavfilter/af_stereowiden.c @@ -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) diff --git a/libavfilter/af_superequalizer.c b/libavfilter/af_superequalizer.c index aa8b6376b0..f48a38b148 100644 --- a/libavfilter/af_superequalizer.c +++ b/libavfilter/af_superequalizer.c @@ -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) diff --git a/libavfilter/af_surround.c b/libavfilter/af_surround.c index 3fb7a1bbba..fbb2f26891 100644 --- a/libavfilter/af_surround.c +++ b/libavfilter/af_surround.c @@ -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) diff --git a/libavfilter/af_tremolo.c b/libavfilter/af_tremolo.c index 8f9e310040..c3f8e5620b 100644 --- a/libavfilter/af_tremolo.c +++ b/libavfilter/af_tremolo.c @@ -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) diff --git a/libavfilter/af_vibrato.c b/libavfilter/af_vibrato.c index fe4d194531..8455074ef0 100644 --- a/libavfilter/af_vibrato.c +++ b/libavfilter/af_vibrato.c @@ -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) diff --git a/libavfilter/af_volume.c b/libavfilter/af_volume.c index 844ddbeff7..8feea25103 100644 --- a/libavfilter/af_volume.c +++ b/libavfilter/af_volume.c @@ -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, diff --git a/libavfilter/af_volumedetect.c b/libavfilter/af_volumedetect.c index 61af21797c..89e1b8584b 100644 --- a/libavfilter/af_volumedetect.c +++ b/libavfilter/af_volumedetect.c @@ -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) diff --git a/libavfilter/asrc_afirsrc.c b/libavfilter/asrc_afirsrc.c index 0ede722ba1..aba15dc5e2 100644 --- a/libavfilter/asrc_afirsrc.c +++ b/libavfilter/asrc_afirsrc.c @@ -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) diff --git a/libavfilter/asrc_anoisesrc.c b/libavfilter/asrc_anoisesrc.c index 0aab14b58f..c3e6252b3d 100644 --- a/libavfilter/asrc_anoisesrc.c +++ b/libavfilter/asrc_anoisesrc.c @@ -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) diff --git a/libavfilter/asrc_anullsrc.c b/libavfilter/asrc_anullsrc.c index 45d830e3a2..5d9b16dfce 100644 --- a/libavfilter/asrc_anullsrc.c +++ b/libavfilter/asrc_anullsrc.c @@ -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) diff --git a/libavfilter/asrc_hilbert.c b/libavfilter/asrc_hilbert.c index e7d596ee46..fe0c7c8659 100644 --- a/libavfilter/asrc_hilbert.c +++ b/libavfilter/asrc_hilbert.c @@ -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) diff --git a/libavfilter/asrc_sinc.c b/libavfilter/asrc_sinc.c index 5397d89c77..ca8991ac2c 100644 --- a/libavfilter/asrc_sinc.c +++ b/libavfilter/asrc_sinc.c @@ -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) diff --git a/libavfilter/asrc_sine.c b/libavfilter/asrc_sine.c index f75a5fc728..af0329e8c7 100644 --- a/libavfilter/asrc_sine.c +++ b/libavfilter/asrc_sine.c @@ -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) diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 5389d82d9f..148eeba91a 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -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) diff --git a/libavfilter/f_reverse.c b/libavfilter/f_reverse.c index 2a85e6966e..2b3ffd28de 100644 --- a/libavfilter/f_reverse.c +++ b/libavfilter/f_reverse.c @@ -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) diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c index f0468078e8..4a131f01c8 100644 --- a/libavfilter/f_select.c +++ b/libavfilter/f_select.c @@ -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); diff --git a/libavfilter/f_streamselect.c b/libavfilter/f_streamselect.c index 22eb76d4d7..05a8d5f49a 100644 --- a/libavfilter/f_streamselect.c +++ b/libavfilter/f_streamselect.c @@ -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; } } diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 6c05b118c9..507ab51217 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -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; } diff --git a/libavfilter/formats.h b/libavfilter/formats.h index 65acc939e3..ecbbf1ff8f 100644 --- a/libavfilter/formats.h +++ b/libavfilter/formats.h @@ -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); diff --git a/libavfilter/opencl.c b/libavfilter/opencl.c index 9c46cfdc09..f479182140 100644 --- a/libavfilter/opencl.c +++ b/libavfilter/opencl.c @@ -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, diff --git a/libavfilter/vf_amplify.c b/libavfilter/vf_amplify.c index e9e0a90b41..2640b61be8 100644 --- a/libavfilter/vf_amplify.c +++ b/libavfilter/vf_amplify.c @@ -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) diff --git a/libavfilter/vf_atadenoise.c b/libavfilter/vf_atadenoise.c index 6b2f4a4e50..ad99c7a797 100644 --- a/libavfilter/vf_atadenoise.c +++ b/libavfilter/vf_atadenoise.c @@ -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) diff --git a/libavfilter/vf_avgblur.c b/libavfilter/vf_avgblur.c index 361801e8fd..f6d36abb50 100644 --- a/libavfilter/vf_avgblur.c +++ b/libavfilter/vf_avgblur.c @@ -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) diff --git a/libavfilter/vf_bbox.c b/libavfilter/vf_bbox.c index 849e75646b..f6426a5135 100644 --- a/libavfilter/vf_bbox.c +++ b/libavfilter/vf_bbox.c @@ -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) \ diff --git a/libavfilter/vf_bilateral.c b/libavfilter/vf_bilateral.c index 7b9bd9737a..7a160798d4 100644 --- a/libavfilter/vf_bilateral.c +++ b/libavfilter/vf_bilateral.c @@ -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) diff --git a/libavfilter/vf_bitplanenoise.c b/libavfilter/vf_bitplanenoise.c index 284c2966cf..71b78f3ea1 100644 --- a/libavfilter/vf_bitplanenoise.c +++ b/libavfilter/vf_bitplanenoise.c @@ -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) diff --git a/libavfilter/vf_blackdetect.c b/libavfilter/vf_blackdetect.c index 9f6b293b54..e7fa5ce3ab 100644 --- a/libavfilter/vf_blackdetect.c +++ b/libavfilter/vf_blackdetect.c @@ -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) diff --git a/libavfilter/vf_blackframe.c b/libavfilter/vf_blackframe.c index b82c044f3e..8856542053 100644 --- a/libavfilter/vf_blackframe.c +++ b/libavfilter/vf_blackframe.c @@ -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) \ diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c index 0b33107b79..5eed52a5d8 100644 --- a/libavfilter/vf_blend.c +++ b/libavfilter/vf_blend.c @@ -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) diff --git a/libavfilter/vf_bm3d.c b/libavfilter/vf_bm3d.c index f719e79cb0..96bf8b671a 100644 --- a/libavfilter/vf_bm3d.c +++ b/libavfilter/vf_bm3d.c @@ -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) diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c index 228067c8e5..d63976b70b 100644 --- a/libavfilter/vf_bwdif.c +++ b/libavfilter/vf_bwdif.c @@ -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) diff --git a/libavfilter/vf_cas.c b/libavfilter/vf_cas.c index c5a53adfe9..4378ccd5eb 100644 --- a/libavfilter/vf_cas.c +++ b/libavfilter/vf_cas.c @@ -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) diff --git a/libavfilter/vf_chromakey.c b/libavfilter/vf_chromakey.c index 45d8e43c2c..61a1ab53f9 100644 --- a/libavfilter/vf_chromakey.c +++ b/libavfilter/vf_chromakey.c @@ -331,14 +331,11 @@ static av_cold int query_formats(AVFilterContext *avctx) AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, AV_PIX_FMT_NONE }; + const enum AVPixelFormat *pix_fmts; - AVFilterFormats *formats = NULL; + pix_fmts = !strcmp(avctx->filter->name, "chromahold") ? hold_pixel_fmts : pixel_fmts; - formats = ff_make_format_list(!strcmp(avctx->filter->name, "chromahold") ? hold_pixel_fmts : pixel_fmts); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(avctx, formats); + return ff_set_common_formats_from_list(avctx, pix_fmts); } static av_cold int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_chromanr.c b/libavfilter/vf_chromanr.c index 810fd2ce9d..006d6410b7 100644 --- a/libavfilter/vf_chromanr.c +++ b/libavfilter/vf_chromanr.c @@ -74,10 +74,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 SQR(x) ((x)*(x)) diff --git a/libavfilter/vf_chromashift.c b/libavfilter/vf_chromashift.c index 3f172a8e2b..8079196862 100644 --- a/libavfilter/vf_chromashift.c +++ b/libavfilter/vf_chromashift.c @@ -76,17 +76,13 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; const enum AVPixelFormat *pix_fmts; - AVFilterFormats *fmts_list; if (!strcmp(ctx->filter->name, "rgbashift")) pix_fmts = rgb_pix_fmts; else pix_fmts = yuv_pix_fmts; - 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 DEFINE_SMEAR(depth, type, div) \ diff --git a/libavfilter/vf_codecview.c b/libavfilter/vf_codecview.c index e3c613f10c..1b5c67e7d4 100644 --- a/libavfilter/vf_codecview.c +++ b/libavfilter/vf_codecview.c @@ -83,10 +83,7 @@ static int query_formats(AVFilterContext *ctx) // TODO: we can probably add way more pixel formats without any other // changes; anything with 8-bit luma in first plane should be working static const enum AVPixelFormat pix_fmts[] = {AV_PIX_FMT_YUV420P, 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 clip_line(int *sx, int *sy, int *ex, int *ey, int maxx) diff --git a/libavfilter/vf_colorbalance.c b/libavfilter/vf_colorbalance.c index 4e13ce97b9..1da1a643eb 100644 --- a/libavfilter/vf_colorbalance.c +++ b/libavfilter/vf_colorbalance.c @@ -92,10 +92,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, 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 float get_component(float v, float l, diff --git a/libavfilter/vf_colorchannelmixer.c b/libavfilter/vf_colorchannelmixer.c index 9a538ddf5f..e259fa3028 100644 --- a/libavfilter/vf_colorchannelmixer.c +++ b/libavfilter/vf_colorchannelmixer.c @@ -100,10 +100,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 float lerpf(float v0, float v1, float f) diff --git a/libavfilter/vf_colorconstancy.c b/libavfilter/vf_colorconstancy.c index e44d9afa01..0cef043bcd 100644 --- a/libavfilter/vf_colorconstancy.c +++ b/libavfilter/vf_colorconstancy.c @@ -643,7 +643,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_props(AVFilterLink *inlink) diff --git a/libavfilter/vf_colorcontrast.c b/libavfilter/vf_colorcontrast.c index b5b547b46f..8aae031745 100644 --- a/libavfilter/vf_colorcontrast.c +++ b/libavfilter/vf_colorcontrast.c @@ -327,13 +327,7 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - 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 config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_colorcorrect.c b/libavfilter/vf_colorcorrect.c index 13ef50ad1d..d4567d2a30 100644 --- a/libavfilter/vf_colorcorrect.c +++ b/libavfilter/vf_colorcorrect.c @@ -150,13 +150,7 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - 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 config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_colorize.c b/libavfilter/vf_colorize.c index 653832ab92..1dc99681ce 100644 --- a/libavfilter/vf_colorize.c +++ b/libavfilter/vf_colorize.c @@ -232,13 +232,7 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - 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 config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_colorkey.c b/libavfilter/vf_colorkey.c index e0b4372842..93e69b712c 100644 --- a/libavfilter/vf_colorkey.c +++ b/libavfilter/vf_colorkey.c @@ -171,13 +171,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 const AVFilterPad colorkey_inputs[] = { diff --git a/libavfilter/vf_colorlevels.c b/libavfilter/vf_colorlevels.c index 8bc0d96df0..b17bb9f11f 100644 --- a/libavfilter/vf_colorlevels.c +++ b/libavfilter/vf_colorlevels.c @@ -87,10 +87,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); } typedef struct ThreadData { diff --git a/libavfilter/vf_colormatrix.c b/libavfilter/vf_colormatrix.c index c304f2dba8..0686ca068b 100644 --- a/libavfilter/vf_colormatrix.c +++ b/libavfilter/vf_colormatrix.c @@ -413,10 +413,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_UYVY422, 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 filter_frame(AVFilterLink *link, AVFrame *in) diff --git a/libavfilter/vf_colortemperature.c b/libavfilter/vf_colortemperature.c index 1a4c9261f6..ad288e3b84 100644 --- a/libavfilter/vf_colortemperature.c +++ b/libavfilter/vf_colortemperature.c @@ -293,13 +293,7 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - 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 config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_convolution.c b/libavfilter/vf_convolution.c index c0fc7356bd..db92f5aa0b 100644 --- a/libavfilter/vf_convolution.c +++ b/libavfilter/vf_convolution.c @@ -100,7 +100,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); } typedef struct ThreadData { diff --git a/libavfilter/vf_convolve.c b/libavfilter/vf_convolve.c index a0066bbd39..fd0f3ca404 100644 --- a/libavfilter/vf_convolve.c +++ b/libavfilter/vf_convolve.c @@ -95,10 +95,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pixel_fmts_fftfilt); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pixel_fmts_fftfilt); } static int config_input_main(AVFilterLink *inlink) diff --git a/libavfilter/vf_cover_rect.c b/libavfilter/vf_cover_rect.c index 337778224d..a1502073fb 100644 --- a/libavfilter/vf_cover_rect.c +++ b/libavfilter/vf_cover_rect.c @@ -62,7 +62,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_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c index deeb9e480a..97c42a5c35 100644 --- a/libavfilter/vf_cropdetect.c +++ b/libavfilter/vf_cropdetect.c @@ -63,10 +63,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 checkline(void *ctx, const unsigned char *src, int stride, int len, int bpp) diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c index 64cfea1527..457fd77184 100644 --- a/libavfilter/vf_curves.c +++ b/libavfilter/vf_curves.c @@ -531,10 +531,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, 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 filter_slice_packed(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) diff --git a/libavfilter/vf_dblur.c b/libavfilter/vf_dblur.c index dcb6635c95..f3d0ab1141 100644 --- a/libavfilter/vf_dblur.c +++ b/libavfilter/vf_dblur.c @@ -136,7 +136,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_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_dctdnoiz.c b/libavfilter/vf_dctdnoiz.c index c7f949f9f5..8c0691c07f 100644 --- a/libavfilter/vf_dctdnoiz.c +++ b/libavfilter/vf_dctdnoiz.c @@ -661,10 +661,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP, 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); } typedef struct ThreadData { diff --git a/libavfilter/vf_deband.c b/libavfilter/vf_deband.c index aa560bd9fb..767f1c7687 100644 --- a/libavfilter/vf_deband.c +++ b/libavfilter/vf_deband.c @@ -108,11 +108,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(s->coupling ? cpix_fmts : pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, s->coupling ? cpix_fmts : pix_fmts); } static float frand(int x, int y) diff --git a/libavfilter/vf_deblock.c b/libavfilter/vf_deblock.c index 2d91fe358b..4069123baf 100644 --- a/libavfilter/vf_deblock.c +++ b/libavfilter/vf_deblock.c @@ -84,10 +84,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_GRAY16, 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); } #define WEAK_HFILTER(name, type, ldiv) \ diff --git a/libavfilter/vf_decimate.c b/libavfilter/vf_decimate.c index 72ed349427..9ef03ff1a3 100644 --- a/libavfilter/vf_decimate.c +++ b/libavfilter/vf_decimate.c @@ -365,10 +365,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY16, 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_output(AVFilterLink *outlink) diff --git a/libavfilter/vf_dedot.c b/libavfilter/vf_dedot.c index b79d4a51c4..8660eb08b4 100644 --- a/libavfilter/vf_dedot.c +++ b/libavfilter/vf_dedot.c @@ -75,10 +75,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, 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); } #define DEFINE_DEDOTCRAWL(name, type, div) \ diff --git a/libavfilter/vf_deflicker.c b/libavfilter/vf_deflicker.c index 1ce8a482e8..b3a301edaf 100644 --- a/libavfilter/vf_deflicker.c +++ b/libavfilter/vf_deflicker.c @@ -115,10 +115,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA420P16, 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 int deflicker8(AVFilterContext *ctx, diff --git a/libavfilter/vf_deinterlace_qsv.c b/libavfilter/vf_deinterlace_qsv.c index 3c2d87c7c8..06c4c5e2df 100644 --- a/libavfilter/vf_deinterlace_qsv.c +++ b/libavfilter/vf_deinterlace_qsv.c @@ -106,13 +106,8 @@ static int qsvdeint_query_formats(AVFilterContext *ctx) static const enum AVPixelFormat pixel_formats[] = { AV_PIX_FMT_QSV, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - int ret; - if ((ret = ff_set_common_formats(ctx, pix_fmts)) < 0) - return ret; - - return 0; + return ff_set_common_formats_from_list(ctx, pixel_formats); } static mfxStatus frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req, diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c index 9838301702..4d2966e249 100644 --- a/libavfilter/vf_delogo.c +++ b/libavfilter/vf_delogo.c @@ -234,10 +234,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P, AV_PIX_FMT_GRAY8, 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 int init(AVFilterContext *ctx) diff --git a/libavfilter/vf_derain.c b/libavfilter/vf_derain.c index 5037f3a5f7..a5c003ecdf 100644 --- a/libavfilter/vf_derain.c +++ b/libavfilter/vf_derain.c @@ -58,15 +58,12 @@ AVFILTER_DEFINE_CLASS(derain); static int query_formats(AVFilterContext *ctx) { - AVFilterFormats *formats; const enum AVPixelFormat pixel_fmts[] = { AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE }; - formats = ff_make_format_list(pixel_fmts); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c index 4ff6a94702..7794eecc8d 100644 --- a/libavfilter/vf_deshake.c +++ b/libavfilter/vf_deshake.c @@ -379,10 +379,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P, 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) diff --git a/libavfilter/vf_despill.c b/libavfilter/vf_despill.c index e0990d7443..315104638b 100644 --- a/libavfilter/vf_despill.c +++ b/libavfilter/vf_despill.c @@ -125,13 +125,8 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_BGRA, AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - 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 const AVFilterPad despill_inputs[] = { diff --git a/libavfilter/vf_displace.c b/libavfilter/vf_displace.c index 9c310e1740..fcdbadb1c1 100644 --- a/libavfilter/vf_displace.c +++ b/libavfilter/vf_displace.c @@ -78,7 +78,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY8, 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 void displace_planar(DisplaceContext *s, const AVFrame *in, diff --git a/libavfilter/vf_dnn_classify.c b/libavfilter/vf_dnn_classify.c index 7900255cfe..eb8758b265 100644 --- a/libavfilter/vf_dnn_classify.c +++ b/libavfilter/vf_dnn_classify.c @@ -207,8 +207,7 @@ static int dnn_classify_query_formats(AVFilterContext *context) AV_PIX_FMT_NV12, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - return ff_set_common_formats(context, fmts_list); + return ff_set_common_formats_from_list(context, pix_fmts); } static int dnn_classify_flush_frame(AVFilterLink *outlink, int64_t pts, int64_t *out_pts) diff --git a/libavfilter/vf_dnn_detect.c b/libavfilter/vf_dnn_detect.c index d23e30aedd..629743ae61 100644 --- a/libavfilter/vf_dnn_detect.c +++ b/libavfilter/vf_dnn_detect.c @@ -350,8 +350,7 @@ static int dnn_detect_query_formats(AVFilterContext *context) AV_PIX_FMT_NV12, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - return ff_set_common_formats(context, fmts_list); + return ff_set_common_formats_from_list(context, pix_fmts); } static int dnn_detect_filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/vf_dnn_processing.c b/libavfilter/vf_dnn_processing.c index e1d9d24683..8b7471c8cb 100644 --- a/libavfilter/vf_dnn_processing.c +++ b/libavfilter/vf_dnn_processing.c @@ -75,8 +75,7 @@ static int query_formats(AVFilterContext *context) AV_PIX_FMT_NV12, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); - return ff_set_common_formats(context, fmts_list); + return ff_set_common_formats_from_list(context, pix_fmts); } #define LOG_FORMAT_CHANNEL_MISMATCH() \ diff --git a/libavfilter/vf_drawbox.c b/libavfilter/vf_drawbox.c index 1e9e028650..373a6f45dd 100644 --- a/libavfilter/vf_drawbox.c +++ b/libavfilter/vf_drawbox.c @@ -193,10 +193,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P, 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) diff --git a/libavfilter/vf_edgedetect.c b/libavfilter/vf_edgedetect.c index e21d341fd2..e6111b4a27 100644 --- a/libavfilter/vf_edgedetect.c +++ b/libavfilter/vf_edgedetect.c @@ -101,7 +101,6 @@ static int query_formats(AVFilterContext *ctx) static const enum AVPixelFormat wires_pix_fmts[] = {AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE}; static const enum AVPixelFormat canny_pix_fmts[] = {AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_GBRP, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE}; static const enum AVPixelFormat colormix_pix_fmts[] = {AV_PIX_FMT_GBRP, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE}; - AVFilterFormats *fmts_list; const enum AVPixelFormat *pix_fmts = NULL; if (edgedetect->mode == MODE_WIRES) { @@ -113,10 +112,7 @@ static int query_formats(AVFilterContext *ctx) } else { av_assert0(0); } - 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 *inlink) diff --git a/libavfilter/vf_elbg.c b/libavfilter/vf_elbg.c index 008f470068..afaa6225d2 100644 --- a/libavfilter/vf_elbg.c +++ b/libavfilter/vf_elbg.c @@ -91,10 +91,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; if (!elbg->pal8) { - 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); } else { static const enum AVPixelFormat pal8_fmt[] = { AV_PIX_FMT_PAL8, diff --git a/libavfilter/vf_entropy.c b/libavfilter/vf_entropy.c index 32f4bac95d..73ece7cbb9 100644 --- a/libavfilter/vf_entropy.c +++ b/libavfilter/vf_entropy.c @@ -73,10 +73,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) diff --git a/libavfilter/vf_epx.c b/libavfilter/vf_epx.c index 676513c302..f33be65095 100644 --- a/libavfilter/vf_epx.c +++ b/libavfilter/vf_epx.c @@ -228,10 +228,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 filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c index 7d740d501a..e1953db891 100644 --- a/libavfilter/vf_eq.c +++ b/libavfilter/vf_eq.c @@ -243,10 +243,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pixel_fmts_eq); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pixel_fmts_eq); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/vf_estdif.c b/libavfilter/vf_estdif.c index 863d453775..92b1c77806 100644 --- a/libavfilter/vf_estdif.c +++ b/libavfilter/vf_estdif.c @@ -129,10 +129,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_output(AVFilterLink *outlink) diff --git a/libavfilter/vf_exposure.c b/libavfilter/vf_exposure.c index 5374a8396e..135a9a0e03 100644 --- a/libavfilter/vf_exposure.c +++ b/libavfilter/vf_exposure.c @@ -82,13 +82,7 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - 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 config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_fade.c b/libavfilter/vf_fade.c index 3c65b0f2ac..05ab762ec8 100644 --- a/libavfilter/vf_fade.c +++ b/libavfilter/vf_fade.c @@ -149,22 +149,20 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRAP, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list; + const enum AVPixelFormat *pixel_fmts; if (s->alpha) { if (s->black_fade) - fmts_list = ff_make_format_list(pix_fmts_alpha); + pixel_fmts = pix_fmts_alpha; else - fmts_list = ff_make_format_list(pix_fmts_rgba); + pixel_fmts = pix_fmts_rgba; } else { if (s->black_fade) - fmts_list = ff_make_format_list(pix_fmts); + pixel_fmts = pix_fmts; else - fmts_list = ff_make_format_list(pix_fmts_rgb); + pixel_fmts = pix_fmts_rgb; } - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } const static enum AVPixelFormat studio_level_pix_fmts[] = { diff --git a/libavfilter/vf_fftdnoiz.c b/libavfilter/vf_fftdnoiz.c index 78dde44e80..eeb3dd9572 100644 --- a/libavfilter/vf_fftdnoiz.c +++ b/libavfilter/vf_fftdnoiz.c @@ -135,10 +135,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 *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); } typedef struct ThreadData { diff --git a/libavfilter/vf_fftfilt.c b/libavfilter/vf_fftfilt.c index bcef9ff7d2..541e780ce1 100644 --- a/libavfilter/vf_fftfilt.c +++ b/libavfilter/vf_fftfilt.c @@ -404,10 +404,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pixel_fmts_fftfilt); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pixel_fmts_fftfilt); } static const AVFilterPad fftfilt_inputs[] = { diff --git a/libavfilter/vf_fillborders.c b/libavfilter/vf_fillborders.c index 2515bc9de9..8ceac44c76 100644 --- a/libavfilter/vf_fillborders.c +++ b/libavfilter/vf_fillborders.c @@ -78,10 +78,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_GRAY16, 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 void smear_borders8(FillBordersContext *s, AVFrame *frame) diff --git a/libavfilter/vf_find_rect.c b/libavfilter/vf_find_rect.c index 1a94655b6b..c0c210d9ef 100644 --- a/libavfilter/vf_find_rect.c +++ b/libavfilter/vf_find_rect.c @@ -67,7 +67,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 AVFrame *downscale(AVFrame *in) diff --git a/libavfilter/vf_floodfill.c b/libavfilter/vf_floodfill.c index 3b17b04c61..28045f1c2e 100644 --- a/libavfilter/vf_floodfill.c +++ b/libavfilter/vf_floodfill.c @@ -367,13 +367,8 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV444P12, AV_PIX_FMT_YUV444P14, AV_PIX_FMT_YUV444P16, AV_PIX_FMT_YUVA444P16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats; - 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 void uninit(AVFilterContext *ctx) diff --git a/libavfilter/vf_format.c b/libavfilter/vf_format.c index 960d4b0acf..6c5475b84a 100644 --- a/libavfilter/vf_format.c +++ b/libavfilter/vf_format.c @@ -129,12 +129,8 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { FormatContext *s = ctx->priv; - AVFilterFormats *formats = ff_make_format_list(s->formats); - if (!formats) - return AVERROR(ENOMEM); - - return ff_set_common_formats(ctx, formats); + return ff_set_common_formats_from_list(ctx, s->formats); } diff --git a/libavfilter/vf_framepack.c b/libavfilter/vf_framepack.c index 4fa9b4d144..2bf6ed538a 100644 --- a/libavfilter/vf_framepack.c +++ b/libavfilter/vf_framepack.c @@ -82,10 +82,7 @@ static const enum AVPixelFormat formats_supported[] = { static int query_formats(AVFilterContext *ctx) { // this will ensure that formats are the same on all pads - AVFilterFormats *fmts_list = ff_make_format_list(formats_supported); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, formats_supported); } static av_cold void framepack_uninit(AVFilterContext *ctx) diff --git a/libavfilter/vf_framerate.c b/libavfilter/vf_framerate.c index 6b509443a6..e8f6b5b8c5 100644 --- a/libavfilter/vf_framerate.c +++ b/libavfilter/vf_framerate.c @@ -231,10 +231,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 BLEND_FRAME_FUNC(nbits) \ diff --git a/libavfilter/vf_freezedetect.c b/libavfilter/vf_freezedetect.c index 9cf8fbab15..39d712d21e 100644 --- a/libavfilter/vf_freezedetect.c +++ b/libavfilter/vf_freezedetect.c @@ -90,10 +90,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) diff --git a/libavfilter/vf_fspp.c b/libavfilter/vf_fspp.c index 44d22fc1e4..88b13d638f 100644 --- a/libavfilter/vf_fspp.c +++ b/libavfilter/vf_fspp.c @@ -503,10 +503,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) diff --git a/libavfilter/vf_gblur.c b/libavfilter/vf_gblur.c index 3f61275658..1def5b049b 100644 --- a/libavfilter/vf_gblur.c +++ b/libavfilter/vf_gblur.c @@ -227,7 +227,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); } void ff_gblur_init(GBlurContext *s) diff --git a/libavfilter/vf_geq.c b/libavfilter/vf_geq.c index d9bb6ac256..4162476f41 100644 --- a/libavfilter/vf_geq.c +++ b/libavfilter/vf_geq.c @@ -335,15 +335,9 @@ static int geq_query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list; + const enum AVPixelFormat *pix_fmts = geq->is_rgb ? rgb_pix_fmts : yuv_pix_fmts; - if (geq->is_rgb) { - fmts_list = ff_make_format_list(rgb_pix_fmts); - } else - fmts_list = ff_make_format_list(yuv_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 geq_config_props(AVFilterLink *inlink) diff --git a/libavfilter/vf_gradfun.c b/libavfilter/vf_gradfun.c index af77b13d4d..f1cf9a3a06 100644 --- a/libavfilter/vf_gradfun.c +++ b/libavfilter/vf_gradfun.c @@ -155,10 +155,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP, 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) diff --git a/libavfilter/vf_guided.c b/libavfilter/vf_guided.c index 202a6a0586..3bdde30b58 100644 --- a/libavfilter/vf_guided.c +++ b/libavfilter/vf_guided.c @@ -150,7 +150,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_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_histeq.c b/libavfilter/vf_histeq.c index dea819e672..dc17afe30d 100644 --- a/libavfilter/vf_histeq.c +++ b/libavfilter/vf_histeq.c @@ -100,10 +100,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, 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) diff --git a/libavfilter/vf_hqdn3d.c b/libavfilter/vf_hqdn3d.c index bd3eb2d01c..99c43593cd 100644 --- a/libavfilter/vf_hqdn3d.c +++ b/libavfilter/vf_hqdn3d.c @@ -244,10 +244,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16, 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 void calc_coefs(AVFilterContext *ctx) diff --git a/libavfilter/vf_hqx.c b/libavfilter/vf_hqx.c index 8b0d794b6e..b6c3893b66 100644 --- a/libavfilter/vf_hqx.c +++ b/libavfilter/vf_hqx.c @@ -464,10 +464,7 @@ HQX_FUNC(4) static int query_formats(AVFilterContext *ctx) { static const enum AVPixelFormat pix_fmts[] = {AV_PIX_FMT_RGB32, 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_output(AVFilterLink *outlink) diff --git a/libavfilter/vf_hue.c b/libavfilter/vf_hue.c index 3d250dbe25..3df27d985c 100644 --- a/libavfilter/vf_hue.c +++ b/libavfilter/vf_hue.c @@ -263,10 +263,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P10, 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 *inlink) diff --git a/libavfilter/vf_hysteresis.c b/libavfilter/vf_hysteresis.c index 3732ed5c22..12025f9eb6 100644 --- a/libavfilter/vf_hysteresis.c +++ b/libavfilter/vf_hysteresis.c @@ -81,7 +81,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 process_frame(FFFrameSync *fs) diff --git a/libavfilter/vf_identity.c b/libavfilter/vf_identity.c index f47611924e..f5dcdfc906 100644 --- a/libavfilter/vf_identity.c +++ b/libavfilter/vf_identity.c @@ -257,10 +257,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_ref(AVFilterLink *inlink) diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c index 54fc08e915..36ec73df46 100644 --- a/libavfilter/vf_idet.c +++ b/libavfilter/vf_idet.c @@ -395,10 +395,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA444P, 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 int init(AVFilterContext *ctx) diff --git a/libavfilter/vf_kerndeint.c b/libavfilter/vf_kerndeint.c index a86407beb0..04c04b7e13 100644 --- a/libavfilter/vf_kerndeint.c +++ b/libavfilter/vf_kerndeint.c @@ -78,10 +78,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 *inlink) diff --git a/libavfilter/vf_lagfun.c b/libavfilter/vf_lagfun.c index e147479671..0f4f38e0ed 100644 --- a/libavfilter/vf_lagfun.c +++ b/libavfilter/vf_lagfun.c @@ -67,10 +67,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16, 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); } typedef struct ThreadData { diff --git a/libavfilter/vf_lenscorrection.c b/libavfilter/vf_lenscorrection.c index 7bd008d3d8..9d89f79101 100644 --- a/libavfilter/vf_lenscorrection.c +++ b/libavfilter/vf_lenscorrection.c @@ -203,10 +203,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 *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) diff --git a/libavfilter/vf_lensfun.c b/libavfilter/vf_lensfun.c index f34add961a..ffe81b9bc2 100644 --- a/libavfilter/vf_lensfun.c +++ b/libavfilter/vf_lensfun.c @@ -197,8 +197,7 @@ static int query_formats(AVFilterContext *ctx) { // Some of the functions provided by lensfun require pixels in RGB format static const enum AVPixelFormat fmts[] = {AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE}; - AVFilterFormats *fmts_list = ff_make_format_list(fmts); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, fmts); } static float lanczos_kernel(float x) diff --git a/libavfilter/vf_libopencv.c b/libavfilter/vf_libopencv.c index 221a8ac4c2..8c65007044 100644 --- a/libavfilter/vf_libopencv.c +++ b/libavfilter/vf_libopencv.c @@ -69,10 +69,7 @@ static int query_formats(AVFilterContext *ctx) static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_BGR24, AV_PIX_FMT_BGRA, AV_PIX_FMT_GRAY8, 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); } typedef struct OCVContext { diff --git a/libavfilter/vf_libvmaf.c b/libavfilter/vf_libvmaf.c index d2621c7a9f..fc8a0183be 100644 --- a/libavfilter/vf_libvmaf.c +++ b/libavfilter/vf_libvmaf.c @@ -256,10 +256,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); } diff --git a/libavfilter/vf_limiter.c b/libavfilter/vf_limiter.c index 04bfbb63d1..3bf1b371cf 100644 --- a/libavfilter/vf_limiter.c +++ b/libavfilter/vf_limiter.c @@ -90,10 +90,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 void limiter8(const uint8_t *src, uint8_t *dst, diff --git a/libavfilter/vf_lumakey.c b/libavfilter/vf_lumakey.c index 3f98d5077d..8b2a102369 100644 --- a/libavfilter/vf_lumakey.c +++ b/libavfilter/vf_lumakey.c @@ -154,13 +154,8 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA444P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_NONE }; - AVFilterFormats *formats; - 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 int process_command(AVFilterContext *ctx, const char *cmd, const char *args, diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c index 47c2416da7..78f0955446 100644 --- a/libavfilter/vf_lut.c +++ b/libavfilter/vf_lut.c @@ -150,10 +150,7 @@ static int query_formats(AVFilterContext *ctx) const enum AVPixelFormat *pix_fmts = s->is_rgb ? rgb_pix_fmts : s->is_yuv ? yuv_pix_fmts : all_pix_fmts; - 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); } /** diff --git a/libavfilter/vf_lut2.c b/libavfilter/vf_lut2.c index 658a0bfa56..85669a2e2d 100644 --- a/libavfilter/vf_lut2.c +++ b/libavfilter/vf_lut2.c @@ -176,7 +176,7 @@ static int query_formats(AVFilterContext *ctx) int ret; if (s->tlut2 || !s->odepth) - return ff_set_common_formats(ctx, ff_make_format_list(all_pix_fmts)); + return ff_set_common_formats_from_list(ctx, all_pix_fmts); ret = ff_formats_ref(ff_make_format_list(all_pix_fmts), &ctx->inputs[0]->outcfg.formats); if (ret < 0) diff --git a/libavfilter/vf_lut3d.c b/libavfilter/vf_lut3d.c index c86585cf09..b81ef46b48 100644 --- a/libavfilter/vf_lut3d.c +++ b/libavfilter/vf_lut3d.c @@ -1166,10 +1166,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRPF32, AV_PIX_FMT_GBRAPF32, 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) diff --git a/libavfilter/vf_maskedclamp.c b/libavfilter/vf_maskedclamp.c index 050e3ae6e4..2cd1ec88c7 100644 --- a/libavfilter/vf_maskedclamp.c +++ b/libavfilter/vf_maskedclamp.c @@ -84,7 +84,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 maskedclamp_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) diff --git a/libavfilter/vf_maskedmerge.c b/libavfilter/vf_maskedmerge.c index 28ac0dd52d..6a15a907c5 100644 --- a/libavfilter/vf_maskedmerge.c +++ b/libavfilter/vf_maskedmerge.c @@ -61,7 +61,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); } typedef struct ThreadData { diff --git a/libavfilter/vf_maskedminmax.c b/libavfilter/vf_maskedminmax.c index 0d79fc177f..6ad5ddb1de 100644 --- a/libavfilter/vf_maskedminmax.c +++ b/libavfilter/vf_maskedminmax.c @@ -87,7 +87,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 void maskedmin8(const uint8_t *src, uint8_t *dst, const uint8_t *f1, const uint8_t *f2, int w) diff --git a/libavfilter/vf_maskedthreshold.c b/libavfilter/vf_maskedthreshold.c index 518ab54546..e80d383f9d 100644 --- a/libavfilter/vf_maskedthreshold.c +++ b/libavfilter/vf_maskedthreshold.c @@ -79,7 +79,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 void threshold8(const uint8_t *src, const uint8_t *ref, uint8_t *dst, int threshold, int w) diff --git a/libavfilter/vf_maskfun.c b/libavfilter/vf_maskfun.c index 0f3e3545b3..70198c66bc 100644 --- a/libavfilter/vf_maskfun.c +++ b/libavfilter/vf_maskfun.c @@ -83,7 +83,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 *frame) diff --git a/libavfilter/vf_mcdeint.c b/libavfilter/vf_mcdeint.c index 1a49829d5b..034e72a487 100644 --- a/libavfilter/vf_mcdeint.c +++ b/libavfilter/vf_mcdeint.c @@ -167,10 +167,7 @@ static int query_formats(AVFilterContext *ctx) static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUV420P, 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 filter_frame(AVFilterLink *inlink, AVFrame *inpic) diff --git a/libavfilter/vf_median.c b/libavfilter/vf_median.c index 1e66ab87ff..e02629a5ca 100644 --- a/libavfilter/vf_median.c +++ b/libavfilter/vf_median.c @@ -107,7 +107,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 void check_params(MedianContext *s, AVFilterLink *inlink) diff --git a/libavfilter/vf_mestimate.c b/libavfilter/vf_mestimate.c index f57f2578ec..1b65c738d5 100644 --- a/libavfilter/vf_mestimate.c +++ b/libavfilter/vf_mestimate.c @@ -81,10 +81,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) diff --git a/libavfilter/vf_midequalizer.c b/libavfilter/vf_midequalizer.c index ba50fa0a82..ec1ffe5539 100644 --- a/libavfilter/vf_midequalizer.c +++ b/libavfilter/vf_midequalizer.c @@ -83,7 +83,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 process_frame(FFFrameSync *fs) diff --git a/libavfilter/vf_minterpolate.c b/libavfilter/vf_minterpolate.c index c6aed7755f..4b58eb00d8 100644 --- a/libavfilter/vf_minterpolate.c +++ b/libavfilter/vf_minterpolate.c @@ -249,10 +249,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 uint64_t get_sbad(AVMotionEstContext *me_ctx, int x, int y, int x_mv, int y_mv) diff --git a/libavfilter/vf_monochrome.c b/libavfilter/vf_monochrome.c index 29e70f8c25..870811d4d4 100644 --- a/libavfilter/vf_monochrome.c +++ b/libavfilter/vf_monochrome.c @@ -245,13 +245,7 @@ static av_cold int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *formats = NULL; - - 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 config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_mpdecimate.c b/libavfilter/vf_mpdecimate.c index 53f5a56ef4..301475906e 100644 --- a/libavfilter/vf_mpdecimate.c +++ b/libavfilter/vf_mpdecimate.c @@ -178,10 +178,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) diff --git a/libavfilter/vf_neighbor.c b/libavfilter/vf_neighbor.c index a2e9a51165..ea6449830c 100644 --- a/libavfilter/vf_neighbor.c +++ b/libavfilter/vf_neighbor.c @@ -73,7 +73,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 void erosion(uint8_t *dst, const uint8_t *p1, int width, diff --git a/libavfilter/vf_nlmeans.c b/libavfilter/vf_nlmeans.c index 7451bec4ae..95cdad780e 100644 --- a/libavfilter/vf_nlmeans.c +++ b/libavfilter/vf_nlmeans.c @@ -90,10 +90,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); } /** diff --git a/libavfilter/vf_nnedi.c b/libavfilter/vf_nnedi.c index b802ca5433..cffb23d37c 100644 --- a/libavfilter/vf_nnedi.c +++ b/libavfilter/vf_nnedi.c @@ -205,10 +205,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 float dot_dsp(const NNEDIContext *const s, const float *kernel, const float *input, diff --git a/libavfilter/vf_normalize.c b/libavfilter/vf_normalize.c index 3a2127ade3..a9474056af 100644 --- a/libavfilter/vf_normalize.c +++ b/libavfilter/vf_normalize.c @@ -411,10 +411,7 @@ static int query_formats(AVFilterContext *ctx) // According to filter_design.txt, using ff_set_common_formats() this way // ensures the pixel formats of the input and output will be the same. That // saves a bit of effort possibly needing to handle format conversions. - 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); } // At this point we know the pixel format used for both input and output. We diff --git a/libavfilter/vf_ocr.c b/libavfilter/vf_ocr.c index 6de474025a..d33e7222ef 100644 --- a/libavfilter/vf_ocr.c +++ b/libavfilter/vf_ocr.c @@ -87,10 +87,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 filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c index 9155de3736..8fec1f554c 100644 --- a/libavfilter/vf_overlay.c +++ b/libavfilter/vf_overlay.c @@ -255,7 +255,7 @@ static int query_formats(AVFilterContext *ctx) overlay_formats = overlay_pix_fmts_gbrp; break; case OVERLAY_FORMAT_AUTO: - return ff_set_common_formats(ctx, ff_make_format_list(alpha_pix_fmts)); + return ff_set_common_formats_from_list(ctx, alpha_pix_fmts); default: av_assert0(0); } diff --git a/libavfilter/vf_overlay_cuda.c b/libavfilter/vf_overlay_cuda.c index 37af4e2fa0..5bab678b0f 100644 --- a/libavfilter/vf_overlay_cuda.c +++ b/libavfilter/vf_overlay_cuda.c @@ -423,9 +423,7 @@ static int overlay_cuda_query_formats(AVFilterContext *avctx) AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - - return ff_set_common_formats(avctx, pix_fmts); + return ff_set_common_formats_from_list(avctx, pixel_formats); } /** diff --git a/libavfilter/vf_owdenoise.c b/libavfilter/vf_owdenoise.c index f16a06e3b8..6a832b8f3c 100644 --- a/libavfilter/vf_owdenoise.c +++ b/libavfilter/vf_owdenoise.c @@ -309,10 +309,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16, 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) diff --git a/libavfilter/vf_perspective.c b/libavfilter/vf_perspective.c index a3fa080f21..eb8e5e2414 100644 --- a/libavfilter/vf_perspective.c +++ b/libavfilter/vf_perspective.c @@ -103,10 +103,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP, AV_PIX_FMT_GRAY8, 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 inline double get_coeff(double d) diff --git a/libavfilter/vf_phase.c b/libavfilter/vf_phase.c index 556620d36c..3262454348 100644 --- a/libavfilter/vf_phase.c +++ b/libavfilter/vf_phase.c @@ -125,10 +125,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) diff --git a/libavfilter/vf_photosensitivity.c b/libavfilter/vf_photosensitivity.c index dd3d957bfa..c28d06b08a 100644 --- a/libavfilter/vf_photosensitivity.c +++ b/libavfilter/vf_photosensitivity.c @@ -77,10 +77,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_BGR24, 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); } typedef struct ThreadData_convert_frame diff --git a/libavfilter/vf_pp.c b/libavfilter/vf_pp.c index 5cd89932f8..3fb1333bd6 100644 --- a/libavfilter/vf_pp.c +++ b/libavfilter/vf_pp.c @@ -88,10 +88,7 @@ static int pp_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 pp_config_props(AVFilterLink *inlink) diff --git a/libavfilter/vf_pp7.c b/libavfilter/vf_pp7.c index a9a2fa3d19..d632d9bea8 100644 --- a/libavfilter/vf_pp7.c +++ b/libavfilter/vf_pp7.c @@ -276,10 +276,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY8, 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) diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c index b5d0ca6d67..1dde273eae 100644 --- a/libavfilter/vf_premultiply.c +++ b/libavfilter/vf_premultiply.c @@ -86,7 +86,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - return ff_set_common_formats(ctx, ff_make_format_list(s->inplace ? alpha_pix_fmts : no_alpha_pix_fmts)); + return ff_set_common_formats_from_list(ctx, s->inplace ? alpha_pix_fmts : no_alpha_pix_fmts); } static void premultiply8(const uint8_t *msrc, const uint8_t *asrc, diff --git a/libavfilter/vf_pseudocolor.c b/libavfilter/vf_pseudocolor.c index ec14a0c363..35b9a10519 100644 --- a/libavfilter/vf_pseudocolor.c +++ b/libavfilter/vf_pseudocolor.c @@ -281,10 +281,7 @@ static const enum AVPixelFormat pix_fmts[] = { static int query_formats(AVFilterContext *ctx) { - 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 inline float lerpf(float v0, float v1, float f) diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c index e5459d3f34..715230142b 100644 --- a/libavfilter/vf_psnr.c +++ b/libavfilter/vf_psnr.c @@ -312,10 +312,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_ref(AVFilterLink *inlink) diff --git a/libavfilter/vf_pullup.c b/libavfilter/vf_pullup.c index 00d3a8dc51..8be10b4fa4 100644 --- a/libavfilter/vf_pullup.c +++ b/libavfilter/vf_pullup.c @@ -64,10 +64,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 ABS(a) (((a) ^ ((a) >> 31)) - ((a) >> 31)) diff --git a/libavfilter/vf_readeia608.c b/libavfilter/vf_readeia608.c index 9558e938ab..fe4a8c4648 100644 --- a/libavfilter/vf_readeia608.c +++ b/libavfilter/vf_readeia608.c @@ -125,10 +125,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA420P16, 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 int config_filter(AVFilterContext *ctx, int start, int end) diff --git a/libavfilter/vf_readvitc.c b/libavfilter/vf_readvitc.c index 25cfa5f32d..8dde55b7da 100644 --- a/libavfilter/vf_readvitc.c +++ b/libavfilter/vf_readvitc.c @@ -207,10 +207,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pixel_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static int filter_frame(AVFilterLink *inlink, AVFrame *frame) diff --git a/libavfilter/vf_removegrain.c b/libavfilter/vf_removegrain.c index 75b3ec35bb..2fde9a954c 100644 --- a/libavfilter/vf_removegrain.c +++ b/libavfilter/vf_removegrain.c @@ -57,10 +57,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 REMOVE_GRAIN_SORT_AXIS \ diff --git a/libavfilter/vf_removelogo.c b/libavfilter/vf_removelogo.c index 4bb81a8a5b..92eeb2e5f5 100644 --- a/libavfilter/vf_removelogo.c +++ b/libavfilter/vf_removelogo.c @@ -206,10 +206,7 @@ static void convert_mask_to_strength_mask(uint8_t *data, int linesize, static int query_formats(AVFilterContext *ctx) { static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUV420P, 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 load_mask(uint8_t **mask, int *w, int *h, diff --git a/libavfilter/vf_repeatfields.c b/libavfilter/vf_repeatfields.c index 1e2abd3a82..75f2fdbfb2 100644 --- a/libavfilter/vf_repeatfields.c +++ b/libavfilter/vf_repeatfields.c @@ -50,10 +50,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(pixel_fmts_eq); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pixel_fmts_eq); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_rotate.c b/libavfilter/vf_rotate.c index f16207cbff..654a7171a9 100644 --- a/libavfilter/vf_rotate.c +++ b/libavfilter/vf_rotate.c @@ -157,10 +157,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 double get_rotated_w(void *opaque, double angle) diff --git a/libavfilter/vf_sab.c b/libavfilter/vf_sab.c index 12fbe40655..b4f8f128b7 100644 --- a/libavfilter/vf_sab.c +++ b/libavfilter/vf_sab.c @@ -65,10 +65,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV411P, 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 RADIUS_MIN 0.1 diff --git a/libavfilter/vf_scale_cuda.c b/libavfilter/vf_scale_cuda.c index f3ea01634b..ecb3d62256 100644 --- a/libavfilter/vf_scale_cuda.c +++ b/libavfilter/vf_scale_cuda.c @@ -150,11 +150,8 @@ static int cudascale_query_formats(AVFilterContext *ctx) static const enum AVPixelFormat pixel_formats[] = { AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - if (!pix_fmts) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, pix_fmts); + return ff_set_common_formats_from_list(ctx, pixel_formats); } static av_cold int init_hwframe_ctx(CUDAScaleContext *s, AVBufferRef *device_ctx, int width, int height) diff --git a/libavfilter/vf_scale_npp.c b/libavfilter/vf_scale_npp.c index 8d2ad3aab7..3f5538ad3f 100644 --- a/libavfilter/vf_scale_npp.c +++ b/libavfilter/vf_scale_npp.c @@ -148,9 +148,7 @@ static int nppscale_query_formats(AVFilterContext *ctx) static const enum AVPixelFormat pixel_formats[] = { AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - - return ff_set_common_formats(ctx, pix_fmts); + return ff_set_common_formats_from_list(ctx, pixel_formats); } static int init_stage(NPPScaleStageContext *stage, AVBufferRef *device_ctx) diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index 189223a58a..2f3afa6ace 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -160,13 +160,8 @@ static int qsvscale_query_formats(AVFilterContext *ctx) static const enum AVPixelFormat pixel_formats[] = { AV_PIX_FMT_QSV, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - int ret; - if ((ret = ff_set_common_formats(ctx, pix_fmts)) < 0) - return ret; - - return 0; + return ff_set_common_formats_from_list(ctx, pixel_formats); } static int init_out_pool(AVFilterContext *ctx, diff --git a/libavfilter/vf_scdet.c b/libavfilter/vf_scdet.c index ff8bf21a9c..b9ea30d47a 100644 --- a/libavfilter/vf_scdet.c +++ b/libavfilter/vf_scdet.c @@ -74,10 +74,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) diff --git a/libavfilter/vf_scroll.c b/libavfilter/vf_scroll.c index 4b7b45f52a..77d8db51bc 100644 --- a/libavfilter/vf_scroll.c +++ b/libavfilter/vf_scroll.c @@ -66,10 +66,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); } typedef struct ThreadData { diff --git a/libavfilter/vf_selectivecolor.c b/libavfilter/vf_selectivecolor.c index 4733cc48f2..af6e8b2518 100644 --- a/libavfilter/vf_selectivecolor.c +++ b/libavfilter/vf_selectivecolor.c @@ -297,10 +297,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_RGBA64, AV_PIX_FMT_BGRA64, 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 inline int comp_adjust(int scale, float value, float adjust, float k, int correction_method) diff --git a/libavfilter/vf_shear.c b/libavfilter/vf_shear.c index 6b9db161d9..849592ccde 100644 --- a/libavfilter/vf_shear.c +++ b/libavfilter/vf_shear.c @@ -114,10 +114,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 NN(type, name) \ diff --git a/libavfilter/vf_shufflepixels.c b/libavfilter/vf_shufflepixels.c index b5e757c929..051be44bf3 100644 --- a/libavfilter/vf_shufflepixels.c +++ b/libavfilter/vf_shufflepixels.c @@ -68,10 +68,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV444P12, AV_PIX_FMT_YUV444P14, AV_PIX_FMT_YUV444P16, AV_PIX_FMT_YUVA444P16, 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 void make_horizontal_map(AVFilterContext *ctx) diff --git a/libavfilter/vf_signalstats.c b/libavfilter/vf_signalstats.c index 6f0ff53029..49a2996b5c 100644 --- a/libavfilter/vf_signalstats.c +++ b/libavfilter/vf_signalstats.c @@ -134,10 +134,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 AVFrame *alloc_frame(enum AVPixelFormat pixfmt, int w, int h) diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c index a345ad6ebd..69930e9f02 100644 --- a/libavfilter/vf_signature.c +++ b/libavfilter/vf_signature.c @@ -84,7 +84,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_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_smartblur.c b/libavfilter/vf_smartblur.c index 36ed72a12c..1820bbb265 100644 --- a/libavfilter/vf_smartblur.c +++ b/libavfilter/vf_smartblur.c @@ -124,10 +124,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 alloc_sws_context(FilterParam *f, int width, int height, unsigned int flags) diff --git a/libavfilter/vf_spp.c b/libavfilter/vf_spp.c index cfa1cb77c4..51f3670f4a 100644 --- a/libavfilter/vf_spp.c +++ b/libavfilter/vf_spp.c @@ -328,10 +328,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) diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c index f930b38748..4373f749d3 100644 --- a/libavfilter/vf_sr.c +++ b/libavfilter/vf_sr.c @@ -71,15 +71,8 @@ static int query_formats(AVFilterContext *context) const enum AVPixelFormat pixel_formats[] = {AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE}; - AVFilterFormats *formats_list; - formats_list = ff_make_format_list(pixel_formats); - if (!formats_list){ - av_log(context, AV_LOG_ERROR, "could not create formats list\n"); - return AVERROR(ENOMEM); - } - - return ff_set_common_formats(context, formats_list); + return ff_set_common_formats_from_list(context, pixel_formats); } static int config_output(AVFilterLink *outlink) diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c index c6e4fe286a..618b24c010 100644 --- a/libavfilter/vf_ssim.c +++ b/libavfilter/vf_ssim.c @@ -434,10 +434,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_ref(AVFilterLink *inlink) diff --git a/libavfilter/vf_stereo3d.c b/libavfilter/vf_stereo3d.c index ec7d410f76..099dd5724b 100644 --- a/libavfilter/vf_stereo3d.c +++ b/libavfilter/vf_stereo3d.c @@ -283,7 +283,6 @@ static int query_formats(AVFilterContext *ctx) { Stereo3DContext *s = ctx->priv; const enum AVPixelFormat *pix_fmts; - AVFilterFormats *fmts_list; switch (s->out.format) { case ANAGLYPH_GM_COLOR: @@ -306,10 +305,7 @@ static int query_formats(AVFilterContext *ctx) pix_fmts = other_pix_fmts; } - 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 inline uint8_t ana_convert(const int *coeff, const uint8_t *left, const uint8_t *right) diff --git a/libavfilter/vf_super2xsai.c b/libavfilter/vf_super2xsai.c index 00e88eafe3..d6371644e6 100644 --- a/libavfilter/vf_super2xsai.c +++ b/libavfilter/vf_super2xsai.c @@ -255,10 +255,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) diff --git a/libavfilter/vf_threshold.c b/libavfilter/vf_threshold.c index 0c8787e331..17ceb0dfa8 100644 --- a/libavfilter/vf_threshold.c +++ b/libavfilter/vf_threshold.c @@ -67,7 +67,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); } typedef struct ThreadData { diff --git a/libavfilter/vf_thumbnail.c b/libavfilter/vf_thumbnail.c index 825e536e67..d81702b323 100644 --- a/libavfilter/vf_thumbnail.c +++ b/libavfilter/vf_thumbnail.c @@ -262,10 +262,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP, 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 const AVFilterPad thumbnail_inputs[] = { diff --git a/libavfilter/vf_thumbnail_cuda.c b/libavfilter/vf_thumbnail_cuda.c index ceac10f72f..d92c613d91 100644 --- a/libavfilter/vf_thumbnail_cuda.c +++ b/libavfilter/vf_thumbnail_cuda.c @@ -418,10 +418,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_CUDA, 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 const AVFilterPad thumbnail_cuda_inputs[] = { diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c index 40d8879871..6ab43b527d 100644 --- a/libavfilter/vf_tinterlace.c +++ b/libavfilter/vf_tinterlace.c @@ -103,10 +103,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 void lowpass_line_c(uint8_t *dstp, ptrdiff_t width, const uint8_t *srcp, diff --git a/libavfilter/vf_tmidequalizer.c b/libavfilter/vf_tmidequalizer.c index 24e1d557e2..3516592ee4 100644 --- a/libavfilter/vf_tmidequalizer.c +++ b/libavfilter/vf_tmidequalizer.c @@ -93,7 +93,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 void compute_contrast_function(const float *const histograms[256], diff --git a/libavfilter/vf_tonemap.c b/libavfilter/vf_tonemap.c index 4d04118eac..da6b4e235d 100644 --- a/libavfilter/vf_tonemap.c +++ b/libavfilter/vf_tonemap.c @@ -79,7 +79,7 @@ static const enum AVPixelFormat pix_fmts[] = { static int query_formats(AVFilterContext *ctx) { - return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static av_cold int init(AVFilterContext *ctx) diff --git a/libavfilter/vf_transpose_npp.c b/libavfilter/vf_transpose_npp.c index 2a68a832ff..5c8226b71b 100644 --- a/libavfilter/vf_transpose_npp.c +++ b/libavfilter/vf_transpose_npp.c @@ -117,8 +117,7 @@ static int npptranspose_query_formats(AVFilterContext *ctx) AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - return ff_set_common_formats(ctx, pix_fmts); + return ff_set_common_formats_from_list(ctx, pixel_fmts); } static int init_stage(NPPTransposeStageContext *stage, AVBufferRef *device_ctx) diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c index 0bf72169a9..e9f75a673f 100644 --- a/libavfilter/vf_unsharp.c +++ b/libavfilter/vf_unsharp.c @@ -208,10 +208,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P, 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 init_filter_param(AVFilterContext *ctx, UnsharpFilterParam *fp, const char *effect_type, int width) diff --git a/libavfilter/vf_uspp.c b/libavfilter/vf_uspp.c index 7029963e29..0ed9abe92c 100644 --- a/libavfilter/vf_uspp.c +++ b/libavfilter/vf_uspp.c @@ -305,10 +305,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) diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c index 692fa43c4d..d4bd5756da 100644 --- a/libavfilter/vf_v360.c +++ b/libavfilter/vf_v360.c @@ -247,10 +247,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list = ff_make_format_list(s->alpha ? alpha_pix_fmts : pix_fmts); - if (!fmts_list) - return AVERROR(ENOMEM); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, s->alpha ? alpha_pix_fmts : pix_fmts); } #define DEFINE_REMAP1_LINE(bits, div) \ diff --git a/libavfilter/vf_vaguedenoiser.c b/libavfilter/vf_vaguedenoiser.c index 481fc774e5..b3a800e360 100644 --- a/libavfilter/vf_vaguedenoiser.c +++ b/libavfilter/vf_vaguedenoiser.c @@ -132,10 +132,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 *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) diff --git a/libavfilter/vf_vibrance.c b/libavfilter/vf_vibrance.c index cca677ee78..abbc25436f 100644 --- a/libavfilter/vf_vibrance.c +++ b/libavfilter/vf_vibrance.c @@ -309,13 +309,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) diff --git a/libavfilter/vf_vidstabdetect.c b/libavfilter/vf_vidstabdetect.c index 475d0381bc..cde6a5e709 100644 --- a/libavfilter/vf_vidstabdetect.c +++ b/libavfilter/vf_vidstabdetect.c @@ -93,10 +93,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) diff --git a/libavfilter/vf_vidstabtransform.c b/libavfilter/vf_vidstabtransform.c index 79e62c1f58..342da0b26b 100644 --- a/libavfilter/vf_vidstabtransform.c +++ b/libavfilter/vf_vidstabtransform.c @@ -132,10 +132,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); } diff --git a/libavfilter/vf_vif.c b/libavfilter/vf_vif.c index c21bd40f44..4d2381abcb 100644 --- a/libavfilter/vf_vif.c +++ b/libavfilter/vf_vif.c @@ -483,10 +483,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_ref(AVFilterLink *inlink) diff --git a/libavfilter/vf_vignette.c b/libavfilter/vf_vignette.c index 91754306ae..ef67deb278 100644 --- a/libavfilter/vf_vignette.c +++ b/libavfilter/vf_vignette.c @@ -135,10 +135,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY8, 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 double get_natural_factor(const VignetteContext *s, int x, int y) diff --git a/libavfilter/vf_w3fdif.c b/libavfilter/vf_w3fdif.c index 5edb826f0a..e8e55d5be3 100644 --- a/libavfilter/vf_w3fdif.c +++ b/libavfilter/vf_w3fdif.c @@ -101,10 +101,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 void filter_simple_low(int32_t *work_line, diff --git a/libavfilter/vf_xbr.c b/libavfilter/vf_xbr.c index 1300693bac..28642fa323 100644 --- a/libavfilter/vf_xbr.c +++ b/libavfilter/vf_xbr.c @@ -346,10 +346,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_0RGB32, 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 filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/vf_xfade.c b/libavfilter/vf_xfade.c index 2e075cfb9a..c3e5f3df85 100644 --- a/libavfilter/vf_xfade.c +++ b/libavfilter/vf_xfade.c @@ -137,10 +137,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) diff --git a/libavfilter/vf_xmedian.c b/libavfilter/vf_xmedian.c index 168a5944db..c8ff37f797 100644 --- a/libavfilter/vf_xmedian.c +++ b/libavfilter/vf_xmedian.c @@ -86,10 +86,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) diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c index 17269d6b96..41069a711c 100644 --- a/libavfilter/vf_yadif.c +++ b/libavfilter/vf_yadif.c @@ -284,10 +284,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_output(AVFilterLink *outlink) diff --git a/libavfilter/vf_yaepblur.c b/libavfilter/vf_yaepblur.c index 3380f7112a..c68edc815a 100644 --- a/libavfilter/vf_yaepblur.c +++ b/libavfilter/vf_yaepblur.c @@ -83,7 +83,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); } typedef struct ThreadData { diff --git a/libavfilter/vf_zoompan.c b/libavfilter/vf_zoompan.c index 9115c23dc4..8a350aa92a 100644 --- a/libavfilter/vf_zoompan.c +++ b/libavfilter/vf_zoompan.c @@ -341,10 +341,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) diff --git a/libavfilter/vsrc_cellauto.c b/libavfilter/vsrc_cellauto.c index 250c88c8da..0b5b131786 100644 --- a/libavfilter/vsrc_cellauto.c +++ b/libavfilter/vsrc_cellauto.c @@ -311,10 +311,7 @@ static int request_frame(AVFilterLink *outlink) static int query_formats(AVFilterContext *ctx) { static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_MONOBLACK, 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 const AVFilterPad cellauto_outputs[] = { diff --git a/libavfilter/vsrc_gradients.c b/libavfilter/vsrc_gradients.c index 904baf1360..c1962b1ed8 100644 --- a/libavfilter/vsrc_gradients.c +++ b/libavfilter/vsrc_gradients.c @@ -91,10 +91,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 uint32_t lerp_color(uint8_t c0[4], uint8_t c1[4], float x) diff --git a/libavfilter/vsrc_life.c b/libavfilter/vsrc_life.c index ca12f294b8..b954f855c7 100644 --- a/libavfilter/vsrc_life.c +++ b/libavfilter/vsrc_life.c @@ -416,7 +416,6 @@ static int query_formats(AVFilterContext *ctx) { LifeContext *life = ctx->priv; enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_NONE, AV_PIX_FMT_NONE }; - AVFilterFormats *fmts_list; if (life->mold || memcmp(life-> life_color, "\xff\xff\xff", 3) || memcmp(life->death_color, "\x00\x00\x00", 3)) { @@ -427,8 +426,7 @@ static int query_formats(AVFilterContext *ctx) life->draw = fill_picture_monoblack; } - fmts_list = ff_make_format_list(pix_fmts); - return ff_set_common_formats(ctx, fmts_list); + return ff_set_common_formats_from_list(ctx, pix_fmts); } static const AVFilterPad life_outputs[] = { diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c index 88c14f0d48..20ae55835b 100644 --- a/libavfilter/vsrc_mandelbrot.c +++ b/libavfilter/vsrc_mandelbrot.c @@ -153,10 +153,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 *inlink) diff --git a/libavfilter/vsrc_mptestsrc.c b/libavfilter/vsrc_mptestsrc.c index 8aa75a24ac..0a6f3498b5 100644 --- a/libavfilter/vsrc_mptestsrc.c +++ b/libavfilter/vsrc_mptestsrc.c @@ -296,10 +296,7 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV420P, 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 request_frame(AVFilterLink *outlink) diff --git a/libavfilter/vsrc_sierpinski.c b/libavfilter/vsrc_sierpinski.c index 7db4852892..eec9e8c25d 100644 --- a/libavfilter/vsrc_sierpinski.c +++ b/libavfilter/vsrc_sierpinski.c @@ -78,10 +78,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 fill_sierpinski(SierpinskiContext *s, int x, int y) diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c index 08686938db..56b46c6bd8 100644 --- a/libavfilter/vsrc_testsrc.c +++ b/libavfilter/vsrc_testsrc.c @@ -376,10 +376,7 @@ static int haldclutsrc_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 haldclutsrc_config_props(AVFilterLink *outlink) @@ -659,10 +656,7 @@ static int test_query_formats(AVFilterContext *ctx) AV_PIX_FMT_RGB24, 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 const AVFilterPad avfilter_vsrc_testsrc_outputs[] = { @@ -1097,10 +1091,7 @@ static int rgbtest_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 rgbtest_config_props(AVFilterLink *outlink) @@ -1274,10 +1265,7 @@ static int yuvtest_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 yuvtest_config_props(AVFilterLink *outlink) @@ -1426,10 +1414,7 @@ static int smptebars_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 const AVFilterPad smptebars_outputs[] = { @@ -1759,10 +1744,7 @@ static int allyuv_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 const AVFilterPad avfilter_vsrc_allyuv_outputs[] = { @@ -1836,10 +1818,7 @@ static int allrgb_query_formats(AVFilterContext *ctx) AV_PIX_FMT_RGB24, 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 const AVFilterPad avfilter_vsrc_allrgb_outputs[] = { diff --git a/libavfilter/vulkan.c b/libavfilter/vulkan.c index 0ac5711182..337c8d7d5a 100644 --- a/libavfilter/vulkan.c +++ b/libavfilter/vulkan.c @@ -594,11 +594,8 @@ int ff_vk_filter_query_formats(AVFilterContext *avctx) static const enum AVPixelFormat pixel_formats[] = { AV_PIX_FMT_VULKAN, AV_PIX_FMT_NONE, }; - AVFilterFormats *pix_fmts = ff_make_format_list(pixel_formats); - if (!pix_fmts) - return AVERROR(ENOMEM); - return ff_set_common_formats(avctx, pix_fmts); + return ff_set_common_formats_from_list(avctx, pixel_formats); } static int vulkan_filter_set_device(AVFilterContext *avctx,