summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c14
1 files changed, 8 insertions, 6 deletions
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);