summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-04-10 21:22:26 +0200
committerwm4 <wm4@nowhere>2017-04-10 21:22:26 +0200
commit844008004fbc58725509d2c25894b3ef1b259938 (patch)
tree7783da017b5db73a0a26b5cb2eddf126799db47b /player
parenta1b1972ec61108875d2ff15ab588a0cbd2b9b581 (diff)
downloadmpv-844008004fbc58725509d2c25894b3ef1b259938.tar.bz2
mpv-844008004fbc58725509d2c25894b3ef1b259938.tar.xz
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.)
Diffstat (limited to 'player')
-rw-r--r--player/command.c18
1 files 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);
}