summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorVladimir Panteleev <git@thecybershadow.net>2016-09-13 01:17:10 +0000
committerwm4 <wm4@nowhere>2016-09-13 09:23:22 +0200
commit00f8ee573ba3ff75f3591137b68faf563affb343 (patch)
treed972e58b232292c47587673c7b94095359553cd3 /player
parent08cbac311d313bbd7b0116bd2dc0a155f45d0584 (diff)
downloadmpv-00f8ee573ba3ff75f3591137b68faf563affb343.tar.bz2
mpv-00f8ee573ba3ff75f3591137b68faf563affb343.tar.xz
player: Apply new sub-speed values during playback
Diffstat (limited to 'player')
-rw-r--r--player/command.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index 152e232d62..6e30489954 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2942,6 +2942,26 @@ static int mp_property_sub_delay(void *ctx, struct m_property *prop,
return property_osd_helper(mpctx, prop, action, arg);
}
+/// Subtitle speed (RW)
+static int mp_property_sub_speed(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ 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;
+ }
+ }
+ return property_osd_helper(mpctx, prop, action, arg);
+}
+
static int mp_property_sub_pos(void *ctx, struct m_property *prop,
int action, void *arg)
{
@@ -3836,6 +3856,7 @@ static const struct m_property mp_properties_base[] = {
{"sid", mp_property_sub},
{"secondary-sid", mp_property_sub2},
{"sub-delay", mp_property_sub_delay},
+ {"sub-speed", mp_property_sub_speed},
{"sub-pos", mp_property_sub_pos},
{"sub-text", mp_property_sub_text},
{"sub-visibility", property_osd_helper},