avfilter/vf_normalize: Use formats list instead of query function

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
pull/369/head
Andreas Rheinhardt 4 years ago
parent bdfdb255f1
commit 7abe0a396c
  1. 11
      libavfilter/vf_normalize.c

@ -386,10 +386,8 @@ static void normalize(NormalizeContext *s, AVFrame *in, AVFrame *out)
// doc/writing_filters.txt for descriptions of what these interface functions // doc/writing_filters.txt for descriptions of what these interface functions
// are expected to do. // are expected to do.
// Set the pixel formats that our filter supports. We should be able to process // The pixel formats that our filter supports. We should be able to process
// any 8-bit RGB formats. 16-bit support might be useful one day. // any 8-bit RGB formats. 16-bit support might be useful one day.
static int query_formats(AVFilterContext *ctx)
{
static const enum AVPixelFormat pixel_fmts[] = { static const enum AVPixelFormat pixel_fmts[] = {
AV_PIX_FMT_RGB24, AV_PIX_FMT_RGB24,
AV_PIX_FMT_BGR24, AV_PIX_FMT_BGR24,
@ -408,11 +406,6 @@ static int query_formats(AVFilterContext *ctx)
AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16,
AV_PIX_FMT_NONE AV_PIX_FMT_NONE
}; };
// According to filter_design.txt, using ff_set_common_formats() this way
// ensures the pixel formats of the input and output will be the same. That
// saves a bit of effort possibly needing to handle format conversions.
return ff_set_common_formats_from_list(ctx, pixel_fmts);
}
// At this point we know the pixel format used for both input and output. We // At this point we know the pixel format used for both input and output. We
// can also access the frame rate of the input video and allocate some memory // can also access the frame rate of the input video and allocate some memory
@ -533,7 +526,7 @@ const AVFilter ff_vf_normalize = {
.uninit = uninit, .uninit = uninit,
FILTER_INPUTS(inputs), FILTER_INPUTS(inputs),
FILTER_OUTPUTS(outputs), FILTER_OUTPUTS(outputs),
FILTER_QUERY_FUNC(query_formats), FILTER_PIXFMTS_ARRAY(pixel_fmts),
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL,
.process_command = ff_filter_process_command, .process_command = ff_filter_process_command,
}; };

Loading…
Cancel
Save