summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-05-22 18:24:53 +0200
committerwm4 <wm4@nowhere>2018-05-24 19:56:35 +0200
commit115aaec76c7b87aa3564eb7cd98326594b040341 (patch)
treee1db8f2e90f8d142019e7c10d5cf55c67be164f1 /player/command.c
parent0317d7350ea247c04472c82f925a0bc065959ef6 (diff)
downloadmpv-115aaec76c7b87aa3564eb7cd98326594b040341.tar.bz2
mpv-115aaec76c7b87aa3564eb7cd98326594b040341.tar.xz
command: avoid some direct MPOpts write accesses
This is working towards a change intended in the future: nothing should write to the option struct directly, but use functions that raise proper notifications. Until this is complete it will take a while, and this commit does not change all cases of direct access, just some simple ones. In all of these 3 changes, the actual write access is done by the generic property-option bridge.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/player/command.c b/player/command.c
index 229fb33757..f556e7211d 100644
--- a/player/command.c
+++ b/player/command.c
@@ -453,10 +453,10 @@ static int mp_property_playback_speed(void *ctx, struct m_property *prop,
double speed = mpctx->opts->playback_speed;
switch (action) {
case M_PROPERTY_SET: {
- mpctx->opts->playback_speed = *(double *)arg;
+ int r = mp_property_generic_option(mpctx, prop, action, arg);
update_playback_speed(mpctx);
mp_wakeup_core(mpctx);
- return M_PROPERTY_OK;
+ return r;
}
case M_PROPERTY_PRINT:
*(char **)arg = talloc_asprintf(NULL, "%.2f", speed);
@@ -1143,11 +1143,10 @@ static int mp_property_edition(void *ctx, struct m_property *prop,
case M_PROPERTY_SET: {
edition = *(int *)arg;
if (edition != demuxer->edition) {
- mpctx->opts->edition_id = edition;
if (!mpctx->stop_play)
mpctx->stop_play = PT_CURRENT_ENTRY;
mp_wakeup_core(mpctx);
- break; // make it accessible to the demuxer via option change notify
+ break; // write value, trigger option change notify
}
return M_PROPERTY_OK;
}
@@ -2056,12 +2055,13 @@ static int mp_property_audio_delay(void *ctx, struct m_property *prop,
case M_PROPERTY_PRINT:
*(char **)arg = format_delay(delay);
return M_PROPERTY_OK;
- case M_PROPERTY_SET:
- mpctx->opts->audio_delay = *(float *)arg;
+ case M_PROPERTY_SET: {
+ int r = mp_property_generic_option(mpctx, prop, action, arg);
if (mpctx->ao_chain && mpctx->vo_chain)
mpctx->delay += mpctx->opts->audio_delay - delay;
mp_wakeup_core(mpctx);
- return M_PROPERTY_OK;
+ return r;
+ }
}
return mp_property_generic_option(mpctx, prop, action, arg);
}