lavfi/vf_quirc: use FILTER_PIXFMTS_ARRAY() instead of query_formats()

This commit is contained in:
Anton Khirnov 2024-10-12 18:41:20 +02:00
parent d83d8a1643
commit c19f3fe61b
1 changed files with 13 additions and 18 deletions

View File

@ -71,23 +71,6 @@ static int config_input(AVFilterLink *inlink)
return 0; return 0;
} }
static int query_formats(AVFilterContext *ctx)
{
static const enum AVPixelFormat pix_fmts[] = {
AV_PIX_FMT_GRAY8,
AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P,
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P,
AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P,
AV_PIX_FMT_NV12, AV_PIX_FMT_NV21,
AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_YUVJ420P,
AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P,
AV_PIX_FMT_YUVJ440P,
AV_PIX_FMT_NONE
};
return ff_set_common_formats_from_list(ctx, pix_fmts);
}
static int filter_frame(AVFilterLink *inlink, AVFrame *frame) static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
{ {
FilterLink *inl = ff_filter_link(inlink); FilterLink *inl = ff_filter_link(inlink);
@ -154,6 +137,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
return ff_filter_frame(outlink, frame); return ff_filter_frame(outlink, frame);
} }
static const enum AVPixelFormat pix_fmts[] = {
AV_PIX_FMT_GRAY8,
AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P,
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P,
AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P,
AV_PIX_FMT_NV12, AV_PIX_FMT_NV21,
AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_YUVJ420P,
AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P,
AV_PIX_FMT_YUVJ440P,
AV_PIX_FMT_NONE
};
static const AVClass quirc_class = { static const AVClass quirc_class = {
.class_name = "quirc", .class_name = "quirc",
.version = LIBAVUTIL_VERSION_INT, .version = LIBAVUTIL_VERSION_INT,
@ -178,7 +173,7 @@ const AVFilter ff_vf_quirc = {
.uninit = uninit, .uninit = uninit,
FILTER_INPUTS(inputs), FILTER_INPUTS(inputs),
FILTER_OUTPUTS(ff_video_default_filterpad), FILTER_OUTPUTS(ff_video_default_filterpad),
FILTER_QUERY_FUNC(query_formats), FILTER_PIXFMTS_ARRAY(pix_fmts),
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC |
AVFILTER_FLAG_METADATA_ONLY, AVFILTER_FLAG_METADATA_ONLY,
}; };