f_lavfi: provide color_space and color_range params for lavfi

Only when the lavfi version is sufficiently new enough to actually have
these fields. See:
2d555dc82d

Fixes #13234
This commit is contained in:
llyyr 2024-01-11 11:00:42 +05:30 committed by Niklas Haas
parent 4b69164147
commit 10321b869f
1 changed files with 4 additions and 0 deletions

View File

@ -492,6 +492,10 @@ static bool init_pads(struct lavfi *c)
params->sample_aspect_ratio.den = fmt->params.p_h;
params->hw_frames_ctx = fmt->hwctx;
params->frame_rate = av_d2q(fmt->nominal_fps, 1000000);
#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(9, 16, 100)
params->color_space = mp_csp_to_avcol_spc(fmt->params.color.space);
params->color_range = mp_csp_levels_to_avcol_range(fmt->params.color.levels);
#endif
filter_name = "buffer";
} else {
MP_ASSERT_UNREACHABLE();