summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-05-21 16:05:03 +0200
committerwm4 <wm4@nowhere>2018-05-24 19:56:35 +0200
commita770006c6ec1c0173e33a63d36cafca743e63808 (patch)
tree9de13d0e85adc5dc025de829947f99af68b77dfb /player
parent3569857b7580f9037f5168a2e3888a86cc3a85a0 (diff)
downloadmpv-a770006c6ec1c0173e33a63d36cafca743e63808.tar.bz2
mpv-a770006c6ec1c0173e33a63d36cafca743e63808.tar.xz
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).
Diffstat (limited to 'player')
-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);