mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
avfilter/vf_hsvkey: 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
253dc9bbc0
commit
a26efeb121
@ -244,9 +244,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 key_pixel_fmts[] = {
|
||||
AV_PIX_FMT_YUVA420P,
|
||||
AV_PIX_FMT_YUVA422P,
|
||||
AV_PIX_FMT_YUVA444P,
|
||||
@ -275,12 +273,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, "hsvhold") ? hold_pixel_fmts : pixel_fmts;
|
||||
|
||||
return ff_set_common_formats_from_list(avctx, pix_fmts);
|
||||
}
|
||||
|
||||
static av_cold int config_input(AVFilterLink *inlink)
|
||||
{
|
||||
@ -333,7 +325,7 @@ const AVFilter ff_vf_hsvkey = {
|
||||
.priv_class = &hsvkey_class,
|
||||
FILTER_INPUTS(hsvkey_inputs),
|
||||
FILTER_OUTPUTS(hsvkey_outputs),
|
||||
FILTER_QUERY_FUNC(query_formats),
|
||||
FILTER_PIXFMTS_ARRAY(key_pixel_fmts),
|
||||
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
|
||||
.process_command = ff_filter_process_command,
|
||||
};
|
||||
@ -374,7 +366,7 @@ const AVFilter ff_vf_hsvhold = {
|
||||
.priv_class = &hsvhold_class,
|
||||
FILTER_INPUTS(hsvhold_inputs),
|
||||
FILTER_OUTPUTS(hsvhold_outputs),
|
||||
FILTER_QUERY_FUNC(query_formats),
|
||||
FILTER_PIXFMTS_ARRAY(hold_pixel_fmts),
|
||||
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
|
||||
.process_command = ff_filter_process_command,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user