mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
avfilter/vf_chromakey: Use formats list instead of query function
In this case it also allows to avoid a runtime check to which filter an AVFilterContext belongs to. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
a4722a4aa0
commit
17e44e4d1f
@ -301,9 +301,7 @@ static av_cold int config_output(AVFilterLink *outlink)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static av_cold int query_formats(AVFilterContext *avctx)
|
||||
{
|
||||
static const enum AVPixelFormat pixel_fmts[] = {
|
||||
static const enum AVPixelFormat chromakey_fmts[] = {
|
||||
AV_PIX_FMT_YUVA420P,
|
||||
AV_PIX_FMT_YUVA422P,
|
||||
AV_PIX_FMT_YUVA444P,
|
||||
@ -332,12 +330,6 @@ static av_cold int query_formats(AVFilterContext *avctx)
|
||||
AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
const enum AVPixelFormat *pix_fmts;
|
||||
|
||||
pix_fmts = !strcmp(avctx->filter->name, "chromahold") ? hold_pixel_fmts : pixel_fmts;
|
||||
|
||||
return ff_set_common_formats_from_list(avctx, pix_fmts);
|
||||
}
|
||||
|
||||
static av_cold int config_input(AVFilterLink *inlink)
|
||||
{
|
||||
@ -401,7 +393,7 @@ const AVFilter ff_vf_chromakey = {
|
||||
.priv_class = &chromakey_class,
|
||||
FILTER_INPUTS(chromakey_inputs),
|
||||
FILTER_OUTPUTS(chromakey_outputs),
|
||||
FILTER_QUERY_FUNC(query_formats),
|
||||
FILTER_PIXFMTS_ARRAY(chromakey_fmts),
|
||||
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
|
||||
.process_command = process_command,
|
||||
};
|
||||
@ -441,7 +433,7 @@ const AVFilter ff_vf_chromahold = {
|
||||
.priv_class = &chromahold_class,
|
||||
FILTER_INPUTS(chromahold_inputs),
|
||||
FILTER_OUTPUTS(chromahold_outputs),
|
||||
FILTER_QUERY_FUNC(query_formats),
|
||||
FILTER_PIXFMTS_ARRAY(hold_pixel_fmts),
|
||||
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
|
||||
.process_command = process_command,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user