From 844008004fbc58725509d2c25894b3ef1b259938 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 10 Apr 2017 21:22:26 +0200 Subject: command: update sub-fps etc. options on runtime changes Un-special-case the sub-speed property, and apply subtitle speed updates in more cases. In particular, this respects runtime changes of the sub-fps option. (A minor consequence of this is that the subtitle speed is recomputed more often even in cases when it's not necessary. Also, the subtitle update is slightly "delayed" rather than strictly instant. Both of these likely are absolutely not observable by the user, although the subtitle speed verbose log message will be printed more often if the subtitle format is MicroDVD.) --- player/command.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/player/command.c b/player/command.c index 31cdb20015..2e9f635dea 100644 --- a/player/command.c +++ b/player/command.c @@ -3102,17 +3102,7 @@ static int mp_property_sub_speed(void *ctx, struct m_property *prop, { MPContext *mpctx = ctx; struct MPOpts *opts = mpctx->opts; - switch (action) { - case M_PROPERTY_SET: { - opts->sub_speed = *(float *)arg; - struct track *track = mpctx->current_track[0][STREAM_SUB]; - struct dec_sub *sub = track ? track->d_sub : NULL; - if (sub) { - sub_control(track->d_sub, SD_CTRL_UPDATE_SPEED, NULL); - } - return M_PROPERTY_OK; - } - case M_PROPERTY_PRINT: + if (action == M_PROPERTY_PRINT) { *(char **)arg = talloc_asprintf(NULL, "%4.1f%%", 100 * opts->sub_speed); return M_PROPERTY_OK; } @@ -5767,6 +5757,12 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags) if (flags & UPDATE_OSD) { osd_changed(mpctx->osd); + for (int n = 0; n < NUM_PTRACKS; n++) { + struct track *track = mpctx->current_track[n][STREAM_SUB]; + struct dec_sub *sub = track ? track->d_sub : NULL; + if (sub) + sub_control(track->d_sub, SD_CTRL_UPDATE_SPEED, NULL); + } mp_wakeup_core(mpctx); } -- cgit v1.2.3