summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaihao Xiang <haihao.xiang@intel.com>2023-01-09 15:12:06 +0800
committerHaihao Xiang <haihao.xiang@intel.com>2023-01-17 10:10:52 +0800
commita1b3e8f2d73b4c0a28189f99bb25d04ff4ef44eb (patch)
treec8a969cdbf82b603e32c7618a7ce92acc1dae820
parenteb71c67dcc0990aec9cda9cb39de2a464de4068a (diff)
lavfi/vf_vpp_qsv: add vpp_preinit callback
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 reusing the code for other QSV filters. Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
-rw-r--r--libavfilter/vf_vpp_qsv.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
index cf11cd7fdc..2a7b06fa33 100644
--- a/libavfilter/vf_vpp_qsv.c
+++ b/libavfilter/vf_vpp_qsv.c
@@ -259,6 +259,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;
@@ -683,6 +696,7 @@ const AVFilter ff_vf_vpp_qsv = {
.name = "vpp_qsv",
.description = NULL_IF_CONFIG_SMALL("Quick Sync Video VPP."),
.priv_size = sizeof(VPPContext),
+ .preinit = vpp_preinit,
.init = vpp_init,
.uninit = vpp_uninit,
FILTER_INPUTS(vpp_inputs),