@@ -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,
};
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@outlook.com> --- Untested as I don't have a mac. libavfilter/vf_coreimage.m | 37 ++----------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-)