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.
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -259,6 +259,19 @@ release: · 258 unmodified lines | |||
| 259 | return ret; | 259 | return ret; |
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | static av_cold int vpp_preinit(AVFilterContext *ctx) | ||
| 263 | { | ||
| 264 | VPPContext *vpp = ctx->priv; | ||
| 265 | /* For AV_OPT_TYPE_STRING options, NULL is handled in other way so | ||
| 266 | * we needn't set default value here | ||
| 267 | */ | ||
| 268 | vpp->saturation = 1.0; | ||
| 269 | vpp->contrast = 1.0; | ||
| 270 | vpp->transpose = -1; | ||
| 271 | |||
| 272 | return 0; | ||
| 273 | } | ||
| 274 | |||
| 262 | static av_cold int vpp_init(AVFilterContext *ctx) | 275 | static av_cold int vpp_init(AVFilterContext *ctx) |
| 263 | { | 276 | { |
| 264 | VPPContext *vpp = ctx->priv; | 277 | VPPContext *vpp = ctx->priv; |
| @@ -683,6 +696,7 @@ const AVFilter ff_vf_vpp_qsv = { · 418 unmodified lines | |||
| 683 | .name = "vpp_qsv", | 696 | .name = "vpp_qsv", |
| 684 | .description = NULL_IF_CONFIG_SMALL("Quick Sync Video VPP."), | 697 | .description = NULL_IF_CONFIG_SMALL("Quick Sync Video VPP."), |
| 685 | .priv_size = sizeof(VPPContext), | 698 | .priv_size = sizeof(VPPContext), |
| 699 | .preinit = vpp_preinit, | ||
| 686 | .init = vpp_init, | 700 | .init = vpp_init, |
| 687 | .uninit = vpp_uninit, | 701 | .uninit = vpp_uninit, |
| 688 | FILTER_INPUTS(vpp_inputs), | 702 | FILTER_INPUTS(vpp_inputs), |