[FFmpeg-devel] [PATCH 06/10] avfilter/vf_coreimage: Simplify query_formats
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Sun Aug 15 12:55:34 EEST 2021
Using ff_set_common_formats_from_list() avoids using different functions
depending upon how many inputs the filter has.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
Untested as I don't have a mac.
libavfilter/vf_coreimage.m | 37 ++-----------------------------------
1 file changed, 2 insertions(+), 35 deletions(-)
diff --git a/libavfilter/vf_coreimage.m b/libavfilter/vf_coreimage.m
index 2d74c0f5ce..80a7e33847 100644
--- a/libavfilter/vf_coreimage.m
+++ b/libavfilter/vf_coreimage.m
@@ -142,40 +142,7 @@ static int query_formats(AVFilterContext *fctx)
AV_PIX_FMT_NONE
};
- AVFilterFormats *inout_formats;
- int ret;
-
- if (!(inout_formats = ff_make_format_list(inout_fmts_rgb))) {
- return AVERROR(ENOMEM);
- }
-
- if ((ret = ff_formats_ref(inout_formats, &fctx->inputs[0]->outcfg.formats)) < 0 ||
- (ret = ff_formats_ref(inout_formats, &fctx->outputs[0]->incfg.formats)) < 0) {
- return ret;
- }
-
- return 0;
-}
-
-static int query_formats_src(AVFilterContext *fctx)
-{
- static const enum AVPixelFormat inout_fmts_rgb[] = {
- AV_PIX_FMT_ARGB,
- AV_PIX_FMT_NONE
- };
-
- AVFilterFormats *inout_formats;
- int ret;
-
- if (!(inout_formats = ff_make_format_list(inout_fmts_rgb))) {
- return AVERROR(ENOMEM);
- }
-
- if ((ret = ff_formats_ref(inout_formats, &fctx->outputs[0]->incfg.formats)) < 0) {
- return ret;
- }
-
- return 0;
+ return ff_set_common_formats_from_list(fctx, inout_fmts_rgb);
}
static int apply_filter(CoreImageContext *ctx, AVFilterLink *link, AVFrame *frame)
@@ -683,5 +650,5 @@ const AVFilter ff_vsrc_coreimagesrc = {
.priv_class = &coreimagesrc_class,
.inputs = NULL,
FF_FILTER_OUTPUTS(vsrc_coreimagesrc_outputs),
- .query_formats = query_formats_src,
+ .query_formats = query_formats,
};
--
2.30.2
More information about the ffmpeg-devel
mailing list