diff options
author | Paul B Mahol <onemda@gmail.com> | 2015-04-03 20:55:18 +0300 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2015-04-08 16:05:06 +0300 |
commit | a0854c084ea1541591c54aaab1f993ebaf92ffaf (patch) | |
tree | 1ebc69023a4f7eb471ce60ff4784b146a8b9973f /libavfilter | |
parent | 21e034a47a2b407f0896114a995fd507f0f5230f (diff) |
avfilter: handle error in query_formats() in bunch of filters
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter')
81 files changed, 401 insertions, 234 deletions
diff --git a/libavfilter/aeval.c b/libavfilter/aeval.c index 69de1f793f..b6c420a4a9 100644 --- a/libavfilter/aeval.c +++ b/libavfilter/aeval.c @@ -247,12 +247,28 @@ 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); + if (ret < 0) + return ret; - ff_set_common_formats (ctx, ff_make_format_list(sample_fmts)); - ff_set_common_channel_layouts(ctx, avfilter_make_format64_list(chlayouts)); - ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates)); + layouts = avfilter_make_format64_list(chlayouts); + if (!layouts) + return AVERROR(ENOMEM); + ret = ff_set_common_channel_layouts(ctx, layouts); + if (ret < 0) + return ret; - return 0; + formats = ff_make_format_list(sample_rates); + if (!formats) + return AVERROR(ENOMEM); + return ff_set_common_samplerates(ctx, formats); } static int request_frame(AVFilterLink *outlink) diff --git a/libavfilter/af_adelay.c b/libavfilter/af_adelay.c index ef60f43727..ca141ce3b0 100644 --- a/libavfilter/af_adelay.c +++ b/libavfilter/af_adelay.c @@ -64,23 +64,26 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; + int ret; layouts = ff_all_channel_layouts(); if (!layouts) return AVERROR(ENOMEM); - ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts(ctx, layouts); + if (ret < 0) + return ret; formats = ff_make_format_list(sample_fmts); if (!formats) return AVERROR(ENOMEM); - ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats(ctx, formats); + if (ret < 0) + return ret; formats = ff_all_samplerates(); if (!formats) return AVERROR(ENOMEM); - ff_set_common_samplerates(ctx, formats); - - return 0; + return ff_set_common_samplerates(ctx, formats); } #define DELAY(name, type, fill) \ diff --git a/libavfilter/af_aecho.c b/libavfilter/af_aecho.c index c26fdd49a9..8e7a39ecd0 100644 --- a/libavfilter/af_aecho.c +++ b/libavfilter/af_aecho.c @@ -158,23 +158,26 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; + int ret; layouts = ff_all_channel_layouts(); if (!layouts) return AVERROR(ENOMEM); - ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts(ctx, layouts); + if (ret < 0) + return ret; formats = ff_make_format_list(sample_fmts); if (!formats) return AVERROR(ENOMEM); - ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats(ctx, formats); + if (ret < 0) + return ret; formats = ff_all_samplerates(); if (!formats) return AVERROR(ENOMEM); - ff_set_common_samplerates(ctx, formats); - - return 0; + return ff_set_common_samplerates(ctx, formats); } #define MOD(a, b) (((a) >= (b)) ? (a) - (b) : (a)) diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c index 806f6f6145..8b69cefbde 100644 --- a/libavfilter/af_afade.c +++ b/libavfilter/af_afade.c @@ -98,23 +98,26 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; + int ret; layouts = ff_all_channel_layouts(); if (!layouts) return AVERROR(ENOMEM); - ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts(ctx, layouts); + if (ret < 0) + return ret; formats = ff_make_format_list(sample_fmts); if (!formats) return AVERROR(ENOMEM); - ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats(ctx, formats); + if (ret < 0) + return ret; formats = ff_all_samplerates(); if (!formats) return AVERROR(ENOMEM); - ff_set_common_samplerates(ctx, formats); - - return 0; + return ff_set_common_samplerates(ctx, formats); } static double fade_gain(int curve, int64_t index, int range) diff --git a/libavfilter/af_aformat.c b/libavfilter/af_aformat.c index 5fd0308d79..4fdcb09d2d 100644 --- a/libavfilter/af_aformat.c +++ b/libavfilter/af_aformat.c @@ -108,15 +108,18 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { AFormatContext *s = ctx->priv; + int ret; - ff_set_common_formats(ctx, s->formats ? s->formats : + ret = ff_set_common_formats(ctx, s->formats ? s->formats : ff_all_formats(AVMEDIA_TYPE_AUDIO)); - ff_set_common_samplerates(ctx, s->sample_rates ? s->sample_rates : + if (ret < 0) + return ret; + ret = ff_set_common_samplerates(ctx, s->sample_rates ? s->sample_rates : ff_all_samplerates()); - ff_set_common_channel_layouts(ctx, s->channel_layouts ? s->channel_layouts : + if (ret < 0) + return ret; + return ff_set_common_channel_layouts(ctx, s->channel_layouts ? s->channel_layouts : ff_all_channel_counts()); - - return 0; } static const AVFilterPad avfilter_af_aformat_inputs[] = { diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c index ff9af3d0e6..9a3cbd4dcd 100644 --- a/libavfilter/af_amix.c +++ b/libavfilter/af_amix.c @@ -534,6 +534,7 @@ static int query_formats(AVFilterContext *ctx) { AVFilterFormats *formats = NULL; AVFilterChannelLayouts *layouts; + int ret; layouts = ff_all_channel_layouts(); @@ -542,10 +543,13 @@ static int query_formats(AVFilterContext *ctx) ff_add_format(&formats, AV_SAMPLE_FMT_FLT); ff_add_format(&formats, AV_SAMPLE_FMT_FLTP); - ff_set_common_formats(ctx, formats); - ff_set_common_channel_layouts(ctx, layouts); - ff_set_common_samplerates(ctx, ff_all_samplerates()); - return 0; + ret = ff_set_common_formats(ctx, formats); + if (ret < 0) + return ret; + ret = ff_set_common_channel_layouts(ctx, layouts); + if (ret < 0) + return ret; + return ff_set_common_samplerates(ctx, ff_all_samplerates()); } static const AVFilterPad avfilter_af_amix_outputs[] = { diff --git a/libavfilter/af_aphaser.c b/libavfilter/af_aphaser.c index 708b568c74..b08570f90a 100644 --- a/libavfilter/af_aphaser.c +++ b/libavfilter/af_aphaser.c @@ -94,23 +94,26 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_NONE }; + int ret; layouts = ff_all_channel_layouts(); if (!layouts) return AVERROR(ENOMEM); - ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts(ctx, layouts); + if (ret < 0) + return ret; formats = ff_make_format_list(sample_fmts); if (!formats) return AVERROR(ENOMEM); - ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats(ctx, formats); + if (ret < 0) + return ret; formats = ff_all_samplerates(); if (!formats) return AVERROR(ENOMEM); - ff_set_common_samplerates(ctx, formats); - - return 0; + return ff_set_common_samplerates(ctx, formats); } #define MOD(a, b) (((a) >= (b)) ? (a) - (b) : (a)) diff --git a/libavfilter/af_asetrate.c b/libavfilter/af_asetrate.c index 0d069152f4..409c48fd14 100644 --- a/libavfilter/af_asetrate.c +++ b/libavfilter/af_asetrate.c @@ -51,9 +51,8 @@ static av_cold int query_formats(AVFilterContext *ctx) ASetRateContext *sr = ctx->priv; int sample_rates[] = { sr->sample_rate, -1 }; - ff_formats_ref(ff_make_format_list(sample_rates), + return ff_formats_ref(ff_make_format_list(sample_rates), &ctx->outputs[0]->in_samplerates); - return 0; } static av_cold int config_props(AVFilterLink *outlink) diff --git a/libavfilter/af_astats.c b/libavfilter/af_astats.c index c20f84d1f9..5780fb900a 100644 --- a/libavfilter/af_astats.c +++ b/libavfilter/af_astats.c @@ -64,23 +64,26 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; + int ret; layouts = ff_all_channel_layouts(); if (!layouts) return AVERROR(ENOMEM); - ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts(ctx, layouts); + if (ret < 0) + return ret; formats = ff_make_format_list(sample_fmts); if (!formats) return AVERROR(ENOMEM); - ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats(ctx, formats); + if (ret < 0) + return ret; formats = ff_all_samplerates(); if (!formats) return AVERROR(ENOMEM); - ff_set_common_samplerates(ctx, formats); - - return 0; + return ff_set_common_samplerates(ctx, formats); } static int config_output(AVFilterLink *outlink) diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c index fcd0cb0693..49d49ee2a9 100644 --- a/libavfilter/af_atempo.c +++ b/libavfilter/af_atempo.c @@ -1012,26 +1012,29 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; + int ret; layouts = ff_all_channel_layouts(); if (!layouts) { return AVERROR(ENOMEM); } - ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts(ctx, layouts); + if (ret < 0) + return ret; formats = ff_make_format_list(sample_fmts); if (!formats) { return AVERROR(ENOMEM); } - ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats(ctx, formats); + if (ret < 0) + return ret; formats = ff_all_samplerates(); if (!formats) { return AVERROR(ENOMEM); } - ff_set_common_samplerates(ctx, formats); - - return 0; + return ff_set_common_samplerates(ctx, formats); } static int config_props(AVFilterLink *inlink) diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c index 91662c4f5a..118a0c0b75 100644 --- a/libavfilter/af_biquads.c +++ b/libavfilter/af_biquads.c @@ -142,23 +142,26 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; + int ret; layouts = ff_all_channel_layouts(); if (!layouts) return AVERROR(ENOMEM); - ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts(ctx, layouts); + if (ret < 0) + return ret; formats = ff_make_format_list(sample_fmts); if (!formats) return AVERROR(ENOMEM); - ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats(ctx, formats); + if (ret < 0) + return ret; formats = ff_all_samplerates(); if (!formats) return AVERROR(ENOMEM); - ff_set_common_samplerates(ctx, formats); - - return 0; + return ff_set_common_samplerates(ctx, formats); } #define BIQUAD_FILTER(name, type, min, max, need_clipping) \ diff --git a/libavfilter/af_bs2b.c b/libavfilter/af_bs2b.c index 3dd0bcd99a..592fdec3d7 100644 --- a/libavfilter/af_bs2b.c +++ b/libavfilter/af_bs2b.c @@ -106,22 +106,25 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE, }; + int ret; if (ff_add_channel_layout(&layouts, AV_CH_LAYOUT_STEREO) != 0) return AVERROR(ENOMEM); - ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts(ctx, layouts); + if (ret < 0) + return ret; formats = ff_make_format_list(sample_fmts); if (!formats) return AVERROR(ENOMEM); - ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats(ctx, formats); + if (ret < 0) + return ret; formats = ff_all_samplerates(); if (!formats) return AVERROR(ENOMEM); - ff_set_common_samplerates(ctx, formats); - - return 0; + return ff_set_common_samplerates(ctx, formats); } static int filter_frame(AVFilterLink *inlink, AVFrame *frame) diff --git a/libavfilter/af_compand.c b/libavfilter/af_compand.c index 4ca73c4522..55ad98a15d 100644 --- a/libavfilter/af_compand.c +++ b/libavfilter/af_compand.c @@ -107,23 +107,26 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; + int ret; layouts = ff_all_channel_layouts(); if (!layouts) return AVERROR(ENOMEM); - ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts(ctx, layouts); + if (ret < 0) + return ret; formats = ff_make_format_list(sample_fmts); if (!formats) return AVERROR(ENOMEM); - ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats(ctx, formats); + if (ret < 0) + return ret; formats = ff_all_samplerates(); if (!formats) return AVERROR(ENOMEM); - ff_set_common_samplerates(ctx, formats); - - return 0; + return ff_set_common_samplerates(ctx, formats); } static void count_items(char *item_str, int *nb_items) diff --git a/libavfilter/af_dcshift.c b/libavfilter/af_dcshift.c index c1abb3c365..eb981568f1 100644 --- a/libavfilter/af_dcshift.c +++ b/libavfilter/af_dcshift.c @@ -59,23 +59,26 @@ static int query_formats(AVFilterContext *ctx) static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_NONE }; + int ret; layouts = ff_all_channel_layouts(); if (!layouts) return AVERROR(ENOMEM); - ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts(ctx, layouts); + if (ret < 0) + return ret; formats = ff_make_format_list(sample_fmts); if (!formats) return AVERROR(ENOMEM); - ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats(ctx, formats); + if (ret < 0) + return ret; formats = ff_all_samplerates(); if (!formats) return AVERROR(ENOMEM); - ff_set_common_samplerates(ctx, formats); - - return 0; + return ff_set_common_samplerates(ctx, formats); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/af_flanger.c b/libavfilter/af_flanger.c index 5ff3786673..106e6f73f8 100644 --- a/libavfilter/af_flanger.c +++ b/libavfilter/af_flanger.c @@ -95,23 +95,26 @@ static int query_formats(AVFilterContext *ctx) static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NONE }; + int ret; layouts = ff_all_channel_layouts(); if (!layouts) return AVERROR(ENOMEM); - ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts(ctx, layouts); + if (ret < 0) + return ret; formats = ff_make_format_list(sample_fmts); if (!formats) return AVERROR(ENOMEM); - ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats(ctx, formats); + if (ret < 0) + return ret; formats = ff_all_samplerates(); if (!formats) return AVERROR(ENOMEM); - ff_set_common_samplerates(ctx, formats); - - return 0; + return ff_set_common_samplerates(ctx, formats); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index 687d2e7ed1..b048d63738 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -164,23 +164,26 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }; + int ret; layouts = ff_all_channel_layouts(); if (!layouts) return AVERROR(ENOMEM); - ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts(ctx, layouts); + if (ret < 0) + return ret; formats = ff_make_format_list(sample_fmts); if (!formats) return AVERROR(ENOMEM); - ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats(ctx, formats); + if (ret < 0) + return ret; formats = ff_all_samplerates(); if (!formats) return AVERROR(ENOMEM); - ff_set_common_samplerates(ctx, formats); - - return 0; + return ff_set_common_samplerates(ctx, formats); } static const AVFilterPad silencedetect_inputs[] = { diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c index 02b64cefec..cd1e0384d3 100644 --- a/libavfilter/af_silenceremove.c +++ b/libavfilter/af_silenceremove.c @@ -418,23 +418,26 @@ static int query_formats(AVFilterContext *ctx) static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_NONE }; + int ret; layouts = ff_all_channel_layouts(); if (!layouts) return AVERROR(ENOMEM); - ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts(ctx, layouts); + if (ret < 0) + return ret; formats = ff_make_format_list(sample_fmts); if (!formats) return AVERROR(ENOMEM); - ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats(ctx, formats); + if (ret < 0) + return ret; formats = ff_all_samplerates(); if (!formats) return AVERROR(ENOMEM); - ff_set_common_samplerates(ctx, formats); - - return 0; + return ff_set_common_samplerates(ctx, formats); } static av_cold void uninit(AVFilterContext *ctx) diff --git a/libavfilter/af_volume.c b/libavfilter/af_volume.c index 8d49c65163..54bffa6015 100644 --- a/libavfilter/af_volume.c +++ b/libavfilter/af_volume.c @@ -153,23 +153,26 @@ static int query_formats(AVFilterContext *ctx) AV_SAMPLE_FMT_NONE } }; + int ret; layouts = ff_all_channel_counts(); if (!layouts) return AVERROR(ENOMEM); - ff_set_common_channel_layouts(ctx, layouts); + ret = ff_set_common_channel_layouts(ctx, layouts); + if (ret < 0) + return ret; formats = ff_make_format_list(sample_fmts[vol->precision]); if (!formats) return AVERROR(ENOMEM); - ff_set_common_formats(ctx, formats); + ret = ff_set_common_formats(ctx, formats); + if (ret < 0) + return ret; formats = ff_all_samplerates(); if (!formats) return AVERROR(ENOMEM); - ff_set_common_samplerates(ctx, formats); - - return 0; + return ff_set_common_samplerates(ctx, formats); } 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 5de115e9f2..01f24baea0 100644 --- a/libavfilter/af_volumedetect.c +++ b/libavfilter/af_volumedetect.c @@ -44,9 +44,7 @@ static int query_formats(AVFilterContext *ctx) if (!(formats = ff_make_format_list(sample_fmts))) return AVERROR(ENOMEM); - ff_set_common_formats(ctx, formats); - - return 0; + return ff_set_common_formats(ctx, formats); } static int filter_frame(AVFilterLink *inlink, AVFrame *samples) diff --git a/libavfilter/asrc_sine.c b/libavfilter/asrc_sine.c index 68e13980b3..6aa01d5ec5 100644 --- a/libavfilter/asrc_sine.c +++ b/libavfilter/asrc_sine.c @@ -153,11 +153,28 @@ 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; - ff_set_common_formats (ctx, ff_make_format_list(sample_fmts)); - ff_set_common_channel_layouts(ctx, avfilter_make_format64_list(chlayouts)); - ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates)); - return 0; + formats = ff_make_format_list(sample_fmts); + if (!formats) + return AVERROR(ENOMEM); + ret = ff_set_common_formats (ctx, formats); + if (ret < 0) + return ret; + + layouts = avfilter_make_format64_list(chlayouts); + if (!layouts) + return AVERROR(ENOMEM); + ret = ff_set_common_channel_layouts(ctx, layouts); + if (ret < 0) + return ret; + + formats = ff_make_format_list(sample_rates); + if (!formats) + return AVERROR(ENOMEM); + return ff_set_common_samplerates(ctx, formats); } static av_cold int config_props(AVFilterLink *outlink) diff --git a/libavfilter/vf_bbox.c b/libavfilter/vf_bbox.c index 1e6feff508..e92c3b477f 100644 --- a/libavfilter/vf_bbox.c +++ b/libavfilter/vf_bbox.c @@ -56,8 +56,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE, }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } #define SET_META(key, value) \ diff --git a/libavfilter/vf_blackdetect.c b/libavfilter/vf_blackdetect.c index 87a7a23fa4..fbe3d108db 100644 --- a/libavfilter/vf_blackdetect.c +++ b/libavfilter/vf_blackdetect.c @@ -80,8 +80,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_blackframe.c b/libavfilter/vf_blackframe.c index 1be9fcca9d..ad6d488b3a 100644 --- a/libavfilter/vf_blackframe.c +++ b/libavfilter/vf_blackframe.c @@ -54,8 +54,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } #define SET_META(key, format, value) \ diff --git a/libavfilter/vf_blend.c b/libavfilter/vf_blend.c index d232457714..5fe704610d 100644 --- a/libavfilter/vf_blend.c +++ b/libavfilter/vf_blend.c @@ -369,8 +369,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static av_cold void uninit(AVFilterContext *ctx) diff --git a/libavfilter/vf_boxblur.c b/libavfilter/vf_boxblur.c index bcf0ca5b72..17db949bc6 100644 --- a/libavfilter/vf_boxblur.c +++ b/libavfilter/vf_boxblur.c @@ -128,8 +128,7 @@ static int query_formats(AVFilterContext *ctx) ff_add_format(&formats, fmt); } - ff_set_common_formats(ctx, formats); - return 0; + return ff_set_common_formats(ctx, formats); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_colorchannelmixer.c b/libavfilter/vf_colorchannelmixer.c index fca382e7ab..0fffd341c5 100644 --- a/libavfilter/vf_colorchannelmixer.c +++ b/libavfilter/vf_colorchannelmixer.c @@ -81,8 +81,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int config_output(AVFilterLink *outlink) diff --git a/libavfilter/vf_colorlevels.c b/libavfilter/vf_colorlevels.c index 4ceea664e0..7157c9138a 100644 --- a/libavfilter/vf_colorlevels.c +++ b/libavfilter/vf_colorlevels.c @@ -84,8 +84,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c index a2f029a2f7..6f7e5d4238 100644 --- a/libavfilter/vf_crop.c +++ b/libavfilter/vf_crop.c @@ -102,8 +102,7 @@ static int query_formats(AVFilterContext *ctx) ff_add_format(&formats, fmt); } - ff_set_common_formats(ctx, formats); - return 0; + return ff_set_common_formats(ctx, formats); } static av_cold void uninit(AVFilterContext *ctx) diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c index e8492cd1f1..485ae69fb3 100644 --- a/libavfilter/vf_cropdetect.c +++ b/libavfilter/vf_cropdetect.c @@ -62,8 +62,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int checkline(void *ctx, const unsigned char *src, int stride, int len, int bpp) diff --git a/libavfilter/vf_detelecine.c b/libavfilter/vf_detelecine.c index 8ad7ae32f2..44379a3ec7 100644 --- a/libavfilter/vf_detelecine.c +++ b/libavfilter/vf_detelecine.c @@ -126,8 +126,7 @@ static int query_formats(AVFilterContext *ctx) ff_add_format(&pix_fmts, fmt); } - ff_set_common_formats(ctx, pix_fmts); - return 0; + return ff_set_common_formats(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index a955d09781..37eb231524 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -682,8 +682,7 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0)); - return 0; + return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0)); } static int glyph_enu_free(void *opaque, void *elem) diff --git a/libavfilter/vf_fade.c b/libavfilter/vf_fade.c index a7597cdff0..ab2dccf85b 100644 --- a/libavfilter/vf_fade.c +++ b/libavfilter/vf_fade.c @@ -115,12 +115,15 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA, AV_PIX_FMT_NONE }; + AVFilterFormats *fmts_list; if (s->black_fade) - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + fmts_list = ff_make_format_list(pix_fmts); else - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts_rgb)); - return 0; + fmts_list = ff_make_format_list(pix_fmts_rgb); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } const static enum AVPixelFormat studio_level_pix_fmts[] = { diff --git a/libavfilter/vf_fftfilt.c b/libavfilter/vf_fftfilt.c index dff279c00b..dd522fa3d1 100644 --- a/libavfilter/vf_fftfilt.c +++ b/libavfilter/vf_fftfilt.c @@ -307,9 +307,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pixel_fmts_fftfilt)); - - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pixel_fmts_fftfilt); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static const AVFilterPad fftfilt_inputs[] = { diff --git a/libavfilter/vf_format.c b/libavfilter/vf_format.c index 96cb7fd077..1fb3442af1 100644 --- a/libavfilter/vf_format.c +++ b/libavfilter/vf_format.c @@ -134,8 +134,7 @@ static int query_formats(AVFilterContext *ctx) if (!formats) return AVERROR(ENOMEM); - ff_set_common_formats(ctx, formats); - return 0; + return ff_set_common_formats(ctx, formats); } diff --git a/libavfilter/vf_framepack.c b/libavfilter/vf_framepack.c index 285381db90..e9b9ed1362 100644 --- a/libavfilter/vf_framepack.c +++ b/libavfilter/vf_framepack.c @@ -61,8 +61,10 @@ static const enum AVPixelFormat formats_supported[] = { static int query_formats(AVFilterContext *ctx) { // this will ensure that formats are the same on all pads - ff_set_common_formats(ctx, ff_make_format_list(formats_supported)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(formats_supported); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static av_cold void framepack_uninit(AVFilterContext *ctx) diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c index e5d5e11c98..bbefe51c0f 100644 --- a/libavfilter/vf_frei0r.c +++ b/libavfilter/vf_frei0r.c @@ -385,8 +385,7 @@ static int query_formats(AVFilterContext *ctx) if (!formats) return AVERROR(ENOMEM); - ff_set_common_formats(ctx, formats); - return 0; + return ff_set_common_formats(ctx, formats); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/vf_fspp.c b/libavfilter/vf_fspp.c index 5283ef8a5e..7bdaa91b06 100644 --- a/libavfilter/vf_fspp.c +++ b/libavfilter/vf_fspp.c @@ -501,8 +501,11 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_geq.c b/libavfilter/vf_geq.c index b0f53a62b5..887594f866 100644 --- a/libavfilter/vf_geq.c +++ b/libavfilter/vf_geq.c @@ -176,11 +176,15 @@ static int geq_query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP, AV_PIX_FMT_NONE }; + AVFilterFormats *fmts_list; + if (geq->is_rgb) { - ff_set_common_formats(ctx, ff_make_format_list(rgb_pix_fmts)); + fmts_list = ff_make_format_list(rgb_pix_fmts); } else - ff_set_common_formats(ctx, ff_make_format_list(yuv_pix_fmts)); - return 0; + fmts_list = ff_make_format_list(yuv_pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int geq_config_props(AVFilterLink *inlink) diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c index 519a609fd0..362bd013a9 100644 --- a/libavfilter/vf_hflip.c +++ b/libavfilter/vf_hflip.c @@ -55,8 +55,7 @@ static int query_formats(AVFilterContext *ctx) ff_add_format(&pix_fmts, fmt); } - ff_set_common_formats(ctx, pix_fmts); - return 0; + return ff_set_common_formats(ctx, pix_fmts); } static int config_props(AVFilterLink *inlink) diff --git a/libavfilter/vf_histogram.c b/libavfilter/vf_histogram.c index 40ec40096f..31004b71db 100644 --- a/libavfilter/vf_histogram.c +++ b/libavfilter/vf_histogram.c @@ -105,6 +105,7 @@ static int query_formats(AVFilterContext *ctx) { HistogramContext *h = ctx->priv; const enum AVPixelFormat *pix_fmts; + AVFilterFormats *fmts_list; switch (h->mode) { case MODE_WAVEFORM: @@ -121,9 +122,10 @@ static int query_formats(AVFilterContext *ctx) av_assert0(0); } - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - - return 0; + fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static const uint8_t black_yuva_color[4] = { 0, 127, 127, 255 }; diff --git a/libavfilter/vf_il.c b/libavfilter/vf_il.c index 2501ef8351..edb58d0324 100644 --- a/libavfilter/vf_il.c +++ b/libavfilter/vf_il.c @@ -92,8 +92,7 @@ static int query_formats(AVFilterContext *ctx) ff_add_format(&formats, fmt); } - ff_set_common_formats(ctx, formats); - return 0; + return ff_set_common_formats(ctx, formats); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_interlace.c b/libavfilter/vf_interlace.c index 93a83aa31a..a520776f57 100644 --- a/libavfilter/vf_interlace.c +++ b/libavfilter/vf_interlace.c @@ -76,8 +76,10 @@ static const enum AVPixelFormat formats_supported[] = { static int query_formats(AVFilterContext *ctx) { - ff_set_common_formats(ctx, ff_make_format_list(formats_supported)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(formats_supported); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static av_cold void uninit(AVFilterContext *ctx) diff --git a/libavfilter/vf_kerndeint.c b/libavfilter/vf_kerndeint.c index 1158fdb10c..0e2417ad59 100644 --- a/libavfilter/vf_kerndeint.c +++ b/libavfilter/vf_kerndeint.c @@ -78,9 +78,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int config_props(AVFilterLink *inlink) diff --git a/libavfilter/vf_noise.c b/libavfilter/vf_noise.c index 4acad8a98b..861ac09087 100644 --- a/libavfilter/vf_noise.c +++ b/libavfilter/vf_noise.c @@ -141,8 +141,7 @@ static int query_formats(AVFilterContext *ctx) ff_add_format(&formats, fmt); } - ff_set_common_formats(ctx, formats); - return 0; + return ff_set_common_formats(ctx, formats); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c index 2d9b9d0362..63dc6a8b6c 100644 --- a/libavfilter/vf_pad.c +++ b/libavfilter/vf_pad.c @@ -73,8 +73,7 @@ enum var_name { static int query_formats(AVFilterContext *ctx) { - ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0)); - return 0; + return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0)); } typedef struct PadContext { diff --git a/libavfilter/vf_perspective.c b/libavfilter/vf_perspective.c index 2f2032e927..970870cda5 100644 --- a/libavfilter/vf_perspective.c +++ b/libavfilter/vf_perspective.c @@ -93,8 +93,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static inline double get_coeff(double d) diff --git a/libavfilter/vf_phase.c b/libavfilter/vf_phase.c index 1818355ac2..35c343fbec 100644 --- a/libavfilter/vf_phase.c +++ b/libavfilter/vf_phase.c @@ -77,8 +77,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_pp.c b/libavfilter/vf_pp.c index ff60e61dac..bac1d53356 100644 --- a/libavfilter/vf_pp.c +++ b/libavfilter/vf_pp.c @@ -85,8 +85,11 @@ static int pp_query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int pp_config_props(AVFilterLink *inlink) diff --git a/libavfilter/vf_pp7.c b/libavfilter/vf_pp7.c index 47617289d7..9e78c39ac7 100644 --- a/libavfilter/vf_pp7.c +++ b/libavfilter/vf_pp7.c @@ -274,8 +274,11 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c index a76a9f9da2..406be881a6 100644 --- a/libavfilter/vf_psnr.c +++ b/libavfilter/vf_psnr.c @@ -232,8 +232,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int config_input_ref(AVFilterLink *inlink) diff --git a/libavfilter/vf_pullup.c b/libavfilter/vf_pullup.c index c38d0bb05c..ea15019ab0 100644 --- a/libavfilter/vf_pullup.c +++ b/libavfilter/vf_pullup.c @@ -63,8 +63,11 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } #define ABS(a) (((a) ^ ((a) >> 31)) - ((a) >> 31)) diff --git a/libavfilter/vf_removelogo.c b/libavfilter/vf_removelogo.c index dd7629f9c8..94b92a5853 100644 --- a/libavfilter/vf_removelogo.c +++ b/libavfilter/vf_removelogo.c @@ -206,8 +206,10 @@ 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 }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int load_mask(uint8_t **mask, int *w, int *h, diff --git a/libavfilter/vf_repeatfields.c b/libavfilter/vf_repeatfields.c index 5dbfd52d68..b9e73ec6de 100644 --- a/libavfilter/vf_repeatfields.c +++ b/libavfilter/vf_repeatfields.c @@ -50,9 +50,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pixel_fmts_eq)); - - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pixel_fmts_eq); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_rotate.c b/libavfilter/vf_rotate.c index e5eff6b589..46ab796c7a 100644 --- a/libavfilter/vf_rotate.c +++ b/libavfilter/vf_rotate.c @@ -145,8 +145,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static double get_rotated_w(void *opaque, double angle) diff --git a/libavfilter/vf_sab.c b/libavfilter/vf_sab.c index b8bf1bc2ef..da59439652 100644 --- a/libavfilter/vf_sab.c +++ b/libavfilter/vf_sab.c @@ -65,9 +65,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV411P, AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } #define RADIUS_MIN 0.1 diff --git a/libavfilter/vf_signalstats.c b/libavfilter/vf_signalstats.c index e89bd79bef..88b715e698 100644 --- a/libavfilter/vf_signalstats.c +++ b/libavfilter/vf_signalstats.c @@ -118,8 +118,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static AVFrame *alloc_frame(enum AVPixelFormat pixfmt, int w, int h) diff --git a/libavfilter/vf_smartblur.c b/libavfilter/vf_smartblur.c index b09ec90ec0..169f540b15 100644 --- a/libavfilter/vf_smartblur.c +++ b/libavfilter/vf_smartblur.c @@ -124,9 +124,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } 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 19c2c72d22..b75f5f3937 100644 --- a/libavfilter/vf_spp.c +++ b/libavfilter/vf_spp.c @@ -319,8 +319,11 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GBRP10, AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_stereo3d.c b/libavfilter/vf_stereo3d.c index d86a7f2e95..771bdde676 100644 --- a/libavfilter/vf_stereo3d.c +++ b/libavfilter/vf_stereo3d.c @@ -256,6 +256,7 @@ 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: @@ -278,9 +279,10 @@ static int query_formats(AVFilterContext *ctx) pix_fmts = other_pix_fmts; } - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - - return 0; + fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int config_output(AVFilterLink *outlink) diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c index 90416b5076..5e1324c715 100644 --- a/libavfilter/vf_subtitles.c +++ b/libavfilter/vf_subtitles.c @@ -129,8 +129,7 @@ static av_cold void uninit(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0)); - return 0; + return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0)); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_super2xsai.c b/libavfilter/vf_super2xsai.c index 686dac166e..67e9f97e54 100644 --- a/libavfilter/vf_super2xsai.c +++ b/libavfilter/vf_super2xsai.c @@ -241,8 +241,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_swapuv.c b/libavfilter/vf_swapuv.c index 175e39c63b..632e31c75e 100644 --- a/libavfilter/vf_swapuv.c +++ b/libavfilter/vf_swapuv.c @@ -79,8 +79,7 @@ static int query_formats(AVFilterContext *ctx) ff_add_format(&formats, fmt); } - ff_set_common_formats(ctx, formats); - return 0; + return ff_set_common_formats(ctx, formats); } static const AVFilterPad swapuv_inputs[] = { diff --git a/libavfilter/vf_telecine.c b/libavfilter/vf_telecine.c index 93e5aa9e44..26f0ef8abc 100644 --- a/libavfilter/vf_telecine.c +++ b/libavfilter/vf_telecine.c @@ -112,8 +112,7 @@ static int query_formats(AVFilterContext *ctx) ff_add_format(&pix_fmts, fmt); } - ff_set_common_formats(ctx, pix_fmts); - return 0; + return ff_set_common_formats(ctx, pix_fmts); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_thumbnail.c b/libavfilter/vf_thumbnail.c index 1883154378..d70d0635a3 100644 --- a/libavfilter/vf_thumbnail.c +++ b/libavfilter/vf_thumbnail.c @@ -203,8 +203,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static const AVFilterPad thumbnail_inputs[] = { diff --git a/libavfilter/vf_tile.c b/libavfilter/vf_tile.c index 459ae462ef..47569771d0 100644 --- a/libavfilter/vf_tile.c +++ b/libavfilter/vf_tile.c @@ -87,8 +87,7 @@ static av_cold int init(AVFilterContext *ctx) static int query_formats(AVFilterContext *ctx) { - ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0)); - return 0; + return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0)); } static int config_props(AVFilterLink *outlink) diff --git a/libavfilter/vf_tinterlace.c b/libavfilter/vf_tinterlace.c index f3411f99b6..096a614d67 100644 --- a/libavfilter/vf_tinterlace.c +++ b/libavfilter/vf_tinterlace.c @@ -81,8 +81,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static void lowpass_line_c(uint8_t *dstp, ptrdiff_t width, const uint8_t *srcp, diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c index dd570e6527..911329caac 100644 --- a/libavfilter/vf_transpose.c +++ b/libavfilter/vf_transpose.c @@ -75,8 +75,7 @@ static int query_formats(AVFilterContext *ctx) } - ff_set_common_formats(ctx, pix_fmts); - return 0; + return ff_set_common_formats(ctx, pix_fmts); } static int config_props_output(AVFilterLink *outlink) diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c index 2b8d0460ef..d5f5018ce4 100644 --- a/libavfilter/vf_unsharp.c +++ b/libavfilter/vf_unsharp.c @@ -163,9 +163,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } 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 6ce3e596b0..82ee99760c 100644 --- a/libavfilter/vf_uspp.c +++ b/libavfilter/vf_uspp.c @@ -293,8 +293,11 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_vidstabdetect.c b/libavfilter/vf_vidstabdetect.c index 1df6f74f4e..d8f70f985e 100644 --- a/libavfilter/vf_vidstabdetect.c +++ b/libavfilter/vf_vidstabdetect.c @@ -93,8 +93,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_vidstabtransform.c b/libavfilter/vf_vidstabtransform.c index 9db6a46290..97e6661d37 100644 --- a/libavfilter/vf_vidstabtransform.c +++ b/libavfilter/vf_vidstabtransform.c @@ -132,8 +132,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } diff --git a/libavfilter/vf_vignette.c b/libavfilter/vf_vignette.c index 5f4c5fa8e5..69ac6d7d32 100644 --- a/libavfilter/vf_vignette.c +++ b/libavfilter/vf_vignette.c @@ -136,8 +136,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } 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 3de7394ddd..bb0316b3dc 100644 --- a/libavfilter/vf_w3fdif.c +++ b/libavfilter/vf_w3fdif.c @@ -74,9 +74,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int config_input(AVFilterLink *inlink) diff --git a/libavfilter/vf_xbr.c b/libavfilter/vf_xbr.c index 5c14565b3a..38c3b70673 100644 --- a/libavfilter/vf_xbr.c +++ b/libavfilter/vf_xbr.c @@ -342,8 +342,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_0RGB32, AV_PIX_FMT_NONE, }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int filter_frame(AVFilterLink *inlink, AVFrame *in) diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c index ea72e62ebd..b32f38b57a 100644 --- a/libavfilter/vf_yadif.c +++ b/libavfilter/vf_yadif.c @@ -461,9 +461,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int config_props(AVFilterLink *link) diff --git a/libavfilter/vf_zoompan.c b/libavfilter/vf_zoompan.c index 8f179e669b..d1268513ca 100644 --- a/libavfilter/vf_zoompan.c +++ b/libavfilter/vf_zoompan.c @@ -264,9 +264,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static av_cold void uninit(AVFilterContext *ctx) diff --git a/libavfilter/vsrc_cellauto.c b/libavfilter/vsrc_cellauto.c index 5e2df2df0d..4f4b01c60d 100644 --- a/libavfilter/vsrc_cellauto.c +++ b/libavfilter/vsrc_cellauto.c @@ -310,8 +310,10 @@ 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 }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static const AVFilterPad cellauto_outputs[] = { diff --git a/libavfilter/vsrc_life.c b/libavfilter/vsrc_life.c index 9410fbeb0f..20bc56a4dd 100644 --- a/libavfilter/vsrc_life.c +++ b/libavfilter/vsrc_life.c @@ -423,7 +423,11 @@ static int query_formats(AVFilterContext *ctx) pix_fmts[0] = AV_PIX_FMT_MONOBLACK; life->draw = fill_picture_monoblack; } - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); + + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + ff_set_common_formats(ctx, fmts_list); return 0; } diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c index 66b0798188..e26fecd968 100644 --- a/libavfilter/vsrc_mandelbrot.c +++ b/libavfilter/vsrc_mandelbrot.c @@ -153,8 +153,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int config_props(AVFilterLink *inlink) diff --git a/libavfilter/vsrc_mptestsrc.c b/libavfilter/vsrc_mptestsrc.c index d93df7d198..bc5b2cd252 100644 --- a/libavfilter/vsrc_mptestsrc.c +++ b/libavfilter/vsrc_mptestsrc.c @@ -291,8 +291,10 @@ static int query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int request_frame(AVFilterLink *outlink) diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c index 8814440760..7f981bad23 100644 --- a/libavfilter/vsrc_testsrc.c +++ b/libavfilter/vsrc_testsrc.c @@ -202,8 +202,7 @@ static av_cold int color_init(AVFilterContext *ctx) static int color_query_formats(AVFilterContext *ctx) { - ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0)); - return 0; + return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0)); } static int color_config_props(AVFilterLink *inlink) @@ -366,8 +365,11 @@ static int haldclutsrc_query_formats(AVFilterContext *ctx) AV_PIX_FMT_RGBA64, AV_PIX_FMT_BGRA64, AV_PIX_FMT_NONE, }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int haldclutsrc_config_props(AVFilterLink *outlink) @@ -646,8 +648,11 @@ static int test_query_formats(AVFilterContext *ctx) static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static const AVFilterPad avfilter_vsrc_testsrc_outputs[] = { @@ -754,8 +759,11 @@ static int rgbtest_query_formats(AVFilterContext *ctx) AV_PIX_FMT_RGB555, AV_PIX_FMT_BGR555, AV_PIX_FMT_NONE }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static int rgbtest_config_props(AVFilterLink *outlink) @@ -883,8 +891,11 @@ static int smptebars_query_formats(AVFilterContext *ctx) AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_NONE, }; - ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); - return 0; + + AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts); + if (!fmts_list) + return AVERROR(ENOMEM); + return ff_set_common_formats(ctx, fmts_list); } static const AVFilterPad smptebars_outputs[] = { |