Commit 0b189654 authored by Stefano Sabatini's avatar Stefano Sabatini

lavfi/il: move query_formats() definition up

Respect order of call during the filter lifecycle, improve readability.
parent 63a99622
...@@ -95,6 +95,21 @@ static av_cold int init(AVFilterContext *ctx, const char *args) ...@@ -95,6 +95,21 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
return 0; return 0;
} }
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
int fmt;
for (fmt = 0; fmt < AV_PIX_FMT_NB; fmt++) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);
if (!(desc->flags & PIX_FMT_PAL))
ff_add_format(&formats, fmt);
}
ff_set_common_formats(ctx, formats);
return 0;
}
static int config_input(AVFilterLink *inlink) static int config_input(AVFilterLink *inlink)
{ {
IlContext *il = inlink->dst->priv; IlContext *il = inlink->dst->priv;
...@@ -184,21 +199,6 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) ...@@ -184,21 +199,6 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
return ret; return ret;
} }
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
int fmt;
for (fmt = 0; fmt < AV_PIX_FMT_NB; fmt++) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);
if (!(desc->flags & PIX_FMT_PAL))
ff_add_format(&formats, fmt);
}
ff_set_common_formats(ctx, formats);
return 0;
}
static const AVFilterPad inputs[] = { static const AVFilterPad inputs[] = {
{ {
.name = "default", .name = "default",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment