[FFmpeg-cvslog] avfilter/vf_coreimage: Simplify query_formats
Andreas Rheinhardt
git at videolan.org
Fri Sep 17 17:30:18 EEST 2021
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Aug 15 07:43:21 2021 +0200| [f58abfbedc35737ca5a732acbb0448e771a236f8] | committer: Andreas Rheinhardt
avfilter/vf_coreimage: Simplify query_formats
Using ff_set_common_formats_from_list() avoids using different functions
depending upon how many inputs the filter has.
Reviewed-by: Thilo Borgmann <thilo.borgmann at mail.de>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f58abfbedc35737ca5a732acbb0448e771a236f8
---
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 5642d0cd28..5732903609 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,
FILTER_OUTPUTS(vsrc_coreimagesrc_outputs),
- .query_formats = query_formats_src,
+ .query_formats = query_formats,
};
More information about the ffmpeg-cvslog
mailing list