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@mail.de> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
10ad3cd798
commit
f58abfbedc
@ -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,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user