diff mbox series

[FFmpeg-devel,v3,09/22] lavfi/vpp_qsv: add vpp_preinit callback

Message ID 20210615061403.1576282-10-haihao.xiang@intel.com
State New
Headers show
Series clean-up QSV filters
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Xiang, Haihao June 15, 2021, 6:13 a.m. UTC
Set the expected default value for options in this callback, hence we
have the right values even if these options are not included in the
option arrray. This is in preparation for re-using VPPContext but with a
different option array for other QSV filters
---
 libavfilter/vf_vpp_qsv.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff mbox series

Patch

diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
index fd45c4f352..fb950001c0 100644
--- a/libavfilter/vf_vpp_qsv.c
+++ b/libavfilter/vf_vpp_qsv.c
@@ -256,6 +256,19 @@  release:
     return ret;
 }
 
+static av_cold int vpp_preinit(AVFilterContext *ctx)
+{
+    VPPContext  *vpp  = ctx->priv;
+    /* For AV_OPT_TYPE_STRING options, NULL is handled in other way so
+     * we needn't set default value here
+     */
+    vpp->saturation = 1.0;
+    vpp->contrast = 1.0;
+    vpp->transpose = -1;
+
+    return 0;
+}
+
 static av_cold int vpp_init(AVFilterContext *ctx)
 {
     VPPContext  *vpp  = ctx->priv;
@@ -637,6 +650,7 @@  const AVFilter ff_vf_vpp_qsv = {
     .description   = NULL_IF_CONFIG_SMALL("Quick Sync Video VPP."),
     .priv_size     = sizeof(VPPContext),
     .query_formats = query_formats,
+    .preinit       = vpp_preinit,
     .init          = vpp_init,
     .uninit        = vpp_uninit,
     .inputs        = vpp_inputs,