From 115aaec76c7b87aa3564eb7cd98326594b040341 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 22 May 2018 18:24:53 +0200 Subject: 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. --- player/command.c | 14 +++++++------- 1 file 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); } -- cgit v1.2.3