lavfi/vf_overlay: switch to query_func2()

master
Anton Khirnov 3 months ago
parent d50a63b04e
commit 0c86bc32aa
  1. 16
      libavfilter/vf_overlay.c

@ -161,9 +161,11 @@ static const enum AVPixelFormat alpha_pix_fmts[] = {
AV_PIX_FMT_BGRA, AV_PIX_FMT_GBRAP, AV_PIX_FMT_NONE
};
static int query_formats(AVFilterContext *ctx)
static int query_formats(const AVFilterContext *ctx,
AVFilterFormatsConfig **cfg_in,
AVFilterFormatsConfig **cfg_out)
{
OverlayContext *s = ctx->priv;
const OverlayContext *s = ctx->priv;
/* overlay formats contains alpha, for avoiding conversion with alpha information loss */
static const enum AVPixelFormat main_pix_fmts_yuv420[] = {
@ -268,18 +270,18 @@ static int query_formats(AVFilterContext *ctx)
overlay_formats = overlay_pix_fmts_gbrp;
break;
case OVERLAY_FORMAT_AUTO:
return ff_set_common_formats_from_list(ctx, alpha_pix_fmts);
return ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, alpha_pix_fmts);
default:
av_assert0(0);
}
formats = ff_make_format_list(main_formats);
if ((ret = ff_formats_ref(formats, &ctx->inputs[MAIN]->outcfg.formats)) < 0 ||
(ret = ff_formats_ref(formats, &ctx->outputs[MAIN]->incfg.formats)) < 0)
if ((ret = ff_formats_ref(formats, &cfg_in[MAIN]->formats)) < 0 ||
(ret = ff_formats_ref(formats, &cfg_out[MAIN]->formats)) < 0)
return ret;
return ff_formats_ref(ff_make_format_list(overlay_formats),
&ctx->inputs[OVERLAY]->outcfg.formats);
&cfg_in[OVERLAY]->formats);
}
static int config_input_overlay(AVFilterLink *inlink)
@ -1011,7 +1013,7 @@ const AVFilter ff_vf_overlay = {
.process_command = process_command,
FILTER_INPUTS(avfilter_vf_overlay_inputs),
FILTER_OUTPUTS(avfilter_vf_overlay_outputs),
FILTER_QUERY_FUNC(query_formats),
FILTER_QUERY_FUNC2(query_formats),
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |
AVFILTER_FLAG_SLICE_THREADS,
};

Loading…
Cancel
Save