From a770006c6ec1c0173e33a63d36cafca743e63808 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 21 May 2018 16:05:03 +0200 Subject: vd_lavc: move hwdec opts to local config, don't use global MPOpts The --hwdec* options are a good fit for the vd_lavc local option struct. This annoyingly requires manual prefixing of most of these options with --vd-lavc (could be avoided by using more sub-struct craziness, but let's not). --- player/command.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'player') diff --git a/player/command.c b/player/command.c index 7d52f2425c..229fb33757 100644 --- a/player/command.c +++ b/player/command.c @@ -2423,18 +2423,20 @@ static int mp_property_hwdec(void *ctx, struct m_property *prop, MPContext *mpctx = ctx; struct track *track = mpctx->current_track[0][STREAM_VIDEO]; struct mp_decoder_wrapper *dec = track ? track->dec : NULL; - struct MPOpts *opts = mpctx->opts; if (action == M_PROPERTY_SET) { char *new = *(char **)arg; + char *old = NULL; + if (mp_property_generic_option(mpctx, prop, M_PROPERTY_GET, &old) < 1) + old = NULL; - if (strcmp(opts->hwdec_api, new) == 0) - return M_PROPERTY_OK; + bool same = bstr_equals(bstr0(old), bstr0(new)); + + mp_property_generic_option(mpctx, prop, M_PROPERTY_SET, &new); - talloc_free(opts->hwdec_api); - opts->hwdec_api = talloc_strdup(NULL, new); + talloc_free(old); - if (!dec) + if (!dec || same) return M_PROPERTY_OK; mp_decoder_wrapper_control(dec, VDCTRL_REINIT, NULL); -- cgit v1.2.3