mirror of https://git.ffmpeg.org/ffmpeg.git
lavfi/vf_colorspace: switch to query_func2()
This commit is contained in:
parent
631e5bcdc7
commit
bc418fd872
|
@ -830,7 +830,9 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
|
||||||
return ff_filter_frame(outlink, out);
|
return ff_filter_frame(outlink, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int query_formats(AVFilterContext *ctx)
|
static int query_formats(const AVFilterContext *ctx,
|
||||||
|
AVFilterFormatsConfig **cfg_in,
|
||||||
|
AVFilterFormatsConfig **cfg_out)
|
||||||
{
|
{
|
||||||
static const enum AVPixelFormat pix_fmts[] = {
|
static const enum AVPixelFormat pix_fmts[] = {
|
||||||
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P,
|
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P,
|
||||||
|
@ -840,32 +842,34 @@ static int query_formats(AVFilterContext *ctx)
|
||||||
AV_PIX_FMT_NONE
|
AV_PIX_FMT_NONE
|
||||||
};
|
};
|
||||||
int res;
|
int res;
|
||||||
ColorSpaceContext *s = ctx->priv;
|
const ColorSpaceContext *s = ctx->priv;
|
||||||
AVFilterLink *outlink = ctx->outputs[0];
|
AVFilterFormats *formats;
|
||||||
AVFilterFormats *formats = ff_make_format_list(pix_fmts);
|
|
||||||
|
|
||||||
res = ff_formats_ref(ff_make_formats_list_singleton(s->out_csp), &outlink->incfg.color_spaces);
|
res = ff_formats_ref(ff_make_formats_list_singleton(s->out_csp), &cfg_out[0]->color_spaces);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
return res;
|
return res;
|
||||||
if (s->user_rng != AVCOL_RANGE_UNSPECIFIED) {
|
if (s->user_rng != AVCOL_RANGE_UNSPECIFIED) {
|
||||||
res = ff_formats_ref(ff_make_formats_list_singleton(s->user_rng), &outlink->incfg.color_ranges);
|
res = ff_formats_ref(ff_make_formats_list_singleton(s->user_rng), &cfg_out[0]->color_ranges);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
formats = ff_make_format_list(pix_fmts);
|
||||||
if (!formats)
|
if (!formats)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
if (s->user_format == AV_PIX_FMT_NONE)
|
if (s->user_format == AV_PIX_FMT_NONE)
|
||||||
return ff_set_common_formats(ctx, formats);
|
return ff_set_common_formats2(ctx, cfg_in, cfg_out, formats);
|
||||||
res = ff_formats_ref(formats, &ctx->inputs[0]->outcfg.formats);
|
|
||||||
|
res = ff_formats_ref(formats, &cfg_in[0]->formats);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
formats = NULL;
|
formats = NULL;
|
||||||
res = ff_add_format(&formats, s->user_format);
|
res = ff_add_format(&formats, s->user_format);
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
return ff_formats_ref(formats, &outlink->incfg.formats);
|
return ff_formats_ref(formats, &cfg_out[0]->formats);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_props(AVFilterLink *outlink)
|
static int config_props(AVFilterLink *outlink)
|
||||||
|
@ -1035,6 +1039,6 @@ const AVFilter ff_vf_colorspace = {
|
||||||
.priv_class = &colorspace_class,
|
.priv_class = &colorspace_class,
|
||||||
FILTER_INPUTS(inputs),
|
FILTER_INPUTS(inputs),
|
||||||
FILTER_OUTPUTS(outputs),
|
FILTER_OUTPUTS(outputs),
|
||||||
FILTER_QUERY_FUNC(query_formats),
|
FILTER_QUERY_FUNC2(query_formats),
|
||||||
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
|
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue